-
Notifications
You must be signed in to change notification settings - Fork 118
/
IRoomRead.ts
64 lines (57 loc) · 1.7 KB
/
IRoomRead.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { IMessage } from '../messages/index';
import { IRoom } from '../rooms/index';
import { IUser } from '../users/index';
/**
* This accessor provides methods for accessing
* rooms in a read-only-fashion.
*/
export interface IRoomRead {
/**
* Gets a room by an id.
*
* @param id the id of the room
* @returns the room
*/
getById(id: string): Promise<IRoom | undefined>;
/**
* Gets just the creator of the room by the room's id.
*
* @param id the id of the room
* @returns the creator of the room
*/
getCreatorUserById(id: string): Promise<IUser | undefined>;
/**
* Gets a room by its name.
*
* @param name the name of the room
* @returns the room
*/
getByName(name: string): Promise<IRoom | undefined>;
/**
* Gets just the creator of the room by the room's name.
*
* @param name the name of the room
* @returns the creator of the room
*/
getCreatorUserByName(name: string): Promise<IUser | undefined>;
/**
* Gets an iterator for all of the messages in the provided room.
*
* @param roomId the room's id
* @returns an iterator for messages
*/
getMessages(roomId: string): Promise<IterableIterator<IMessage>>;
/**
* Gets an iterator for all of the users in the provided room.
*
* @param roomId the room's id
* @returns an iterator for the users in the room
*/
getMembers(roomId: string): Promise<Array<IUser>>;
/**
* Gets a direct room with all usernames
* @param usernames all usernames belonging to the direct room
* @returns the room
*/
getDirectByUsernames(usernames: Array<string>): Promise<IRoom>;
}