-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from ably-labs/fix/add-missing-interface
fix: add missing Rooms interface
- Loading branch information
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.ably.chat | ||
|
||
/** | ||
* Manages the lifecycle of chat rooms. | ||
*/ | ||
interface Rooms { | ||
/** | ||
* Get the client options used to create the Chat instance. | ||
*/ | ||
val clientOptions: ClientOptions | ||
|
||
/** | ||
* Gets a room reference by ID. The Rooms class ensures that only one reference | ||
* exists for each room. A new reference object is created if it doesn't already | ||
* exist, or if the one used previously was released using release(roomId). | ||
* | ||
* Always call `release(roomId)` after the Room object is no longer needed. | ||
* | ||
* @param roomId The ID of the room. | ||
* @param options The options for the room. | ||
* @throws {@link ErrorInfo} if a room with the same ID but different options already exists. | ||
* @returns Room A new or existing Room object. | ||
*/ | ||
fun get(roomId: String, options: RoomOptions): Room | ||
|
||
/** | ||
* Release the Room object if it exists. This method only releases the reference | ||
* to the Room object from the Rooms instance and detaches the room from Ably. It does not unsubscribe to any | ||
* events. | ||
* | ||
* After calling this function, the room object is no-longer usable. If you wish to get the room object again, | ||
* you must call {@link Rooms.get}. | ||
* | ||
* @param roomId The ID of the room. | ||
*/ | ||
suspend fun release(roomId: String) | ||
} |