fetchRooms
Retrieves rooms sorted by start time with automatic status calculation. Rooms are categorized as “live”, “upcoming”, or “finished” and sorted by priority (live first, then upcoming, then finished).Filter rooms by author ID
Cursor for pagination. Pass the last room ID to fetch the next page of results.
Promise<Room[]> - Array of rooms with computed status field
Computed status based on current time, startTime, and endTime:
- “finished”: endTime is in the past
- “upcoming”: startTime is in the future
- “live”: between startTime and endTime
executeRoom
Executes a room action through the rooms guard function. This is the recommended way to perform room operations as it includes proper validation and authorization.The action to perform on the room
Array of team names participating in the match
ISO 8601 timestamp for match start time
Type of cricket match
Whether the room is locked for new participants
Room ID (required for update and delete actions)
ISO 8601 timestamp for match end time
Promise<Execution>
Error Handling: Throws error if execution fails or status is “failed”. Error message from execution is included. Error is logged and re-thrown.
fetchRoomMessages
Retrieves messages for a specific room, sorted by creation date (newest first). Limited to 50 messages.ID of the room whose messages to fetch
Promise<{ rows: RoomMessage[], total: number }>
Error Handling: Throws error if fetching fails. Error is logged and re-thrown.
executeRoomMessage
Executes a room message action through the room message guard function. This is the recommended way to perform message operations as it includes proper validation, rate limiting, and push notifications.The action to perform on the message
ID of the room where the message belongs
Message content (required for create and update actions)
Message ID (required for update and delete actions)
Promise<Execution>
Error Handling: Throws error if execution fails or status is “failed”. Error is logged and re-thrown.
Room messages have a rate limit of 60 requests per minute enforced by the room-message-guard function. Creating messages also triggers push notifications to other room participants.