(** Eio-idiomatic relation operations (reactions, edits, threads, replies). *) (** Send a reaction to an event. @param room_id The room containing the event @param event_id The event to react to @param key The reaction key (usually an emoji) @return The reaction event ID @raise Eio.Io on failure *) let send_reaction client ~room_id ~event_id ~key = Error.unwrap (Matrix_client.Relations.send_reaction (Client.base client) ~room_id ~event_id ~key) (** Send an edit to a message. @param room_id The room containing the event @param event_id The event to edit @param new_body The new message body @return The edit event ID @raise Eio.Io on failure *) let edit_message client ~room_id ~event_id ~new_body = Error.unwrap (Matrix_client.Relations.edit_message (Client.base client) ~room_id ~event_id ~new_body) (** Send a reply to a message. @param room_id The room containing the event @param event_id The event to reply to @param body The reply body @return The reply event ID @raise Eio.Io on failure *) let send_reply client ~room_id ~event_id ~body = Error.unwrap (Matrix_client.Relations.send_reply (Client.base client) ~room_id ~event_id ~body) (** Send a message in a thread. @param room_id The room containing the thread @param thread_root_id The root event of the thread @param body The message body @param reply_to_id Optional event to reply to within the thread @return The message event ID @raise Eio.Io on failure *) let send_in_thread client ~room_id ~thread_root_id ?reply_to_id ~body () = Error.unwrap (Matrix_client.Relations.send_in_thread (Client.base client) ~room_id ~thread_root_id ?reply_to_id ~body ()) (** Relation type *) type relation_type = Matrix_client.Relations.relation_type = | Annotation (** m.annotation - reactions *) | Reference (** m.reference - generic reference *) | Replace (** m.replace - edits *) | Thread (** m.thread - threads *) (** Aggregation result *) type aggregation = Matrix_client.Relations.aggregation = { event_id : Matrix_proto.Id.Event_id.t; origin_server_ts : int64; sender : Matrix_proto.Id.User_id.t; } (** Relations response *) type relations_response = Matrix_client.Relations.relations_response = { chunk : aggregation list; next_batch : string option; prev_batch : string option; } (** Get events related to a given event. @param room_id The room containing the event @param event_id The event to get relations for @param rel_type Optional relation type filter @param event_type Optional event type filter @param limit Maximum number of events @param from Pagination token @raise Eio.Io on failure *) let get_relations client ~room_id ~event_id ?rel_type ?event_type ?limit ?from () = Error.unwrap (Matrix_client.Relations.get_relations (Client.base client) ~room_id ~event_id ?rel_type ?event_type ?limit ?from ()) (** Get reactions for an event. @raise Eio.Io on failure *) let get_reactions client ~room_id ~event_id = Error.unwrap (Matrix_client.Relations.get_reactions (Client.base client) ~room_id ~event_id)