UNPKG

genesys-workspace-client-js

Version:
1,042 lines (896 loc) 45.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/AcceptData', 'model/AcceptData1', 'model/AcceptData2', 'model/ApiErrorResponse', 'model/ApiSuccessResponse', 'model/CancelConsultData', 'model/ConsultData', 'model/ConsultData1', 'model/CustomNotificationData', 'model/InviteData', 'model/InviteData1', 'model/LeaveData', 'model/RemoveFromConferenceData', 'model/TypingStartedData', 'model/TypingStoppedData', 'model/UpdateNicknameData'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('../model/AcceptData'), require('../model/AcceptData1'), require('../model/AcceptData2'), require('../model/ApiErrorResponse'), require('../model/ApiSuccessResponse'), require('../model/CancelConsultData'), require('../model/ConsultData'), require('../model/ConsultData1'), require('../model/CustomNotificationData'), require('../model/InviteData'), require('../model/InviteData1'), require('../model/LeaveData'), require('../model/RemoveFromConferenceData'), require('../model/TypingStartedData'), require('../model/TypingStoppedData'), require('../model/UpdateNicknameData')); } else { // Browser globals (root is window) if (!root.WorkspaceApi) { root.WorkspaceApi = {}; } root.WorkspaceApi.ChatApi = factory(root.WorkspaceApi.ApiClient, root.WorkspaceApi.AcceptData, root.WorkspaceApi.AcceptData1, root.WorkspaceApi.AcceptData2, root.WorkspaceApi.ApiErrorResponse, root.WorkspaceApi.ApiSuccessResponse, root.WorkspaceApi.CancelConsultData, root.WorkspaceApi.ConsultData, root.WorkspaceApi.ConsultData1, root.WorkspaceApi.CustomNotificationData, root.WorkspaceApi.InviteData, root.WorkspaceApi.InviteData1, root.WorkspaceApi.LeaveData, root.WorkspaceApi.RemoveFromConferenceData, root.WorkspaceApi.TypingStartedData, root.WorkspaceApi.TypingStoppedData, root.WorkspaceApi.UpdateNicknameData); } }(this, function(ApiClient, AcceptData, AcceptData1, AcceptData2, ApiErrorResponse, ApiSuccessResponse, CancelConsultData, ConsultData, ConsultData1, CustomNotificationData, InviteData, InviteData1, LeaveData, RemoveFromConferenceData, TypingStartedData, TypingStoppedData, UpdateNicknameData) { 'use strict'; /** * Chat service. * @module api/ChatApi * @version 9.0.000.97.4639 */ /** * Constructs a new ChatApi. * @alias module:api/ChatApi * @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 a chat * Accept the specified chat interaction. * @param {String} id The ID of the chat interaction. * @param {Object} opts Optional parameters * @param {module:model/AcceptData} 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.acceptChatWithHttpInfo = function(id, opts) { opts = opts || {}; var postBody = opts['acceptData']; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling acceptChat"); } 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( '/media/chat/interactions/{id}/accept', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Accept a chat * Accept the specified chat interaction. * @param {String} id The ID of the chat interaction. * @param {Object} opts Optional parameters * @param {module:model/AcceptData} opts.acceptData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.acceptChat = function(id, opts) { return this.acceptChatWithHttpInfo(id, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Cancel a chat consultation request * Cancel a chat consultation request that was initialized by calling [/media/chat/interactions/{id}/consult-by-queue](/reference/workspace/Media/index.html#consultByQueue). If the agent has already accepted the invitation, the Workspace API can't cancel the consultation. * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {Object} opts Optional parameters * @param {module:model/CancelConsultData} opts.cancelConsultData 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.cancelConsultationChatWithHttpInfo = function(id, mediatype, opts) { opts = opts || {}; var postBody = opts['cancelConsultData']; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling cancelConsultationChat"); } // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling cancelConsultationChat"); } var pathParams = { 'id': id, '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}/interactions/{id}/cancel-consult', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Cancel a chat consultation request * Cancel a chat consultation request that was initialized by calling [/media/chat/interactions/{id}/consult-by-queue](/reference/workspace/Media/index.html#consultByQueue). If the agent has already accepted the invitation, the Workspace API can't cancel the consultation. * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {Object} opts Optional parameters * @param {module:model/CancelConsultData} opts.cancelConsultData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.cancelConsultationChat = function(id, mediatype, opts) { return this.cancelConsultationChatWithHttpInfo(id, mediatype, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Get chat transcript * Get a transcript for the specified chat interaction. * @param {String} mediatype The chat media channel. * @param {String} id The ID of the chat interaction. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Object} and HTTP response */ this.chatMessagesWithHttpInfo = function(mediatype, id) { 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 chatMessages"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling chatMessages"); } 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 = Object; return this.apiClient.callApi( '/media/{mediatype}/interactions/{id}/messages', 'GET', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Get chat transcript * Get a transcript for the specified chat interaction. * @param {String} mediatype The chat media channel. * @param {String} id The ID of the chat interaction. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Object} */ this.chatMessages = function(mediatype, id) { return this.chatMessagesWithHttpInfo(mediatype, id) .then(function(response_and_data) { return response_and_data.data; }); } /** * Consult with another agent * A consult occurs in the context of the specified chat, but the customer is not aware of the consulting agent. Messages and notifications from the consulting agent are only visible to other agents in the chat, not to the customer. After the consulting agent accepts the consultation, the originating agent can either transfer the chat to the consulting agent ([/media/{mediatype}/interactions/{id}/transfer-agent](/reference/workspace/Media/index.html#transferAgent)), add them in a conference ([/media/chat/interactions/{id}/invite](/reference/workspace/Media/index.html#invite)) or the consulting agent can leave the chat ([/media/chat/interactions/{id}/leave](/reference/workspace/Media/index.html#leaveChat)). * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {module:model/ConsultData} consultData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.consultWithHttpInfo = function(id, mediatype, consultData) { var postBody = consultData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling consult"); } // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling consult"); } // verify the required parameter 'consultData' is set if (consultData === undefined || consultData === null) { throw new Error("Missing the required parameter 'consultData' when calling consult"); } var pathParams = { 'id': id, '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}/interactions/{id}/consult', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Consult with another agent * A consult occurs in the context of the specified chat, but the customer is not aware of the consulting agent. Messages and notifications from the consulting agent are only visible to other agents in the chat, not to the customer. After the consulting agent accepts the consultation, the originating agent can either transfer the chat to the consulting agent ([/media/{mediatype}/interactions/{id}/transfer-agent](/reference/workspace/Media/index.html#transferAgent)), add them in a conference ([/media/chat/interactions/{id}/invite](/reference/workspace/Media/index.html#invite)) or the consulting agent can leave the chat ([/media/chat/interactions/{id}/leave](/reference/workspace/Media/index.html#leaveChat)). * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {module:model/ConsultData} consultData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.consult = function(id, mediatype, consultData) { return this.consultWithHttpInfo(id, mediatype, consultData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Consult with another agent via a queue * Consult with another agent during a chat by sending an consult invitation to the specified queue. A consult occurs in the context of the specified chat, but the customer is not aware of the consulting agent. Messages and notifications from the consulting agent are only visible to other agents in the cat, not to the customer. After the consulting agent accepts the consultation, the originating agent can either transfer the chat to the consulting agent ([/media/{mediatype}/interactions/{id}/transfer-agent](/reference/workspace/Media/index.html#transferAgent)), add them in a conference ([/media/chat/interactions/{id}/invite](/reference/workspace/Media/index.html#invite)) or the consulting agent can leave the chat ([/media/chat/interactions/{id}/leave](/reference/workspace/Media/index.html#leaveChat)). * @param {String} mediatype The chat media channel. * @param {String} id The ID of the chat interaction. * @param {module:model/ConsultData1} consultData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.consultByQueueWithHttpInfo = function(mediatype, id, consultData) { var postBody = consultData; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling consultByQueue"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling consultByQueue"); } // verify the required parameter 'consultData' is set if (consultData === undefined || consultData === null) { throw new Error("Missing the required parameter 'consultData' when calling consultByQueue"); } 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}/consult-by-queue', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Consult with another agent via a queue * Consult with another agent during a chat by sending an consult invitation to the specified queue. A consult occurs in the context of the specified chat, but the customer is not aware of the consulting agent. Messages and notifications from the consulting agent are only visible to other agents in the cat, not to the customer. After the consulting agent accepts the consultation, the originating agent can either transfer the chat to the consulting agent ([/media/{mediatype}/interactions/{id}/transfer-agent](/reference/workspace/Media/index.html#transferAgent)), add them in a conference ([/media/chat/interactions/{id}/invite](/reference/workspace/Media/index.html#invite)) or the consulting agent can leave the chat ([/media/chat/interactions/{id}/leave](/reference/workspace/Media/index.html#leaveChat)). * @param {String} mediatype The chat media channel. * @param {String} id The ID of the chat interaction. * @param {module:model/ConsultData1} consultData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.consultByQueue = function(mediatype, id, consultData) { return this.consultByQueueWithHttpInfo(mediatype, id, consultData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Invite another agent to a chat * Invite another agent to join the specified chat conference. The customer is notified when the invited agent joins the chat. The agents can communicate with the customer or they can communicate with each other without the customer seeing their messages, depending on the value you set for the **visibility** parameter when you call [/media/chat/interactions/{id}/send-message](/reference/workspace/Media/index.html#sendMessage). * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {module:model/InviteData} inviteData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.inviteWithHttpInfo = function(id, mediatype, inviteData) { var postBody = inviteData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling invite"); } // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling invite"); } // verify the required parameter 'inviteData' is set if (inviteData === undefined || inviteData === null) { throw new Error("Missing the required parameter 'inviteData' when calling invite"); } var pathParams = { 'id': id, '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}/interactions/{id}/invite', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Invite another agent to a chat * Invite another agent to join the specified chat conference. The customer is notified when the invited agent joins the chat. The agents can communicate with the customer or they can communicate with each other without the customer seeing their messages, depending on the value you set for the **visibility** parameter when you call [/media/chat/interactions/{id}/send-message](/reference/workspace/Media/index.html#sendMessage). * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {module:model/InviteData} inviteData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.invite = function(id, mediatype, inviteData) { return this.inviteWithHttpInfo(id, mediatype, inviteData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Invite another agent to a chat via a queue * Invite another agent to the chat conference by sending an invitation to the specified queue. The next available agent in the queue is then sent an invite to join the chat. The customer is notified when the invited agent joins the chat. The agents can communicate with the customer or they can communicate with each other without the customer seeing their messages, depending on the value you set for the **visibility** parameter when you call [/media/chat/interactions/{id}/send-message](/reference/workspace/Media/index.html#sendMessage). * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {module:model/InviteData1} inviteData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.inviteByQueueWithHttpInfo = function(id, mediatype, inviteData) { var postBody = inviteData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling inviteByQueue"); } // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling inviteByQueue"); } // verify the required parameter 'inviteData' is set if (inviteData === undefined || inviteData === null) { throw new Error("Missing the required parameter 'inviteData' when calling inviteByQueue"); } var pathParams = { 'id': id, '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}/interactions/{id}/invite-by-queue', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Invite another agent to a chat via a queue * Invite another agent to the chat conference by sending an invitation to the specified queue. The next available agent in the queue is then sent an invite to join the chat. The customer is notified when the invited agent joins the chat. The agents can communicate with the customer or they can communicate with each other without the customer seeing their messages, depending on the value you set for the **visibility** parameter when you call [/media/chat/interactions/{id}/send-message](/reference/workspace/Media/index.html#sendMessage). * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {module:model/InviteData1} inviteData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.inviteByQueue = function(id, mediatype, inviteData) { return this.inviteByQueueWithHttpInfo(id, mediatype, inviteData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Leave a chat * Leave the specified chat or conference. If the agent is in a conference, the chat session stays open for the customer. If the agent is not in a conference, the chat ends for the customer but the agent can still update user data and set disposition. * @param {String} mediatype The chat media channel. * @param {String} id The ID of the chat interaction. * @param {Object} opts Optional parameters * @param {module:model/LeaveData} opts.leaveData 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.leaveChatWithHttpInfo = function(mediatype, id, opts) { opts = opts || {}; var postBody = opts['leaveData']; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling leaveChat"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling leaveChat"); } 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}/leave', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Leave a chat * Leave the specified chat or conference. If the agent is in a conference, the chat session stays open for the customer. If the agent is not in a conference, the chat ends for the customer but the agent can still update user data and set disposition. * @param {String} mediatype The chat media channel. * @param {String} id The ID of the chat interaction. * @param {Object} opts Optional parameters * @param {module:model/LeaveData} opts.leaveData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.leaveChat = function(mediatype, id, opts) { return this.leaveChatWithHttpInfo(mediatype, id, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Remove an agent from a chat conference * Remove the specified agent from the chat conference. * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {module:model/RemoveFromConferenceData} removeFromConferenceData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiSuccessResponse} and HTTP response */ this.removeFromConferenceWithHttpInfo = function(id, mediatype, removeFromConferenceData) { var postBody = removeFromConferenceData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling removeFromConference"); } // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling removeFromConference"); } // verify the required parameter 'removeFromConferenceData' is set if (removeFromConferenceData === undefined || removeFromConferenceData === null) { throw new Error("Missing the required parameter 'removeFromConferenceData' when calling removeFromConference"); } var pathParams = { 'id': id, '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}/interactions/{id}/remove-from-conference', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Remove an agent from a chat conference * Remove the specified agent from the chat conference. * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {module:model/RemoveFromConferenceData} removeFromConferenceData * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.removeFromConference = function(id, mediatype, removeFromConferenceData) { return this.removeFromConferenceWithHttpInfo(id, mediatype, removeFromConferenceData) .then(function(response_and_data) { return response_and_data.data; }); } /** * Send a custom notification * Send a custom notification to the specified chat. The notification is typically used as a trigger for some custom behavior on the recipient's end. * @param {String} mediatype The chat media channel. * @param {String} id The ID of the chat interaction. * @param {Object} opts Optional parameters * @param {module:model/CustomNotificationData} opts.customNotificationData 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.sendCustomNotificationWithHttpInfo = function(mediatype, id, opts) { opts = opts || {}; var postBody = opts['customNotificationData']; // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling sendCustomNotification"); } // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling sendCustomNotification"); } 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}/send-custom-notification', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Send a custom notification * Send a custom notification to the specified chat. The notification is typically used as a trigger for some custom behavior on the recipient's end. * @param {String} mediatype The chat media channel. * @param {String} id The ID of the chat interaction. * @param {Object} opts Optional parameters * @param {module:model/CustomNotificationData} opts.customNotificationData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.sendCustomNotification = function(mediatype, id, opts) { return this.sendCustomNotificationWithHttpInfo(mediatype, id, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Send a message * Send a message to participants in the specified chat. * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {Object} opts Optional parameters * @param {module:model/AcceptData1} 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.sendMessageWithHttpInfo = function(id, mediatype, opts) { opts = opts || {}; var postBody = opts['acceptData']; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling sendMessage"); } // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling sendMessage"); } var pathParams = { 'id': id, '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}/interactions/{id}/send-message', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Send a message * Send a message to participants in the specified chat. * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {Object} opts Optional parameters * @param {module:model/AcceptData1} opts.acceptData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.sendMessage = function(id, mediatype, opts) { return this.sendMessageWithHttpInfo(id, mediatype, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Send notification that the agent is typing * Send notification that the agent is typing to the other participants in the specified chat. * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {Object} opts Optional parameters * @param {module:model/TypingStartedData} opts.typingStartedData 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.sendTypingStartedWithHttpInfo = function(id, mediatype, opts) { opts = opts || {}; var postBody = opts['typingStartedData']; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling sendTypingStarted"); } // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling sendTypingStarted"); } var pathParams = { 'id': id, '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}/interactions/{id}/send-typing-started', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Send notification that the agent is typing * Send notification that the agent is typing to the other participants in the specified chat. * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {Object} opts Optional parameters * @param {module:model/TypingStartedData} opts.typingStartedData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.sendTypingStarted = function(id, mediatype, opts) { return this.sendTypingStartedWithHttpInfo(id, mediatype, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Send notification that the agent stopped typing * Send notification that the agent stopped typing to the other participants in the specified chat. * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {Object} opts Optional parameters * @param {module:model/TypingStoppedData} opts.typingStoppedData 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.sendTypingStoppedWithHttpInfo = function(id, mediatype, opts) { opts = opts || {}; var postBody = opts['typingStoppedData']; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling sendTypingStopped"); } // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling sendTypingStopped"); } var pathParams = { 'id': id, '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}/interactions/{id}/send-typing-stopped', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Send notification that the agent stopped typing * Send notification that the agent stopped typing to the other participants in the specified chat. * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {Object} opts Optional parameters * @param {module:model/TypingStoppedData} opts.typingStoppedData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.sendTypingStopped = function(id, mediatype, opts) { return this.sendTypingStoppedWithHttpInfo(id, mediatype, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Send a URL * Send a URL to participants in the specified chat. * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {Object} opts Optional parameters * @param {module:model/AcceptData2} 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.sendUrlDataWithHttpInfo = function(id, mediatype, opts) { opts = opts || {}; var postBody = opts['acceptData']; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling sendUrlData"); } // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling sendUrlData"); } var pathParams = { 'id': id, '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}/interactions/{id}/send-url', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Send a URL * Send a URL to participants in the specified chat. * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {Object} opts Optional parameters * @param {module:model/AcceptData2} opts.acceptData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.sendUrlData = function(id, mediatype, opts) { return this.sendUrlDataWithHttpInfo(id, mediatype, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Update an agent's nickname * Update the agent's nickname for the specified chat. * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {module:model/UpdateNicknameData} updateNicknameData 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.updateNicknameWithHttpInfo = function(id, mediatype, updateNicknameData) { var postBody = updateNicknameData; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling updateNickname"); } // verify the required parameter 'mediatype' is set if (mediatype === undefined || mediatype === null) { throw new Error("Missing the required parameter 'mediatype' when calling updateNickname"); } // verify the required parameter 'updateNicknameData' is set if (updateNicknameData === undefined || updateNicknameData === null) { throw new Error("Missing the required parameter 'updateNicknameData' when calling updateNickname"); } var pathParams = { 'id': id, '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}/interactions/{id}/update-nickname', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Update an agent's nickname * Update the agent's nickname for the specified chat. * @param {String} id The ID of the chat interaction. * @param {String} mediatype The chat media channel. * @param {module:model/UpdateNicknameData} updateNicknameData Request parameters. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiSuccessResponse} */ this.updateNickname = function(id, mediatype, updateNicknameData) { return this.updateNicknameWithHttpInfo(id, mediatype, updateNicknameData) .then(function(response_and_data) { return response_and_data.data; }); } }; return exports; }));