UNPKG

genesys-workspace-client-js

Version:
1,176 lines (1,005 loc) 95.7 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/AlternateData', 'model/AnswerData', 'model/ApiErrorResponse', 'model/ApiSuccessResponse', 'model/CancelForwardBody', 'model/ClearData', 'model/CompleteConferenceData', 'model/CompleteTransferData', 'model/DeleteFromConferenceData', 'model/DndOffBody', 'model/DndOnBody', 'model/DndOnBody1', 'model/ForwardData', 'model/HoldData', 'model/InitiateConferenceData', 'model/InitiateTransferData', 'model/KeyData', 'model/LoginData', 'model/MakeCallData', 'model/MergeData', 'model/MonitoringScopeData', 'model/NotReadyData', 'model/PauseRecordingBody', 'model/ReadyData', 'model/ReconnectData', 'model/RedirectData', 'model/ReleaseData', 'model/ResumeRecordingBody', 'model/RetrieveData', 'model/SendDTMFData', 'model/SendUserEventData', 'model/SingleStepConferenceData', 'model/SingleStepTransferData', 'model/StartMonitoringData', 'model/StartRecordingBody', 'model/StopMonitoringData', 'model/StopRecordingBody', 'model/UserData', '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/AlternateData'), require('../model/AnswerData'), require('../model/ApiErrorResponse'), require('../model/ApiSuccessResponse'), require('../model/CancelForwardBody'), require('../model/ClearData'), require('../model/CompleteConferenceData'), require('../model/CompleteTransferData'), require('../model/DeleteFromConferenceData'), require('../model/DndOffBody'), require('../model/DndOnBody'), require('../model/DndOnBody1'), require('../model/ForwardData'), require('../model/HoldData'), require('../model/InitiateConferenceData'), require('../model/InitiateTransferData'), require('../model/KeyData'), require('../model/LoginData'), require('../model/MakeCallData'), require('../model/MergeData'), require('../model/MonitoringScopeData'), require('../model/NotReadyData'), require('../model/PauseRecordingBody'), require('../model/ReadyData'), require('../model/ReconnectData'), require('../model/RedirectData'), require('../model/ReleaseData'), require('../model/ResumeRecordingBody'), require('../model/RetrieveData'), require('../model/SendDTMFData'), require('../model/SendUserEventData'), require('../model/SingleStepConferenceData'), require('../model/SingleStepTransferData'), require('../model/StartMonitoringData'), require('../model/StartRecordingBody'), require('../model/StopMonitoringData'), require('../model/StopRecordingBody'), require('../model/UserData'), require('../model/UserDataOperationId')); } else { // Browser globals (root is window) if (!root.WorkspaceApi) { root.WorkspaceApi = {}; } root.WorkspaceApi.VoiceApi = factory(root.WorkspaceApi.ApiClient, root.WorkspaceApi.AlternateData, root.WorkspaceApi.AnswerData, root.WorkspaceApi.ApiErrorResponse, root.WorkspaceApi.ApiSuccessResponse, root.WorkspaceApi.CancelForwardBody, root.WorkspaceApi.ClearData, root.WorkspaceApi.CompleteConferenceData, root.WorkspaceApi.CompleteTransferData, root.WorkspaceApi.DeleteFromConferenceData, root.WorkspaceApi.DndOffBody, root.WorkspaceApi.DndOnBody, root.WorkspaceApi.DndOnBody1, root.WorkspaceApi.ForwardData, root.WorkspaceApi.HoldData, root.WorkspaceApi.InitiateConferenceData, root.WorkspaceApi.InitiateTransferData, root.WorkspaceApi.KeyData, root.WorkspaceApi.LoginData, root.WorkspaceApi.MakeCallData, root.WorkspaceApi.MergeData, root.WorkspaceApi.MonitoringScopeData, root.WorkspaceApi.NotReadyData, root.WorkspaceApi.PauseRecordingBody, root.WorkspaceApi.ReadyData, root.WorkspaceApi.ReconnectData, root.WorkspaceApi.RedirectData, root.WorkspaceApi.ReleaseData, root.WorkspaceApi.ResumeRecordingBody, root.WorkspaceApi.RetrieveData, root.WorkspaceApi.SendDTMFData, root.WorkspaceApi.SendUserEventData, root.WorkspaceApi.SingleStepConferenceData, root.WorkspaceApi.SingleStepTransferData, root.WorkspaceApi.StartMonitoringData, root.WorkspaceApi.StartRecordingBody, root.WorkspaceApi.StopMonitoringData, root.WorkspaceApi.StopRecordingBody, root.WorkspaceApi.UserData, root.WorkspaceApi.UserDataOperationId); } }(this, function(ApiClient, AlternateData, AnswerData, ApiErrorResponse, ApiSuccessResponse, CancelForwardBody, ClearData, CompleteConferenceData, CompleteTransferData, DeleteFromConferenceData, DndOffBody, DndOnBody, DndOnBody1, ForwardData, HoldData, InitiateConferenceData, InitiateTransferData, KeyData, LoginData, MakeCallData, MergeData, MonitoringScopeData, NotReadyData, PauseRecordingBody, ReadyData, ReconnectData, RedirectData, ReleaseData, ResumeRecordingBody, RetrieveData, SendDTMFData, SendUserEventData, SingleStepConferenceData, SingleStepTransferData, StartMonitoringData, StartRecordingBody, StopMonitoringData, StopRecordingBody, UserData, UserDataOperationId) { 'use strict'; /** * Voice service. * @module api/VoiceApi * @version 9.0.000.97.4639 */ /** * Constructs a new VoiceApi. * @alias module:api/VoiceApi * @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; /** * Alternate between calls * Alternate two calls so that you retrieve a call on hold and place the established call on hold instead. This is a shortcut for doing [/voice/calls/{id}/hold](/reference/workspace/Voice/index.html#hold) and [/voice/calls/{id}/retrieve](/reference/workspace/Voice/index.html#retrieve) separately. * @param {String} id The connection ID of the established call that should be placed on hold. * @param {module:model/AlternateData} alternateData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.alternateWithHttpInfo = function(id, alternateData) { var postBody = alternateData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling alternate"); } // verify the required parameter 'alternateData' is set if (alternateData === undefined || alternateData === null) { throw new Error("Missing the required parameter 'alternateData' when calling alternate"); } var pathParams = { '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( '/voice/calls/{id}/alternate', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Alternate between calls * Alternate two calls so that you retrieve a call on hold and place the established call on hold instead. This is a shortcut for doing [/voice/calls/{id}/hold](/reference/workspace/Voice/index.html#hold) and [/voice/calls/{id}/retrieve](/reference/workspace/Voice/index.html#retrieve) separately. * @param {String} id The connection ID of the established call that should be placed on hold. * @param {module:model/AlternateData} alternateData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.alternate = function(id, alternateData) { return this.alternateWithHttpInfo(id, alternateData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Answer a call * Answer the specified call. * @param {String} id The connection ID of the call. * @param {Object} opts Optional parameters * @param {module:model/AnswerData} opts.answerData 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.answerWithHttpInfo = function(id, opts) { opts = opts || {}; var postBody = opts['answerData']; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling answer"); } var pathParams = { '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( '/voice/calls/{id}/answer', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Answer a call * Answer the specified call. * @param {String} id The connection ID of the call. * @param {Object} opts Optional parameters * @param {module:model/AnswerData} opts.answerData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.answer = function(id, opts) { return this.answerWithHttpInfo(id, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Attach user data to a call * Attach the provided data to the specified call. This adds the data to the call even if data already exists with the provided keys. * @param {String} id The connection ID of the call. * @param {module:model/UserDataOperationId} userData The data to attach to the call. 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.attachUserDataWithHttpInfo = function(id, userData) { var postBody = userData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling attachUserData"); } // verify the required parameter 'userData' is set if (userData === undefined || userData === null) { throw new Error("Missing the required parameter 'userData' when calling attachUserData"); } var pathParams = { '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( '/voice/calls/{id}/attach-user-data', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Attach user data to a call * Attach the provided data to the specified call. This adds the data to the call even if data already exists with the provided keys. * @param {String} id The connection ID of the call. * @param {module:model/UserDataOperationId} userData The data to attach to the call. 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.attachUserData = function(id, userData) { return this.attachUserDataWithHttpInfo(id, userData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Cancel call forwarding * Cancel call forwarding for the current agent. * @param {Object} opts Optional parameters * @param {module:model/CancelForwardBody} opts.cancelForwardBody 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.cancelForwardWithHttpInfo = function(opts) { opts = opts || {}; var postBody = opts['cancelForwardBody']; var pathParams = { }; 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( '/voice/cancel-forward', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Cancel call forwarding * Cancel call forwarding for the current agent. * @param {Object} opts Optional parameters * @param {module:model/CancelForwardBody} opts.cancelForwardBody Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.cancelForward = function(opts) { return this.cancelForwardWithHttpInfo(opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Clear all the parties in the call * End the conference call for all parties. This can be performed by any agent participating in the conference. * @param {String} id The connection ID of the call to clear. * @param {module:model/ClearData} clearData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.clearWithHttpInfo = function(id, clearData) { var postBody = clearData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling clear"); } // verify the required parameter 'clearData' is set if (clearData === undefined || clearData === null) { throw new Error("Missing the required parameter 'clearData' when calling clear"); } var pathParams = { '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( '/voice/calls/{id}/clear', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Clear all the parties in the call * End the conference call for all parties. This can be performed by any agent participating in the conference. * @param {String} id The connection ID of the call to clear. * @param {module:model/ClearData} clearData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.clear = function(id, clearData) { return this.clearWithHttpInfo(id, clearData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Complete a call * Complete the specified call by adding information to its user data after it has been released. You should make this request on released calls if you set automatic complete to false in [/activate-channels](/reference/workspace/Session/index.html#activateChannels). * @param {String} id The connection ID of the call. * @param {module:model/UserData} userData Key/value data to include with the call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.completeCallWithHttpInfo = function(id, userData) { var postBody = userData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling completeCall"); } // verify the required parameter 'userData' is set if (userData === undefined || userData === null) { throw new Error("Missing the required parameter 'userData' when calling completeCall"); } var pathParams = { '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( '/voice/calls/{id}/complete', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Complete a call * Complete the specified call by adding information to its user data after it has been released. You should make this request on released calls if you set automatic complete to false in [/activate-channels](/reference/workspace/Session/index.html#activateChannels). * @param {String} id The connection ID of the call. * @param {module:model/UserData} userData Key/value data to include with the call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.completeCall = function(id, userData) { return this.completeCallWithHttpInfo(id, userData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Complete a conference * Complete a previously initiated two-step conference identified by the provided IDs. Once completed, the two separate calls are brought together so that all three parties are participating in the same call. * @param {String} id The connection ID of the consult call (established). * @param {module:model/CompleteConferenceData} completeConferenceData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.completeConferenceWithHttpInfo = function(id, completeConferenceData) { var postBody = completeConferenceData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling completeConference"); } // verify the required parameter 'completeConferenceData' is set if (completeConferenceData === undefined || completeConferenceData === null) { throw new Error("Missing the required parameter 'completeConferenceData' when calling completeConference"); } var pathParams = { '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( '/voice/calls/{id}/complete-conference', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Complete a conference * Complete a previously initiated two-step conference identified by the provided IDs. Once completed, the two separate calls are brought together so that all three parties are participating in the same call. * @param {String} id The connection ID of the consult call (established). * @param {module:model/CompleteConferenceData} completeConferenceData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.completeConference = function(id, completeConferenceData) { return this.completeConferenceWithHttpInfo(id, completeConferenceData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Complete a transfer * Complete a previously initiated two-step transfer using the provided IDs. * @param {String} id The connection ID of the consult call (established). * @param {module:model/CompleteTransferData} completeTransferData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.completeTransferWithHttpInfo = function(id, completeTransferData) { var postBody = completeTransferData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling completeTransfer"); } // verify the required parameter 'completeTransferData' is set if (completeTransferData === undefined || completeTransferData === null) { throw new Error("Missing the required parameter 'completeTransferData' when calling completeTransfer"); } var pathParams = { '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( '/voice/calls/{id}/complete-transfer', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Complete a transfer * Complete a previously initiated two-step transfer using the provided IDs. * @param {String} id The connection ID of the consult call (established). * @param {module:model/CompleteTransferData} completeTransferData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.completeTransfer = function(id, completeTransferData) { return this.completeTransferWithHttpInfo(id, completeTransferData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Delete a party from a conference call * Delete the specified DN from the conference call. This operation can only be performed by the owner of the conference call. * @param {String} id The connection ID of the conference call. * @param {module:model/DeleteFromConferenceData} deleteFromConferenceData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.deleteFromConferenceWithHttpInfo = function(id, deleteFromConferenceData) { var postBody = deleteFromConferenceData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling deleteFromConference"); } // verify the required parameter 'deleteFromConferenceData' is set if (deleteFromConferenceData === undefined || deleteFromConferenceData === null) { throw new Error("Missing the required parameter 'deleteFromConferenceData' when calling deleteFromConference"); } var pathParams = { '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( '/voice/calls/{id}/delete-from-conference', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Delete a party from a conference call * Delete the specified DN from the conference call. This operation can only be performed by the owner of the conference call. * @param {String} id The connection ID of the conference call. * @param {module:model/DeleteFromConferenceData} deleteFromConferenceData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.deleteFromConference = function(id, deleteFromConferenceData) { return this.deleteFromConferenceWithHttpInfo(id, deleteFromConferenceData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Remove a key/value pair from user data * Delete data with the specified key from the call's user data. * @param {String} id The connection ID of the call. * @param {module:model/KeyData} keyData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.deleteUserDataPairWithHttpInfo = function(id, keyData) { var postBody = keyData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling deleteUserDataPair"); } // verify the required parameter 'keyData' is set if (keyData === undefined || keyData === null) { throw new Error("Missing the required parameter 'keyData' when calling deleteUserDataPair"); } var pathParams = { '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( '/voice/calls/{id}/delete-user-data-pair', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Remove a key/value pair from user data * Delete data with the specified key from the call's user data. * @param {String} id The connection ID of the call. * @param {module:model/KeyData} keyData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.deleteUserDataPair = function(id, keyData) { return this.deleteUserDataPairWithHttpInfo(id, keyData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Forward calls * Set call forwarding on the current agent's DN to the specified destination. * @param {module:model/ForwardData} forwardData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.forwardWithHttpInfo = function(forwardData) { var postBody = forwardData; // verify the required parameter 'forwardData' is set if (forwardData === undefined || forwardData === null) { throw new Error("Missing the required parameter 'forwardData' when calling forward"); } var pathParams = { }; 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( '/voice/set-forward', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Forward calls * Set call forwarding on the current agent's DN to the specified destination. * @param {module:model/ForwardData} forwardData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.forward = function(forwardData) { return this.forwardWithHttpInfo(forwardData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Get all calls * Get all active calls for the current agent. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Object} and HTTP response */ this.getCallsWithHttpInfo = function() { var postBody = null; var pathParams = { }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = Object; return this.apiClient.callApi( '/voice/calls', 'GET', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Get all calls * Get all active calls for the current agent. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Object} */ this.getCalls = function() { return this.getCallsWithHttpInfo() .then(function(response_and_data) { return response_and_data.data; }); } /** * Place a call on hold * Place the specified call on hold. * @param {String} id The connection ID of the call. * @param {Object} opts Optional parameters * @param {module:model/HoldData} opts.holdData 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.holdWithHttpInfo = function(id, opts) { opts = opts || {}; var postBody = opts['holdData']; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling hold"); } var pathParams = { '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( '/voice/calls/{id}/hold', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Place a call on hold * Place the specified call on hold. * @param {String} id The connection ID of the call. * @param {Object} opts Optional parameters * @param {module:model/HoldData} opts.holdData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.hold = function(id, opts) { return this.holdWithHttpInfo(id, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Initiate a conference * Initiate a two-step conference to the specified destination. This places the existing call on hold and creates a new call in the dialing state (step 1). After initiating the conference you can use [/voice/calls/{id}/complete-conference](/reference/workspace/Voice/index.html#completeConference) to complete the conference and bring all parties into the same call (step 2). * @param {String} id The connection ID of the call to start the conference from. This call will be placed on hold. * @param {module:model/InitiateConferenceData} initiateConferenceData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.initiateConferenceWithHttpInfo = function(id, initiateConferenceData) { var postBody = initiateConferenceData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling initiateConference"); } // verify the required parameter 'initiateConferenceData' is set if (initiateConferenceData === undefined || initiateConferenceData === null) { throw new Error("Missing the required parameter 'initiateConferenceData' when calling initiateConference"); } var pathParams = { '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( '/voice/calls/{id}/initiate-conference', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Initiate a conference * Initiate a two-step conference to the specified destination. This places the existing call on hold and creates a new call in the dialing state (step 1). After initiating the conference you can use [/voice/calls/{id}/complete-conference](/reference/workspace/Voice/index.html#completeConference) to complete the conference and bring all parties into the same call (step 2). * @param {String} id The connection ID of the call to start the conference from. This call will be placed on hold. * @param {module:model/InitiateConferenceData} initiateConferenceData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.initiateConference = function(id, initiateConferenceData) { return this.initiateConferenceWithHttpInfo(id, initiateConferenceData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Initiate a transfer * Initiate a two-step transfer by placing the first call on hold and dialing the destination number (step 1). After initiating the transfer, you can use [/voice/calls/{id}/complete-transfer](/reference/workspace/Voice/index.html#completeTransfer) to complete the transfer (step 2). * @param {String} id The connection ID of the call to be transferred. This call will be placed on hold. * @param {module:model/InitiateTransferData} initiateTransferData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.initiateTransferWithHttpInfo = function(id, initiateTransferData) { var postBody = initiateTransferData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling initiateTransfer"); } // verify the required parameter 'initiateTransferData' is set if (initiateTransferData === undefined || initiateTransferData === null) { throw new Error("Missing the required parameter 'initiateTransferData' when calling initiateTransfer"); } var pathParams = { '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( '/voice/calls/{id}/initiate-transfer', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Initiate a transfer * Initiate a two-step transfer by placing the first call on hold and dialing the destination number (step 1). After initiating the transfer, you can use [/voice/calls/{id}/complete-transfer](/reference/workspace/Voice/index.html#completeTransfer) to complete the transfer (step 2). * @param {String} id The connection ID of the call to be transferred. This call will be placed on hold. * @param {module:model/InitiateTransferData} initiateTransferData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.initiateTransfer = function(id, initiateTransferData) { return this.initiateTransferWithHttpInfo(id, initiateTransferData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Log in on the voice channel * Log in the current agent on the voice channel. When you make this request, Workspace uses the parameters you provided in [/activate-channels](/reference/workspace/Session/index.html#activateChannels). For most applications, you don't need to worry about logging in the agent on the voice channel because it's handled by the Workspace API when you call [/activate-channels](/reference/workspace/Session/index.html#activateChannels). However, if you make a [/voice/logout](/reference/workspace/Voice/index.html#logoutVoice) request, you can then use [/voice/login](/reference/workspace/Voice/index.html#loginVoice) to log in the agent on the voice channel. **Note:** This login /logout flow only applies to the voice channel, not to the agent's session. * @param {Object} opts Optional parameters * @param {module:model/LoginData} opts.loginData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.loginVoiceWithHttpInfo = function(opts) { opts = opts || {}; var postBody = opts['loginData']; var pathParams = { }; 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( '/voice/login', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Log in on the voice channel * Log in the current agent on the voice channel. When you make this request, Workspace uses the parameters you provided in [/activate-channels](/reference/workspace/Session/index.html#activateChannels). For most applications, you don't need to worry about logging in the agent on the voice channel because it's handled by the Workspace API when you call [/activate-channels](/reference/workspace/Session/index.html#activateChannels). However, if you make a [/voice/logout](/reference/workspace/Voice/index.html#logoutVoice) request, you can then use [/voice/login](/reference/workspace/Voice/index.html#loginVoice) to log in the agent on the voice channel. **Note:** This login /logout flow only applies to the voice channel, not to the agent's session. * @param {Object} opts Optional parameters * @param {module:model/LoginData} opts.loginData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.loginVoice = function(opts) { return this.loginVoiceWithHttpInfo(opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Log out of the voice channel * Log out the current agent on the voice channel. This request is typically paired with [/voice/login](/reference/workspace/Voice/index.html#loginVoice)—together they let you login/logout an agent on the voice channel without logging out of the entire session. * @param {Object} opts Optional parameters * @param {module:model/DndOnBody} opts.dndOnBody 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.logoutVoiceWithHttpInfo = function(opts) { opts = opts || {}; var postBody = opts['dndOnBody']; var pathParams = { }; 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( '/voice/logout', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Log out of the voice channel * Log out the current agent on the voice channel. This request is typically paired with [/voice/login](/reference/workspace/Voice/index.html#loginVoice)—together they let you login/logout an agent on the voice channel without logging out of the entire session. * @param {Object} opts Optional parameters * @param {module:model/DndOnBody} opts.dndOnBody Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.logoutVoice = function(opts) { return this.logoutVoiceWithHttpInfo(opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Make a new call * Make a new call to the specified destination. * @param {module:model/MakeCallData} makeCallData 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.makeCallWithHttpInfo = function(makeCallData) { var postBody = makeCallData; // verify the required parameter 'makeCallData' is set if (makeCallData === undefined || makeCallData === null) { throw new Error("Missing the required parameter 'makeCallData' when calling makeCall"); } var pathParams = { }; 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( '/voice/make-call', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Make a new call * Make a new call to the specified destination. * @param {module:model/MakeCallData} makeCallData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.makeCall = function(makeCallData) { return this.makeCallWithHttpInfo(makeCallData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Merge two calls * Merge the two specified calls. * @param {String} id The connection ID of the first call to be merged. * @param {module:model/MergeData} mergeData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.mergeWithHttpInfo = function(id, mergeData) { var postBody = mergeData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling merge"); } // verify the required parameter 'mergeData' is set if (mergeData === undefined || mergeData === null) { throw new Error("Missing the required parameter 'mergeData' when calling merge"); } var pathParams = { '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( '/voice/calls/{id}/merge', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Merge two calls * Merge the two specified calls. * @param {String} id The connection ID of the first call to be merged. * @param {module:model/MergeData} mergeData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.merge = function(id, mergeData) { return this.mergeWithHttpInfo(id, mergeData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Pause recording on a call * Pause recording on the specified call. * @param {String} id The connection ID of the call. * @param {Object} opts Optional parameters * @param {module:model/PauseRecordingBody} opts.pauseRecordingBody 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.pauseRecordingWithHttpInfo = function(id, opts) { opts = opts || {}; var postBody = opts['pauseRecordingBody']; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling pauseRecording"); } var pathParams = { '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( '/voice/calls/{id}/pause-recording', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Pause recording on a call * Pause recording on the specified call. * @param {String} id The connection ID of the call. * @param {Object} opts Optional parameters * @param {module:model/PauseRecordingBody} opts.pauseRecordingBody Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.