@twilio/voice-react-native-sdk
Version:
Twilio Voice React Native SDK
116 lines (96 loc) • 2.85 kB
JavaScript
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/**
* Copyright © 2022 Twilio, Inc. All rights reserved. Licensed under the Twilio
* license.
*
* See LICENSE in the project root for license information.
*/
import { EventEmitter } from 'eventemitter3';
import { validateCallMessage } from './CallMessage';
/**
* CallMessage API is in beta.
*
* Provides access to information about a CallMessage, including the call
* message content, content type, message type, and voice event SID.
*
* @public
*/
export class IncomingCallMessage extends EventEmitter {
/**
* The content of the message which should match the contentType parameter.
*/
/**
* The MIME type of the content.
*/
/**
* Message type
*/
/**
* An autogenerated ID that uniquely identifies this message.
* This is not required when sending a message from the SDK as this is
* autogenerated.
* The ID will be available after the message is sent, or immediately when a
* message is received.
*/
/**
* Constructor for the {@link IncomingCallMessage} class. This should not be
* invoked by third-party code.
*
* @param NativeCallMessageInfo - An object containing all of the data from
* the native layer necessary to fully describe a call message, as well as
* invoke native functionality for the call message.
*
* @internal
*/
constructor(callMessageInfo) {
super();
_defineProperty(this, "_content", void 0);
_defineProperty(this, "_contentType", void 0);
_defineProperty(this, "_messageType", void 0);
_defineProperty(this, "_voiceEventSid", void 0);
const {
content,
contentType,
messageType
} = validateCallMessage(callMessageInfo);
this._content = content;
this._contentType = contentType;
this._messageType = messageType;
this._voiceEventSid = callMessageInfo.voiceEventSid;
}
/**
* {@inheritdoc CallMessage.content}
*
* @returns the content of the call message.
*/
getContent() {
return this._content;
}
/**
* {@inheritdoc CallMessage.contentType}
*
* @returns the content type of the call message.
*/
getContentType() {
return this._contentType;
}
/**
* {@inheritdoc CallMessage.messageType}
*
* @returns the message type of the call message.
*/
getMessageType() {
return this._messageType;
}
/**
* Get the message SID.
* @returns
* - A string representing the message SID.
* - `undefined` if the call information has not yet been received from the
* native layer.
*/
getSid() {
return this._voiceEventSid;
}
}
//# sourceMappingURL=IncomingCallMessage.js.map