|
| 1 | +import {throwError} from 'rxjs'; |
| 2 | + |
| 3 | +import WebexAdapter from './WebexAdapter'; |
| 4 | + |
| 5 | +/** |
| 6 | + * Enum for room type values. |
| 7 | + * |
| 8 | + * @readonly |
| 9 | + * @enum {string} |
| 10 | + */ |
| 11 | +export const RoomType = { |
| 12 | + GROUP: 'group', |
| 13 | + DIRECT: 'direct', |
| 14 | +}; |
| 15 | + |
| 16 | +/** |
| 17 | + * This is a base class that defines the interface that maps room data. |
| 18 | + * Developers that want to extend `RoomsAdapter` must implement all of its methods, |
| 19 | + * adhering to the exact parameters and structure of the returned objects. |
| 20 | + */ |
| 21 | +export default class RoomsAdapter extends WebexAdapter { |
| 22 | + /** |
| 23 | + * A Room object with details about the room. |
| 24 | + * |
| 25 | + * @typedef {Object} Room |
| 26 | + * @property {string} ID The room identifier. |
| 27 | + * @property {string} title The room title. |
| 28 | + * @property {RoomType} type The type of the room. @see RoomType enum |
| 29 | + */ |
| 30 | + |
| 31 | + /** |
| 32 | + * Returns an observable that emits room data of the given ID. |
| 33 | + * |
| 34 | + * @param {string} ID ID of the room to get. |
| 35 | + * @returns {Observable.<Room>} |
| 36 | + * @memberof RoomsAdapter |
| 37 | + */ |
| 38 | + // eslint-disable-next-line no-unused-vars |
| 39 | + getRoom(ID) { |
| 40 | + return throwError(new Error('getRoom(ID) must be defined in RoomsAdapter')); |
| 41 | + } |
| 42 | + |
| 43 | + /** |
| 44 | + * Returns an observable that emits an array of previous activity IDs of the given roomID. |
| 45 | + * |
| 46 | + * @param {string} ID ID of the room to get. |
| 47 | + * @returns {Observable.<Array.<string>>} |
| 48 | + * @memberof RoomsAdapter |
| 49 | + */ |
| 50 | + // eslint-disable-next-line no-unused-vars |
| 51 | + getPreviousRoomActivities(ID) { |
| 52 | + return throwError(new Error('getPreviousRoomActivities(ID) must be defined in RoomsAdapter')); |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * Returns an observable that emits an array of current activity IDs of the given roomID. |
| 57 | + * |
| 58 | + * @param {string} ID ID of the room to get. |
| 59 | + * @returns {Observable.<Array.<string>>} |
| 60 | + * @memberof RoomsAdapter |
| 61 | + */ |
| 62 | + // eslint-disable-next-line no-unused-vars |
| 63 | + getRoomActivities(ID) { |
| 64 | + return throwError(new Error('getRoomActivities(ID) must be defined in RoomsAdapter')); |
| 65 | + } |
| 66 | +} |
0 commit comments