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

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

There is a newer version: 9.0.73
Show newest version
/*
 * 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.AddInteractionToWorkbinData;
import com.genesys.internal.workspace.model.ApiErrorResponse;
import com.genesys.internal.workspace.model.ApiSuccessResponse;
import com.genesys.internal.workspace.model.GetWorkbinContentData;
import com.genesys.internal.workspace.model.GetWorkbinsContentData;
import com.genesys.internal.workspace.model.PullInteractionFromWorkbinData;
import com.genesys.internal.workspace.model.SubscribeToWorkbinNotificationsData;
import com.genesys.internal.workspace.model.UnsubscribeToWorkbinNotificationsData;

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

public class WorkbinsApi {
    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Build call for addInteractionToWorkbin
     * @param workbinId Id of the Workbin (required)
     * @param addInteractionToWorkbinData  (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 addInteractionToWorkbinCall(String workbinId, AddInteractionToWorkbinData addInteractionToWorkbinData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = addInteractionToWorkbinData;

        // create path and map variables
        String localVarPath = "/workbins/{workbinId}/add-interaction"
            .replaceAll("\\{" + "workbinId" + "\\}", apiClient.escapeString(workbinId.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 addInteractionToWorkbinValidateBeforeCall(String workbinId, AddInteractionToWorkbinData addInteractionToWorkbinData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'workbinId' is set
        if (workbinId == null) {
            throw new ApiException("Missing the required parameter 'workbinId' when calling addInteractionToWorkbin(Async)");
        }
        
        // verify the required parameter 'addInteractionToWorkbinData' is set
        if (addInteractionToWorkbinData == null) {
            throw new ApiException("Missing the required parameter 'addInteractionToWorkbinData' when calling addInteractionToWorkbin(Async)");
        }
        

        com.squareup.okhttp.Call call = addInteractionToWorkbinCall(workbinId, addInteractionToWorkbinData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Add an Interaction to a workbin
     * 
     * @param workbinId Id of the Workbin (required)
     * @param addInteractionToWorkbinData  (required)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse addInteractionToWorkbin(String workbinId, AddInteractionToWorkbinData addInteractionToWorkbinData) throws ApiException {
        ApiResponse resp = addInteractionToWorkbinWithHttpInfo(workbinId, addInteractionToWorkbinData);
        return resp.getData();
    }

    /**
     * Add an Interaction to a workbin
     * 
     * @param workbinId Id of the Workbin (required)
     * @param addInteractionToWorkbinData  (required)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse addInteractionToWorkbinWithHttpInfo(String workbinId, AddInteractionToWorkbinData addInteractionToWorkbinData) throws ApiException {
        com.squareup.okhttp.Call call = addInteractionToWorkbinValidateBeforeCall(workbinId, addInteractionToWorkbinData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Add an Interaction to a workbin (asynchronously)
     * 
     * @param workbinId Id of the Workbin (required)
     * @param addInteractionToWorkbinData  (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 addInteractionToWorkbinAsync(String workbinId, AddInteractionToWorkbinData addInteractionToWorkbinData, 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 = addInteractionToWorkbinValidateBeforeCall(workbinId, addInteractionToWorkbinData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getWorkbinContent
     * @param workbinId Id of the Workbin (required)
     * @param getWorkbinContentData  (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 getWorkbinContentCall(String workbinId, GetWorkbinContentData getWorkbinContentData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = getWorkbinContentData;

        // create path and map variables
        String localVarPath = "/workbins/{workbinId}/get-content"
            .replaceAll("\\{" + "workbinId" + "\\}", apiClient.escapeString(workbinId.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 getWorkbinContentValidateBeforeCall(String workbinId, GetWorkbinContentData getWorkbinContentData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'workbinId' is set
        if (workbinId == null) {
            throw new ApiException("Missing the required parameter 'workbinId' when calling getWorkbinContent(Async)");
        }
        
        // verify the required parameter 'getWorkbinContentData' is set
        if (getWorkbinContentData == null) {
            throw new ApiException("Missing the required parameter 'getWorkbinContentData' when calling getWorkbinContent(Async)");
        }
        

        com.squareup.okhttp.Call call = getWorkbinContentCall(workbinId, getWorkbinContentData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Get the content of a Workbin.
     * 
     * @param workbinId Id of the Workbin (required)
     * @param getWorkbinContentData  (required)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse getWorkbinContent(String workbinId, GetWorkbinContentData getWorkbinContentData) throws ApiException {
        ApiResponse resp = getWorkbinContentWithHttpInfo(workbinId, getWorkbinContentData);
        return resp.getData();
    }

    /**
     * Get the content of a Workbin.
     * 
     * @param workbinId Id of the Workbin (required)
     * @param getWorkbinContentData  (required)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse getWorkbinContentWithHttpInfo(String workbinId, GetWorkbinContentData getWorkbinContentData) throws ApiException {
        com.squareup.okhttp.Call call = getWorkbinContentValidateBeforeCall(workbinId, getWorkbinContentData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Get the content of a Workbin. (asynchronously)
     * 
     * @param workbinId Id of the Workbin (required)
     * @param getWorkbinContentData  (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 getWorkbinContentAsync(String workbinId, GetWorkbinContentData getWorkbinContentData, 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 = getWorkbinContentValidateBeforeCall(workbinId, getWorkbinContentData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getWorkbins
     * @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 getWorkbinsCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/workbins/get-workbins";

        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 getWorkbinsValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        

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

    }

    /**
     * Get All Valid Workbins.
     * 
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse getWorkbins() throws ApiException {
        ApiResponse resp = getWorkbinsWithHttpInfo();
        return resp.getData();
    }

    /**
     * Get All Valid Workbins.
     * 
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse getWorkbinsWithHttpInfo() throws ApiException {
        com.squareup.okhttp.Call call = getWorkbinsValidateBeforeCall(null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Get All Valid Workbins. (asynchronously)
     * 
     * @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 getWorkbinsAsync(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 = getWorkbinsValidateBeforeCall(progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getWorkbinsContent
     * @param getWorkbinsContentData  (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 getWorkbinsContentCall(GetWorkbinsContentData getWorkbinsContentData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = getWorkbinsContentData;

        // create path and map variables
        String localVarPath = "/workbins/get-contents";

        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 getWorkbinsContentValidateBeforeCall(GetWorkbinsContentData getWorkbinsContentData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'getWorkbinsContentData' is set
        if (getWorkbinsContentData == null) {
            throw new ApiException("Missing the required parameter 'getWorkbinsContentData' when calling getWorkbinsContent(Async)");
        }
        

        com.squareup.okhttp.Call call = getWorkbinsContentCall(getWorkbinsContentData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Get the content of multiple Workbins.
     * 
     * @param getWorkbinsContentData  (required)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse getWorkbinsContent(GetWorkbinsContentData getWorkbinsContentData) throws ApiException {
        ApiResponse resp = getWorkbinsContentWithHttpInfo(getWorkbinsContentData);
        return resp.getData();
    }

    /**
     * Get the content of multiple Workbins.
     * 
     * @param getWorkbinsContentData  (required)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse getWorkbinsContentWithHttpInfo(GetWorkbinsContentData getWorkbinsContentData) throws ApiException {
        com.squareup.okhttp.Call call = getWorkbinsContentValidateBeforeCall(getWorkbinsContentData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Get the content of multiple Workbins. (asynchronously)
     * 
     * @param getWorkbinsContentData  (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 getWorkbinsContentAsync(GetWorkbinsContentData getWorkbinsContentData, 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 = getWorkbinsContentValidateBeforeCall(getWorkbinsContentData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for pullInteractionFromWorkbin
     * @param workbinId Id of the Workbin (required)
     * @param pullInteractionFromWorkbinData  (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 pullInteractionFromWorkbinCall(String workbinId, PullInteractionFromWorkbinData pullInteractionFromWorkbinData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = pullInteractionFromWorkbinData;

        // create path and map variables
        String localVarPath = "/workbins/{workbinId}/pull-interaction"
            .replaceAll("\\{" + "workbinId" + "\\}", apiClient.escapeString(workbinId.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 pullInteractionFromWorkbinValidateBeforeCall(String workbinId, PullInteractionFromWorkbinData pullInteractionFromWorkbinData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'workbinId' is set
        if (workbinId == null) {
            throw new ApiException("Missing the required parameter 'workbinId' when calling pullInteractionFromWorkbin(Async)");
        }
        
        // verify the required parameter 'pullInteractionFromWorkbinData' is set
        if (pullInteractionFromWorkbinData == null) {
            throw new ApiException("Missing the required parameter 'pullInteractionFromWorkbinData' when calling pullInteractionFromWorkbin(Async)");
        }
        

        com.squareup.okhttp.Call call = pullInteractionFromWorkbinCall(workbinId, pullInteractionFromWorkbinData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Pull an Interaction from a Workbin
     * 
     * @param workbinId Id of the Workbin (required)
     * @param pullInteractionFromWorkbinData  (required)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse pullInteractionFromWorkbin(String workbinId, PullInteractionFromWorkbinData pullInteractionFromWorkbinData) throws ApiException {
        ApiResponse resp = pullInteractionFromWorkbinWithHttpInfo(workbinId, pullInteractionFromWorkbinData);
        return resp.getData();
    }

    /**
     * Pull an Interaction from a Workbin
     * 
     * @param workbinId Id of the Workbin (required)
     * @param pullInteractionFromWorkbinData  (required)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse pullInteractionFromWorkbinWithHttpInfo(String workbinId, PullInteractionFromWorkbinData pullInteractionFromWorkbinData) throws ApiException {
        com.squareup.okhttp.Call call = pullInteractionFromWorkbinValidateBeforeCall(workbinId, pullInteractionFromWorkbinData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Pull an Interaction from a Workbin (asynchronously)
     * 
     * @param workbinId Id of the Workbin (required)
     * @param pullInteractionFromWorkbinData  (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 pullInteractionFromWorkbinAsync(String workbinId, PullInteractionFromWorkbinData pullInteractionFromWorkbinData, 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 = pullInteractionFromWorkbinValidateBeforeCall(workbinId, pullInteractionFromWorkbinData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for subscribeToWorkbinNotifications
     * @param workbinId Id of the Workbin (required)
     * @param subscribeToWorkbinNotificationsData  (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 subscribeToWorkbinNotificationsCall(String workbinId, SubscribeToWorkbinNotificationsData subscribeToWorkbinNotificationsData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = subscribeToWorkbinNotificationsData;

        // create path and map variables
        String localVarPath = "/workbins/{workbinId}/subscribe"
            .replaceAll("\\{" + "workbinId" + "\\}", apiClient.escapeString(workbinId.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 subscribeToWorkbinNotificationsValidateBeforeCall(String workbinId, SubscribeToWorkbinNotificationsData subscribeToWorkbinNotificationsData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'workbinId' is set
        if (workbinId == null) {
            throw new ApiException("Missing the required parameter 'workbinId' when calling subscribeToWorkbinNotifications(Async)");
        }
        
        // verify the required parameter 'subscribeToWorkbinNotificationsData' is set
        if (subscribeToWorkbinNotificationsData == null) {
            throw new ApiException("Missing the required parameter 'subscribeToWorkbinNotificationsData' when calling subscribeToWorkbinNotifications(Async)");
        }
        

        com.squareup.okhttp.Call call = subscribeToWorkbinNotificationsCall(workbinId, subscribeToWorkbinNotificationsData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Subscribe to be notified of changes of the content of a Workbin.
     * 
     * @param workbinId Id of the Workbin (required)
     * @param subscribeToWorkbinNotificationsData  (required)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse subscribeToWorkbinNotifications(String workbinId, SubscribeToWorkbinNotificationsData subscribeToWorkbinNotificationsData) throws ApiException {
        ApiResponse resp = subscribeToWorkbinNotificationsWithHttpInfo(workbinId, subscribeToWorkbinNotificationsData);
        return resp.getData();
    }

    /**
     * Subscribe to be notified of changes of the content of a Workbin.
     * 
     * @param workbinId Id of the Workbin (required)
     * @param subscribeToWorkbinNotificationsData  (required)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse subscribeToWorkbinNotificationsWithHttpInfo(String workbinId, SubscribeToWorkbinNotificationsData subscribeToWorkbinNotificationsData) throws ApiException {
        com.squareup.okhttp.Call call = subscribeToWorkbinNotificationsValidateBeforeCall(workbinId, subscribeToWorkbinNotificationsData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Subscribe to be notified of changes of the content of a Workbin. (asynchronously)
     * 
     * @param workbinId Id of the Workbin (required)
     * @param subscribeToWorkbinNotificationsData  (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 subscribeToWorkbinNotificationsAsync(String workbinId, SubscribeToWorkbinNotificationsData subscribeToWorkbinNotificationsData, 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 = subscribeToWorkbinNotificationsValidateBeforeCall(workbinId, subscribeToWorkbinNotificationsData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for unsubscribeToWorkbinNotifications
     * @param workbinId Id of the Workbin (required)
     * @param unsubscribeToWorkbinNotificationsData  (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 unsubscribeToWorkbinNotificationsCall(String workbinId, UnsubscribeToWorkbinNotificationsData unsubscribeToWorkbinNotificationsData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = unsubscribeToWorkbinNotificationsData;

        // create path and map variables
        String localVarPath = "/workbins/{workbinId}/unsubscribe"
            .replaceAll("\\{" + "workbinId" + "\\}", apiClient.escapeString(workbinId.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 unsubscribeToWorkbinNotificationsValidateBeforeCall(String workbinId, UnsubscribeToWorkbinNotificationsData unsubscribeToWorkbinNotificationsData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'workbinId' is set
        if (workbinId == null) {
            throw new ApiException("Missing the required parameter 'workbinId' when calling unsubscribeToWorkbinNotifications(Async)");
        }
        
        // verify the required parameter 'unsubscribeToWorkbinNotificationsData' is set
        if (unsubscribeToWorkbinNotificationsData == null) {
            throw new ApiException("Missing the required parameter 'unsubscribeToWorkbinNotificationsData' when calling unsubscribeToWorkbinNotifications(Async)");
        }
        

        com.squareup.okhttp.Call call = unsubscribeToWorkbinNotificationsCall(workbinId, unsubscribeToWorkbinNotificationsData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Unsubscribe to the notifications of changes of the content of a Workbin.
     * 
     * @param workbinId Id of the Workbin (required)
     * @param unsubscribeToWorkbinNotificationsData  (required)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse unsubscribeToWorkbinNotifications(String workbinId, UnsubscribeToWorkbinNotificationsData unsubscribeToWorkbinNotificationsData) throws ApiException {
        ApiResponse resp = unsubscribeToWorkbinNotificationsWithHttpInfo(workbinId, unsubscribeToWorkbinNotificationsData);
        return resp.getData();
    }

    /**
     * Unsubscribe to the notifications of changes of the content of a Workbin.
     * 
     * @param workbinId Id of the Workbin (required)
     * @param unsubscribeToWorkbinNotificationsData  (required)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse unsubscribeToWorkbinNotificationsWithHttpInfo(String workbinId, UnsubscribeToWorkbinNotificationsData unsubscribeToWorkbinNotificationsData) throws ApiException {
        com.squareup.okhttp.Call call = unsubscribeToWorkbinNotificationsValidateBeforeCall(workbinId, unsubscribeToWorkbinNotificationsData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Unsubscribe to the notifications of changes of the content of a Workbin. (asynchronously)
     * 
     * @param workbinId Id of the Workbin (required)
     * @param unsubscribeToWorkbinNotificationsData  (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 unsubscribeToWorkbinNotificationsAsync(String workbinId, UnsubscribeToWorkbinNotificationsData unsubscribeToWorkbinNotificationsData, 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 = unsubscribeToWorkbinNotificationsValidateBeforeCall(workbinId, unsubscribeToWorkbinNotificationsData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy