UNPKG

genesys-workspace-client-js

Version:
1,208 lines (1,039 loc) 58.8 kB
/** * Workspace API * Agent API * * OpenAPI spec version: 9.0.000.97.4639 * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * * Swagger Codegen version: 2.4.5 * * Do not edit the class manually. * */ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['ApiClient', 'model/AcceptData3', 'model/AddCommentData', 'model/AddDocumentData', 'model/ApiErrorResponse', 'model/ApiSuccessResponse', 'model/CompleteData', 'model/LogoutMediaData', 'model/MediaStartMonitoringData', 'model/MediaStopMonitoringData', 'model/MediaSwicthToCoachData', 'model/MediaSwicthToCoachData1', 'model/MediaSwicthToCoachData2', 'model/NotReadyForMediaData', 'model/PlaceInQueueData', 'model/PullInteractionFromWorkbinData', 'model/ReadyForMediaData', 'model/RejectData', 'model/RemoveAttachmentData', 'model/TransferData', 'model/UserData1', 'model/UserDataOperationId'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('../model/AcceptData3'), require('../model/AddCommentData'), require('../model/AddDocumentData'), require('../model/ApiErrorResponse'), require('../model/ApiSuccessResponse'), require('../model/CompleteData'), require('../model/LogoutMediaData'), require('../model/MediaStartMonitoringData'), require('../model/MediaStopMonitoringData'), require('../model/MediaSwicthToCoachData'), require('../model/MediaSwicthToCoachData1'), require('../model/MediaSwicthToCoachData2'), require('../model/NotReadyForMediaData'), require('../model/PlaceInQueueData'), require('../model/PullInteractionFromWorkbinData'), require('../model/ReadyForMediaData'), require('../model/RejectData'), require('../model/RemoveAttachmentData'), require('../model/TransferData'), require('../model/UserData1'), require('../model/UserDataOperationId')); } else { // Browser globals (root is window) if (!root.WorkspaceApi) { root.WorkspaceApi = {}; } root.WorkspaceApi.MediaApi = factory(root.WorkspaceApi.ApiClient, root.WorkspaceApi.AcceptData3, root.WorkspaceApi.AddCommentData, root.WorkspaceApi.AddDocumentData, root.WorkspaceApi.ApiErrorResponse, root.WorkspaceApi.ApiSuccessResponse, root.WorkspaceApi.CompleteData, root.WorkspaceApi.LogoutMediaData, root.WorkspaceApi.MediaStartMonitoringData, root.WorkspaceApi.MediaStopMonitoringData, root.WorkspaceApi.MediaSwicthToCoachData, root.WorkspaceApi.MediaSwicthToCoachData1, root.WorkspaceApi.MediaSwicthToCoachData2, root.WorkspaceApi.NotReadyForMediaData, root.WorkspaceApi.PlaceInQueueData, root.WorkspaceApi.PullInteractionFromWorkbinData, root.WorkspaceApi.ReadyForMediaData, root.WorkspaceApi.RejectData, root.WorkspaceApi.RemoveAttachmentData, root.WorkspaceApi.TransferData, root.WorkspaceApi.UserData1, root.WorkspaceApi.UserDataOperationId); } }(this, function(ApiClient, AcceptData3, AddCommentData, AddDocumentData, ApiErrorResponse, ApiSuccessResponse, CompleteData, LogoutMediaData, MediaStartMonitoringData, MediaStopMonitoringData, MediaSwicthToCoachData, MediaSwicthToCoachData1, MediaSwicthToCoachData2, NotReadyForMediaData, PlaceInQueueData, PullInteractionFromWorkbinData, ReadyForMediaData, RejectData, RemoveAttachmentData, TransferData, UserData1, UserDataOperationId) { 'use strict'; /** * Media service. * @module api/MediaApi * @version 9.0.000.97.4639 */ /** * Constructs a new MediaApi. * @alias module:api/MediaApi * @class * @param {module:ApiClient} [apiClient] Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ var exports = function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * Accept an interaction * Accept the specified interaction. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction to accept. * @param {Object} opts Optional parameters * @param {module:model/AcceptData3} opts.acceptData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.acceptWithHttpInfo = function(mediatype, id, opts) { opts = opts || {}; var postBody = opts['acceptData']; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling accept"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling accept"); } var pathParams = { 'mediatype': mediatype, 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/interactions/{id}/accept', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Accept an interaction * Accept the specified interaction. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction to accept. * @param {Object} opts Optional parameters * @param {module:model/AcceptData3} opts.acceptData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.accept = function(mediatype, id, opts) { return this.acceptWithHttpInfo(mediatype, id, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Add a document * Add a document to the specified interaction. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction. * @param {module:model/AddDocumentData} addDocumentData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.addDocumentWithHttpInfo = function(mediatype, id, addDocumentData) { var postBody = addDocumentData; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling addDocument"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling addDocument"); } // verify the required parameter 'addDocumentData' is set if (addDocumentData === undefined || addDocumentData === null) { throw new Error("Missing the required parameter 'addDocumentData' when calling addDocument"); } var pathParams = { 'mediatype': mediatype, 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/interactions/{id}/add-document', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Add a document * Add a document to the specified interaction. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction. * @param {module:model/AddDocumentData} addDocumentData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.addDocument = function(mediatype, id, addDocumentData) { return this.addDocumentWithHttpInfo(mediatype, id, addDocumentData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Attach user data to an interaction * Attach the provided data to the specified interaction. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction. * @param {module:model/UserDataOperationId} userData The data to attach to the interaction. This is an array of objects with the properties key, type, and value. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.attachMediaUserDataWithHttpInfo = function(mediatype, id, userData) { var postBody = userData; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling attachMediaUserData"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling attachMediaUserData"); } // verify the required parameter 'userData' is set if (userData === undefined || userData === null) { throw new Error("Missing the required parameter 'userData' when calling attachMediaUserData"); } var pathParams = { 'mediatype': mediatype, 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/interactions/{id}/attach-user-data', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Attach user data to an interaction * Attach the provided data to the specified interaction. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction. * @param {module:model/UserDataOperationId} userData The data to attach to the interaction. This is an array of objects with the properties key, type, and value. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.attachMediaUserData = function(mediatype, id, userData) { return this.attachMediaUserDataWithHttpInfo(mediatype, id, userData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Get an attachment * Get the specified attachment from the interaction * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction. * @param {String} documentId The ID of the document. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link 'String'} and HTTP response */ this.attachmentsWithHttpInfo = function(mediatype, id, documentId) { var postBody = null; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling attachments"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling attachments"); } // verify the required parameter 'documentId' is set if (documentId === undefined || documentId === null) { throw new Error("Missing the required parameter 'documentId' when calling attachments"); } var pathParams = { 'mediatype': mediatype, 'id': id, 'documentId': documentId }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/octet-stream']; var returnType = 'String'; return this.apiClient.callApi( '/media/{mediatype}/interactions/{id}/attachments/{documentId}', 'GET', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Get an attachment * Get the specified attachment from the interaction * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction. * @param {String} documentId The ID of the document. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link 'String'} */ this.attachments = function(mediatype, id, documentId) { return this.attachmentsWithHttpInfo(mediatype, id, documentId) .then(function(response_and_data) { return response_and_data.data; }); } /** * Complete an interaction * Marks the specified interaction as complete. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction to complete. * @param {Object} opts Optional parameters * @param {module:model/CompleteData} opts.completeData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.completeWithHttpInfo = function(mediatype, id, opts) { opts = opts || {}; var postBody = opts['completeData']; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling complete"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling complete"); } var pathParams = { 'mediatype': mediatype, 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/interactions/{id}/complete', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Complete an interaction * Marks the specified interaction as complete. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction to complete. * @param {Object} opts Optional parameters * @param {module:model/CompleteData} opts.completeData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.complete = function(mediatype, id, opts) { return this.completeWithHttpInfo(mediatype, id, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Remove key/value pairs from user data * Delete data with the specified keys from the interaction's user data. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction. * @param {module:model/UserData1} userData The keys of the data to remove. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.deleteMediaUserDataWithHttpInfo = function(mediatype, id, userData) { var postBody = userData; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling deleteMediaUserData"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling deleteMediaUserData"); } // verify the required parameter 'userData' is set if (userData === undefined || userData === null) { throw new Error("Missing the required parameter 'userData' when calling deleteMediaUserData"); } var pathParams = { 'mediatype': mediatype, 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/interactions/{id}/delete-user-data', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Remove key/value pairs from user data * Delete data with the specified keys from the interaction's user data. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction. * @param {module:model/UserData1} userData The keys of the data to remove. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.deleteMediaUserData = function(mediatype, id, userData) { return this.deleteMediaUserDataWithHttpInfo(mediatype, id, userData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Start monitoring an agent * Start supervisor monitoring of an agent on the specified media channel. When a monitored agent accepts a chat, the supervisor also receives the chat and all related notifications. If the agent is currently in a chat, the supervisor is added to the agent's next chat. The supervisor can't send messages in this mode and only another supervisor can see that the monitoring supervisor joined the chat. If the monitored agent leaves the chat but another agent is still present, the supervisor continues monitoring the chat until it's completed or placed in a queue. Once you've enabled monitoring, you can change the monitoring mode using [/media/{mediatype}/interactions/{id}/switch-to-barge-in](/reference/workspace/Media/index.html#mediaSwicthToBargeIn), [/media/{mediatype}/interactions/{id}/switch-to-coach](/reference/workspace/Media/index.html#mediaSwicthToCoach), and [/media/{mediatype}/interactions/{id}/switch-to-monitor](/reference/workspace/Media/index.html#mediaSwicthToMonitor). * @param {String} mediatype The media channel. * @param {Object} opts Optional parameters * @param {module:model/MediaStartMonitoringData} opts.mediaStartMonitoringData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.mediaStartMonitoringWithHttpInfo = function(mediatype, opts) { opts = opts || {}; var postBody = opts['mediaStartMonitoringData']; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling mediaStartMonitoring"); } var pathParams = { 'mediatype': mediatype }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/start-monitoring', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Start monitoring an agent * Start supervisor monitoring of an agent on the specified media channel. When a monitored agent accepts a chat, the supervisor also receives the chat and all related notifications. If the agent is currently in a chat, the supervisor is added to the agent's next chat. The supervisor can't send messages in this mode and only another supervisor can see that the monitoring supervisor joined the chat. If the monitored agent leaves the chat but another agent is still present, the supervisor continues monitoring the chat until it's completed or placed in a queue. Once you've enabled monitoring, you can change the monitoring mode using [/media/{mediatype}/interactions/{id}/switch-to-barge-in](/reference/workspace/Media/index.html#mediaSwicthToBargeIn), [/media/{mediatype}/interactions/{id}/switch-to-coach](/reference/workspace/Media/index.html#mediaSwicthToCoach), and [/media/{mediatype}/interactions/{id}/switch-to-monitor](/reference/workspace/Media/index.html#mediaSwicthToMonitor). * @param {String} mediatype The media channel. * @param {Object} opts Optional parameters * @param {module:model/MediaStartMonitoringData} opts.mediaStartMonitoringData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.mediaStartMonitoring = function(mediatype, opts) { return this.mediaStartMonitoringWithHttpInfo(mediatype, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Stop monitoring an agent * Stop supervisor monitoring of an agent on the specified media channel. * @param {String} mediatype The media channel. * @param {Object} opts Optional parameters * @param {module:model/MediaStopMonitoringData} opts.mediaStopMonitoringData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.mediaStopMonitoringWithHttpInfo = function(mediatype, opts) { opts = opts || {}; var postBody = opts['mediaStopMonitoringData']; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling mediaStopMonitoring"); } var pathParams = { 'mediatype': mediatype }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/stop-monitoring', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Stop monitoring an agent * Stop supervisor monitoring of an agent on the specified media channel. * @param {String} mediatype The media channel. * @param {Object} opts Optional parameters * @param {module:model/MediaStopMonitoringData} opts.mediaStopMonitoringData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.mediaStopMonitoring = function(mediatype, opts) { return this.mediaStopMonitoringWithHttpInfo(mediatype, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Switch to barge-in * Switch to the barge-in monitoring mode for the specified chat. Both the agent and the customer can see the supervisor's messages. * @param {String} mediatype The media channel. * @param {String} id The ID of the chat interaction. * @param {Object} opts Optional parameters * @param {module:model/MediaSwicthToCoachData} opts.mediaSwicthToCoachData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.mediaSwicthToBargeInWithHttpInfo = function(mediatype, id, opts) { opts = opts || {}; var postBody = opts['mediaSwicthToCoachData']; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling mediaSwicthToBargeIn"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling mediaSwicthToBargeIn"); } var pathParams = { 'mediatype': mediatype, 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/interactions/{id}/switch-to-barge-in', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Switch to barge-in * Switch to the barge-in monitoring mode for the specified chat. Both the agent and the customer can see the supervisor's messages. * @param {String} mediatype The media channel. * @param {String} id The ID of the chat interaction. * @param {Object} opts Optional parameters * @param {module:model/MediaSwicthToCoachData} opts.mediaSwicthToCoachData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.mediaSwicthToBargeIn = function(mediatype, id, opts) { return this.mediaSwicthToBargeInWithHttpInfo(mediatype, id, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Switch to coach * Switch to the coach monitoring mode for the specified chat. Only the agent can see the supervisor's messages. * @param {String} mediatype The media channel. * @param {String} id The ID of the chat interaction. * @param {Object} opts Optional parameters * @param {module:model/MediaSwicthToCoachData1} opts.mediaSwicthToCoachData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.mediaSwicthToCoachWithHttpInfo = function(mediatype, id, opts) { opts = opts || {}; var postBody = opts['mediaSwicthToCoachData']; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling mediaSwicthToCoach"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling mediaSwicthToCoach"); } var pathParams = { 'mediatype': mediatype, 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/interactions/{id}/switch-to-coach', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Switch to coach * Switch to the coach monitoring mode for the specified chat. Only the agent can see the supervisor's messages. * @param {String} mediatype The media channel. * @param {String} id The ID of the chat interaction. * @param {Object} opts Optional parameters * @param {module:model/MediaSwicthToCoachData1} opts.mediaSwicthToCoachData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.mediaSwicthToCoach = function(mediatype, id, opts) { return this.mediaSwicthToCoachWithHttpInfo(mediatype, id, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Switch to monitor * Switch to the monitor mode for the specified chat. The supervisor can't send messages in this mode and only another supervisor can see that the monitoring supervisor joined the chat. * @param {String} mediatype The media channel. * @param {String} id The ID of the chat interaction. * @param {Object} opts Optional parameters * @param {module:model/MediaSwicthToCoachData2} opts.mediaSwicthToCoachData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.mediaSwicthToMonitorWithHttpInfo = function(mediatype, id, opts) { opts = opts || {}; var postBody = opts['mediaSwicthToCoachData']; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling mediaSwicthToMonitor"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling mediaSwicthToMonitor"); } var pathParams = { 'mediatype': mediatype, 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/interactions/{id}/switch-to-monitor', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Switch to monitor * Switch to the monitor mode for the specified chat. The supervisor can't send messages in this mode and only another supervisor can see that the monitoring supervisor joined the chat. * @param {String} mediatype The media channel. * @param {String} id The ID of the chat interaction. * @param {Object} opts Optional parameters * @param {module:model/MediaSwicthToCoachData2} opts.mediaSwicthToCoachData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.mediaSwicthToMonitor = function(mediatype, id, opts) { return this.mediaSwicthToMonitorWithHttpInfo(mediatype, id, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Set the agent state to Not Ready * Set the current agent's state to Not Ready on the specified media channel. * @param {String} mediatype The media channel. * @param {module:model/NotReadyForMediaData} notReadyForMediaData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.notReadyForMediaWithHttpInfo = function(mediatype, notReadyForMediaData) { var postBody = notReadyForMediaData; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling notReadyForMedia"); } // verify the required parameter 'notReadyForMediaData' is set if (notReadyForMediaData === undefined || notReadyForMediaData === null) { throw new Error("Missing the required parameter 'notReadyForMediaData' when calling notReadyForMedia"); } var pathParams = { 'mediatype': mediatype }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/not-ready', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Set the agent state to Not Ready * Set the current agent's state to Not Ready on the specified media channel. * @param {String} mediatype The media channel. * @param {module:model/NotReadyForMediaData} notReadyForMediaData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.notReadyForMedia = function(mediatype, notReadyForMediaData) { return this.notReadyForMediaWithHttpInfo(mediatype, notReadyForMediaData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Place an interaction in a queue * Place the interaction in the specified queue. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction. * @param {module:model/PlaceInQueueData} placeInQueueData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.placeInQueueWithHttpInfo = function(mediatype, id, placeInQueueData) { var postBody = placeInQueueData; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling placeInQueue"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling placeInQueue"); } // verify the required parameter 'placeInQueueData' is set if (placeInQueueData === undefined || placeInQueueData === null) { throw new Error("Missing the required parameter 'placeInQueueData' when calling placeInQueue"); } var pathParams = { 'mediatype': mediatype, 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/interactions/{id}/place-in-queue', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Place an interaction in a queue * Place the interaction in the specified queue. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction. * @param {module:model/PlaceInQueueData} placeInQueueData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.placeInQueue = function(mediatype, id, placeInQueueData) { return this.placeInQueueWithHttpInfo(mediatype, id, placeInQueueData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Pull an interaction from a workbin * Pull the specified interaction from a workbin. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction. * @param {Object} opts Optional parameters * @param {module:model/PullInteractionFromWorkbinData} opts.pullInteractionFromWorkbinData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.pullInteractionFromWorkbinWithHttpInfo = function(mediatype, id, opts) { opts = opts || {}; var postBody = opts['pullInteractionFromWorkbinData']; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling pullInteractionFromWorkbin"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling pullInteractionFromWorkbin"); } var pathParams = { 'mediatype': mediatype, 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/interactions/{id}/pull', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Pull an interaction from a workbin * Pull the specified interaction from a workbin. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction. * @param {Object} opts Optional parameters * @param {module:model/PullInteractionFromWorkbinData} opts.pullInteractionFromWorkbinData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.pullInteractionFromWorkbin = function(mediatype, id, opts) { return this.pullInteractionFromWorkbinWithHttpInfo(mediatype, id, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Set the agent state to Ready * Set the current agent's state to Ready on the specified media channel. * @param {String} mediatype The media channel. * @param {Object} opts Optional parameters * @param {module:model/ReadyForMediaData} opts.readyForMediaData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.readyForMediaWithHttpInfo = function(mediatype, opts) { opts = opts || {}; var postBody = opts['readyForMediaData']; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling readyForMedia"); } var pathParams = { 'mediatype': mediatype }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/ready', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Set the agent state to Ready * Set the current agent's state to Ready on the specified media channel. * @param {String} mediatype The media channel. * @param {Object} opts Optional parameters * @param {module:model/ReadyForMediaData} opts.readyForMediaData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.readyForMedia = function(mediatype, opts) { return this.readyForMediaWithHttpInfo(mediatype, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Reject an interaction * Reject the specified interaction. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction to reject. * @param {Object} opts Optional parameters * @param {module:model/RejectData} opts.rejectData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.rejectWithHttpInfo = function(mediatype, id, opts) { opts = opts || {}; var postBody = opts['rejectData']; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling reject"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling reject"); } var pathParams = { 'mediatype': mediatype, 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/interactions/{id}/reject', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Reject an interaction * Reject the specified interaction. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction to reject. * @param {Object} opts Optional parameters * @param {module:model/RejectData} opts.rejectData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.reject = function(mediatype, id, opts) { return this.rejectWithHttpInfo(mediatype, id, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Remove an attachment * Remove the specified attachment from the interaction. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction. * @param {String} documentId The ID of the document to remove. * @param {Object} opts Optional parameters * @param {module:model/RemoveAttachmentData} opts.removeAttachmentData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.removeAttachmentWithHttpInfo = function(mediatype, id, documentId, opts) { opts = opts || {}; var postBody = opts['removeAttachmentData']; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling removeAttachment"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling removeAttachment"); } // verify the required parameter 'documentId' is set if (documentId === undefined || documentId === null) { throw new Error("Missing the required parameter 'documentId' when calling removeAttachment"); } var pathParams = { 'mediatype': mediatype, 'id': id, 'documentId': documentId }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/interactions/{id}/remove-attachment/{documentId}', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Remove an attachment * Remove the specified attachment from the interaction. * @param {String} mediatype The media channel. * @param {String} id The ID of the interaction. * @param {String} documentId The ID of the document to remove. * @param {Object} opts Optional parameters * @param {module:model/RemoveAttachmentData} opts.removeAttachmentData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.removeAttachment = function(mediatype, id, documentId, opts) { return this.removeAttachmentWithHttpInfo(mediatype, id, documentId, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Log out of a media channel * Log out the current agent on the specified media channels. You can make a [/media/{mediatype}/ready](/reference/workspace/Media/index.html#readyAgentState) or [/media/{mediatype}/not-ready](/reference/workspace/Media/index.html#notReadyAgentState) request to log in to the media channel again. * @param {String} mediatype The media channel. * @param {module:model/LogoutMediaData} logoutMediaData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.removeMediaWithHttpInfo = function(mediatype, logoutMediaData) { var postBody = logoutMediaData; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling removeMedia"); } // verify the required parameter 'logoutMediaData' is set if (logoutMediaData === undefined || logoutMediaData === null) { throw new Error("Missing the required parameter 'logoutMediaData' when calling removeMedia"); } var pathParams = { 'mediatype': mediatype }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = ApiSuccessResponse; return this.apiClient.callApi( '/media/{mediatype}/logout', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Log out of a