1717/// All operations in this interface are blocking. Implementations must ensure thread safety and
1818/// avoid synchronization blocks that cause carrier thread pinning during network I/O.
1919///
20+ /// Unless otherwise noted, every method in this interface throws [MatrixIOException] if the request
21+ /// or response payload cannot be processed, and [MatrixNetworkException] if the server's response
22+ /// status is not successful.
23+ ///
2024/// @see <a href="https://spec.matrix.org/v1.19/client-server-api/#rooms">Matrix Client-Server API
2125/// Specification for Rooms</a>
2226public interface Room {
2327 /// Creates a room based on the received [InitialRoomConfiguration].
2428 ///
2529 /// @param configuration of the room.
2630 /// @return the created room’s ID.
27- /// @throws MatrixIOException when the payload cannot be processed
28- /// @throws MatrixNetworkException when the response status is not successful
31+ /// @throws MatrixIOException when the payload cannot be processed.
32+ /// @throws MatrixNetworkException when the response status is not successful.
2933 String create (InitialRoomConfiguration configuration );
3034
3135 /// Requests the server to resolve a room alias if not possible, the server will use the
@@ -34,18 +38,24 @@ public interface Room {
3438 /// @param roomAlias the room alias.
3539 /// @return a [ResolvedAlias] containing the room ids for the requested alias and which servers
3640 /// are aware of it.
41+ /// @throws MatrixIOException when the payload cannot be processed.
42+ /// @throws MatrixNetworkException when the response status is not successful.
3743 ResolvedAlias resolveAlias (RoomAlias roomAlias );
3844
3945 /// Sets a room alias to a room.
4046 ///
4147 /// @param roomAlias a [RoomAlias].
4248 /// @param roomId the [RoomID] to receive the alias.
49+ /// @throws MatrixIOException when the payload cannot be processed.
50+ /// @throws MatrixNetworkException when the response status is not successful.
4351 void setAlias (RoomAlias roomAlias , RoomID roomId );
4452
4553 /// Requests the server to remove a mapping of a room alias to a room id. On success, servers
4654 /// might modify `m.room.canonical_alias`
4755 ///
4856 /// @param roomAlias the [RoomAlias] to remove.
57+ /// @throws MatrixIOException when the payload cannot be processed.
58+ /// @throws MatrixNetworkException when the response status is not successful.
4959 void deleteAlias (RoomAlias roomAlias );
5060
5161 /// Requests a list of aliases maintained by the local server for the given room, requires to be
@@ -56,12 +66,16 @@ public interface Room {
5666 ///
5767 /// @param roomId the [RoomID] to find local aliases of.
5868 /// @return a [List] of Room aliases.
69+ /// @throws MatrixIOException when the payload cannot be processed.
70+ /// @throws MatrixNetworkException when the response status is not successful.
5971 List <String > getAliasesOfARoom (RoomID roomId );
6072
6173 /// Requests the server to retrieve a list of the user's current rooms (in simple terms whoever
6274 /// calls this method).
6375 ///
6476 /// @return a [List] of the rooms.
77+ /// @throws MatrixIOException when the payload cannot be processed.
78+ /// @throws MatrixNetworkException when the response status is not successful.
6579 List <String > getJoinedRooms ();
6680
6781 /// Send an invitation to a user to participate in a room, this endpoint requires the caller to be
@@ -80,7 +94,10 @@ public interface Room {
8094 /// @param request a [JoinRoomRequest] where additional information can be passed.
8195 /// @param via the servers to attempt to join the room through. One of the servers must be
8296 /// participating in the room.
83- /// @return the room ID
97+ /// @return the room ID.
98+ /// @throws MatrixIOException when the payload cannot be processed.
99+ /// @throws MatrixNetworkException when the response status is not successful.
100+ /// @throws IllegalArgumentException when using an incorrect [Validator].
84101 String joinByRoomIdOrAliasIfAllowed (
85102 Validator roomIdOrAlias , JoinRoomRequest request , List <String > via );
86103
@@ -90,7 +107,9 @@ String joinByRoomIdOrAliasIfAllowed(
90107 /// @param request a [JoinRoomRequest] where additional information can be passed.
91108 /// @param via the servers to attempt to join the room through. One of the servers must be
92109 /// participating in the room.
93- /// @return the room ID
110+ /// @return the room ID.
111+ /// @throws MatrixIOException when the payload cannot be processed.
112+ /// @throws MatrixNetworkException when the response status is not successful.
94113 String joinByRoomIdIfAllowed (RoomID roomId , JoinRoomRequest request , List <String > via );
95114
96115 /// Knock on a room to ask for permission to join. Acceptance of this request happens out of band.
@@ -100,6 +119,8 @@ String joinByRoomIdOrAliasIfAllowed(
100119 /// @param via the servers to attempt to join the room through. One of the servers must be
101120 /// participating in the room.
102121 /// @return the room ID of the knocked room.
122+ /// @throws MatrixIOException when the payload cannot be processed.
123+ /// @throws MatrixNetworkException when the response status is not successful.
103124 String knockOn (Validator roomIdOrAlias , String reason , List <String > via );
104125
105126 /// Sends a request to leave the room, upon success, you will forget all messages from this room.
@@ -171,8 +192,7 @@ String joinByRoomIdOrAliasIfAllowed(
171192 /// @param since a pagination token from a previous request, allowing you to get the next or
172193 /// previous batch of rooms. The direction of pagination is specified by which token is
173194 /// supplied.
174- /// @return a [PublicRoomDirectory] containing [io.github.hikingc.matrixsdk.api.rooms.models.PublishedRoomsChunk] records of the published
175- /// rooms on the server.
195+ /// @return a [PublicRoomDirectory] containing records of the published rooms on the server.
176196 /// @throws MatrixIOException when the payload cannot be processed.
177197 /// @throws NullPointerException when the roomId is null.
178198 /// @see #getPublishedRoomDirectory(PublicRoomRequest)
@@ -182,18 +202,21 @@ String joinByRoomIdOrAliasIfAllowed(
182202 /// Lists a server’s published room directory.
183203 ///
184204 /// @param request a [PublicRoomRequest] with additional filters for the request.
185- /// @return a [PublicRoomDirectory] containing [io.github.hikingc.matrixsdk.api.rooms.models.PublishedRoomsChunk] records of the published
186- /// rooms on the server.
205+ /// @return a [PublicRoomDirectory] containing records of the published rooms on the server.
206+ /// @throws MatrixIOException when the payload cannot be processed.
207+ /// @throws MatrixNetworkException when the response status is not successful.
187208 PublicRoomDirectory getPublishedRoomDirectory (PublicRoomRequest request );
188209
189210 /// Retrieves a summary for a room. The response data might yield outdated, partial or even with
190211 /// no data.
191212 ///
192- /// @param roomIdOrAlias a [RoomID] or [RoomAlias] of the room to target
213+ /// @param roomIdOrAlias a [RoomID] or [RoomAlias] of the room to target.
193214 /// @param via the servers to attempt to request the summary from when the local server cannot
194- /// generate it
215+ /// generate it.
195216 /// @return a [RoomSummary] containing all the information about the room.
196217 /// @throws MatrixIOException when the payload cannot be processed.
197218 /// @throws NullPointerException when the roomId is null.
219+ /// @throws MatrixIOException when the payload cannot be processed.
220+ /// @throws MatrixNetworkException when the response status is not successful.
198221 RoomSummary getRoomSummary (Validator roomIdOrAlias , List <String > via );
199222}
0 commit comments