1+ /* eslint-disable valid-jsdoc */
2+ /* eslint-disable no-unused-vars */
13import { throwError } from 'rxjs' ;
24
35import WebexAdapter from './WebexAdapter' ;
46
7+ /**
8+ * A Room object with details about the room.
9+ *
10+ * @typedef {Object } Room
11+ * @property {string } ID The room identifier.
12+ * @property {string } title The room title.
13+ * @property {RoomType } type The type of the room. @see RoomType enum
14+ */
15+
16+ /**
17+ * @typedef {Object } ActivityDate
18+ * @param {string } date Date that will render on a time ruler. Must be a valid date-time string.
19+ * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse#Date_Time_String_Format
20+ */
21+
522/**
623 * Enum for room type values.
724 *
@@ -17,56 +34,57 @@ export const RoomType = {
1734 * This is a base class that defines the interface that maps room data.
1835 * Developers that want to extend `RoomsAdapter` must implement all of its methods,
1936 * adhering to the exact parameters and structure of the returned objects.
37+ *
38+ * `RoomsAdapter` handles data of a room such as details about that room but also
39+ * activities that happened/will happen within that room. Activities are expected
40+ * to be lazy loaded, and therefore, chunked.
2041 */
2142export 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- * @typedef {Object } ActivityData
33- * @param {string } date The date to render a time ruler for. Must be a valid date-time string
34- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse#Date_Time_String_Format
35- */
36-
3743 /**
3844 * Returns an observable that emits room data of the given ID.
3945 *
4046 * @param {string } ID ID of the room to get.
4147 * @returns {Observable.<Room> }
4248 * @memberof RoomsAdapter
4349 */
44- // eslint-disable-next-line no-unused-vars
4550 getRoom ( ID ) {
4651 return throwError ( new Error ( 'getRoom(ID) must be defined in RoomsAdapter' ) ) ;
4752 }
4853
4954 /**
50- * Returns an observable that emits an array of previous activity IDs of the given roomID.
55+ * Returns an observable that emits an array of current and future activities of the given roomID.
5156 *
52- * @param {string } ID ID of the room to get.
53- * @returns {Observable.<Array.<string>> }
57+ * @param {string } ID ID of the room for which to get activities.
58+ * @returns {Observable.<Array.<string|ActivityDate>> }
59+ * @memberof RoomsAdapter
60+ */
61+ getRoomActivities ( ID ) {
62+ return throwError ( new Error ( 'getRoomActivities(ID) must be defined in RoomsAdapter' ) ) ;
63+ }
64+
65+ /**
66+ * Returns an observable that emits an array of the next chunk of previous
67+ * activity data of the given roomID. If `hasMoreActivities` returns false,
68+ * the observable will complete.
69+ * **Previous activity data must be sorted oldest-to-latest.**
70+ *
71+ * @param {string } ID ID of the room for which to get activities.
72+ * @returns {Observable.<Array.<string|ActivityDate>> }
5473 * @memberof RoomsAdapter
5574 */
56- // eslint-disable-next-line no-unused-vars
5775 getPreviousRoomActivities ( ID ) {
5876 return throwError ( new Error ( 'getPreviousRoomActivities(ID) must be defined in RoomsAdapter' ) ) ;
5977 }
6078
6179 /**
62- * Returns an observable that emits an array of current activities of the given roomID.
80+ * Returns `true` if there are more activities to load from the room of the given ID.
81+ * Otherwise, it returns `false`.
6382 *
64- * @param {string } ID ID of the room to get .
65- * @returns {Observable.<Array.<string|ActivityData>> }
83+ * @param {string } ID ID of the room for which to verify activities .
84+ * @returns {boolean }
6685 * @memberof RoomsAdapter
6786 */
68- // eslint-disable-next-line no-unused-vars
69- getRoomActivities ( ID ) {
70- return throwError ( new Error ( 'getRoomActivities(ID) must be defined in RoomsAdapter' ) ) ;
87+ hasMoreActivities ( ID ) {
88+ throw new Error ( 'hasMoreActivities(ID) must be defined in RoomsAdapter' ) ;
7189 }
7290}
0 commit comments