Home Reference Source

src/calls/RemoteCall.js

import {RemoteSession} from '../session/RemoteSession';

export class RemoteCall {

	constructor(id, participants, session) {
		if (typeof id !== 'string') {
			throw new TypeError(`id parameter must be an string instead ${typeof id}`);
		}
		if (!(participants instanceof Array)) {
			throw new TypeError('participants parameter must be an Array instance');
		}
		if (!(session instanceof RemoteSession)) {
			throw new TypeError('session parameter must be an RemoteSession instance');
		}

		/**
		 * Call identifier
		 * @private
		 * @type {String}
		 */
		this._id = id;

		/**
		 * Participants involved into this call
		 * @private
		 * @type {Array<String>}
		 */
		this._participants = participants;

		/**
		 * Session where this call exists
		 * @private
		 * @type {RemoteSession}
		 */
		this._session = session;
	}

	/**
	 * Returns identifier associated with this call
	 * @type {String}
	 */
	get id() {
		return this._id;
	}

	/**
	 * List of participants associated with this call
	 * @type {Array<String>}
	 */
	get participants() {
		return this._participants;
	}

	/**
	 * Session where this call exists
	 * @type {RemoteSession}
	 */
	get session() {
		return this._session;
	}
}