diff --git a/src/Internal/Values/Room.elm b/src/Internal/Values/Room.elm index 8564ddd..5db6821 100644 --- a/src/Internal/Values/Room.elm +++ b/src/Internal/Values/Room.elm @@ -19,6 +19,13 @@ type IRoom } +{-| Get given account data from the room. +-} +accountData : String -> IRoom -> Maybe E.Value +accountData key (IRoom room) = + Dict.get key room.accountData + + {-| Add the data of a single event to the hashdict of events. -} addEvent : IEvent -> IRoom -> IRoom diff --git a/src/Matrix/Room.elm b/src/Matrix/Room.elm index 03f1179..89bcc97 100644 --- a/src/Matrix/Room.elm +++ b/src/Matrix/Room.elm @@ -1,6 +1,6 @@ module Matrix.Room exposing ( Room, roomId, mostRecentEvents, findOlderEvents - , stateEvent + , stateEvent, accountData , sendMessage, sendMessages, sendOneEvent, sendMultipleEvents ) @@ -16,7 +16,7 @@ A room represents a channel of communication within a Matrix home server. # Exploring a room -@docs stateEvent +@docs stateEvent, accountData # Sending events @@ -41,6 +41,13 @@ type alias Room = Internal.Room +{-| Get any account data value that the user stores regarding this room. +-} +accountData : String -> Room -> Maybe E.Value +accountData = + Internal.accountData + + {-| If you want more events as part of the most recent events, you can run this task to get more. -} findOlderEvents : { limit : Maybe Int, room : Room } -> Task X.Error VaultUpdate