@rivium/chat 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/modules/rooms.d.ts +6 -0
- package/dist/modules/rooms.js +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,6 +88,8 @@ riviumChat.rooms.get(roomId) // Get room by ID
|
|
|
88
88
|
riviumChat.rooms.getByExternalId(externalId) // Get room by external ID
|
|
89
89
|
riviumChat.rooms.list(userId) // List rooms for a user
|
|
90
90
|
riviumChat.rooms.addParticipant(roomId, options) // Add participant to room
|
|
91
|
+
riviumChat.rooms.removeParticipant(roomId, userId) // Remove participant (idempotent)
|
|
92
|
+
riviumChat.rooms.delete(roomId) // Permanently delete a room
|
|
91
93
|
riviumChat.rooms.getUnreadSummary(userId) // Get unread counts
|
|
92
94
|
```
|
|
93
95
|
|
package/dist/modules/rooms.d.ts
CHANGED
|
@@ -17,4 +17,10 @@ export declare class Rooms {
|
|
|
17
17
|
getUnreadSummary(userId: string): Promise<UnreadSummary>;
|
|
18
18
|
/** Add a participant to a room. */
|
|
19
19
|
addParticipant(roomId: string, options: AddParticipantOptions): Promise<Participant>;
|
|
20
|
+
/** Remove a participant from a room. Idempotent — succeeds whether the participant existed or not. */
|
|
21
|
+
removeParticipant(roomId: string, externalUserId: string): Promise<void>;
|
|
22
|
+
/** Permanently delete a room and all its data. */
|
|
23
|
+
delete(roomId: string): Promise<{
|
|
24
|
+
success: boolean;
|
|
25
|
+
}>;
|
|
20
26
|
}
|
package/dist/modules/rooms.js
CHANGED
|
@@ -33,5 +33,13 @@ class Rooms {
|
|
|
33
33
|
async addParticipant(roomId, options) {
|
|
34
34
|
return this.client.post(`/api/v1/rooms/${roomId}/participants`, options);
|
|
35
35
|
}
|
|
36
|
+
/** Remove a participant from a room. Idempotent — succeeds whether the participant existed or not. */
|
|
37
|
+
async removeParticipant(roomId, externalUserId) {
|
|
38
|
+
await this.client.delete(`/api/v1/rooms/${roomId}/participants/${encodeURIComponent(externalUserId)}`);
|
|
39
|
+
}
|
|
40
|
+
/** Permanently delete a room and all its data. */
|
|
41
|
+
async delete(roomId) {
|
|
42
|
+
return this.client.delete(`/api/v1/rooms/${roomId}`);
|
|
43
|
+
}
|
|
36
44
|
}
|
|
37
45
|
exports.Rooms = Rooms;
|