Skip to content

Commit 6b55e22

Browse files
committed
fix: add missing Rooms interface
Added Rooms interface, that was missing during in public API PR
1 parent 344e9f4 commit 6b55e22

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

chat-android/src/main/java/com/ably/chat/ChatClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface ChatClient {
1212
/**
1313
* The rooms object, which provides access to chat rooms.
1414
*/
15-
val room: Room
15+
val rooms: Rooms
1616

1717
/**
1818
* The underlying connection to Ably, which can be used to monitor the clients
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.ably.chat
2+
3+
/**
4+
* Manages the lifecycle of chat rooms.
5+
*/
6+
interface Rooms {
7+
/**
8+
* Get the client options used to create the Chat instance.
9+
*/
10+
val clientOptions: ClientOptions
11+
12+
/**
13+
* Gets a room reference by ID. The Rooms class ensures that only one reference
14+
* exists for each room. A new reference object is created if it doesn't already
15+
* exist, or if the one used previously was released using release(roomId).
16+
*
17+
* Always call `release(roomId)` after the Room object is no longer needed.
18+
*
19+
* @param roomId The ID of the room.
20+
* @param options The options for the room.
21+
* @throws {@link ErrorInfo} if a room with the same ID but different options already exists.
22+
* @returns Room A new or existing Room object.
23+
*/
24+
fun get(roomId: String, options: RoomOptions): Room
25+
26+
/**
27+
* Release the Room object if it exists. This method only releases the reference
28+
* to the Room object from the Rooms instance and detaches the room from Ably. It does not unsubscribe to any
29+
* events.
30+
*
31+
* After calling this function, the room object is no-longer usable. If you wish to get the room object again,
32+
* you must call {@link Rooms.get}.
33+
*
34+
* @param roomId The ID of the room.
35+
*/
36+
suspend fun release(roomId: String)
37+
}

0 commit comments

Comments
 (0)