Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains the client-server API https://matrix.org/docs/spec/client_server/r0.6.1
Synopsis
- data ClientSession
- newtype MatrixToken = MatrixToken Text
- getTokenFromEnv :: Text -> IO MatrixToken
- createSession :: Text -> MatrixToken -> IO ClientSession
- type MatrixIO a = IO (Either MatrixError a)
- data MatrixError = MatrixError {}
- retry :: (MonadMask m, MonadIO m) => m a -> m a
- newtype UserID = UserID Text
- getTokenOwner :: ClientSession -> MatrixIO UserID
- newtype TxnID = TxnID Text
- sendMessage :: ClientSession -> RoomID -> Event -> TxnID -> MatrixIO EventID
- data MessageText = MessageText {}
- data RoomMessage
- newtype Event = EventRoomMessage RoomMessage
- newtype EventID = EventID Text
- eventType :: Event -> Text
- newtype RoomID = RoomID Text
- getJoinedRooms :: ClientSession -> MatrixIO [RoomID]
- joinRoomById :: ClientSession -> RoomID -> MatrixIO RoomID
Client
data ClientSession Source #
The session record, use createSession
to create it.
newtype MatrixToken Source #
:: Text | The envirnoment variable name |
-> IO MatrixToken |
:: Text | The matrix client-server base url, e.g. "https://matrix.org" |
-> MatrixToken | The user token |
-> IO ClientSession |
createSession
creates the session record.
API
type MatrixIO a = IO (Either MatrixError a) Source #
MatrixIO
is a convenient type alias for server response
data MatrixError Source #
Instances
Eq MatrixError Source # | |
Defined in Network.Matrix.Internal (==) :: MatrixError -> MatrixError -> Bool # (/=) :: MatrixError -> MatrixError -> Bool # | |
Show MatrixError Source # | |
Defined in Network.Matrix.Internal showsPrec :: Int -> MatrixError -> ShowS # show :: MatrixError -> String # showList :: [MatrixError] -> ShowS # | |
FromJSON MatrixError Source # | |
Defined in Network.Matrix.Internal parseJSON :: Value -> Parser MatrixError # parseJSONList :: Value -> Parser [MatrixError] # |
retry :: (MonadMask m, MonadIO m) => m a -> m a Source #
Retry 5 times network action, doubling backoff each time
User data
getTokenOwner :: ClientSession -> MatrixIO UserID Source #
getTokenOwner
gets information about the owner of a given access token.
Room participation
sendMessage :: ClientSession -> RoomID -> Event -> TxnID -> MatrixIO EventID Source #
data MessageText Source #
Instances
Eq MessageText Source # | |
Defined in Network.Matrix.Events (==) :: MessageText -> MessageText -> Bool # (/=) :: MessageText -> MessageText -> Bool # | |
Show MessageText Source # | |
Defined in Network.Matrix.Events showsPrec :: Int -> MessageText -> ShowS # show :: MessageText -> String # showList :: [MessageText] -> ShowS # |
data RoomMessage Source #
Instances
Eq RoomMessage Source # | |
Defined in Network.Matrix.Events (==) :: RoomMessage -> RoomMessage -> Bool # (/=) :: RoomMessage -> RoomMessage -> Bool # | |
Show RoomMessage Source # | |
Defined in Network.Matrix.Events showsPrec :: Int -> RoomMessage -> ShowS # show :: RoomMessage -> String # showList :: [RoomMessage] -> ShowS # | |
ToJSON RoomMessage Source # | |
Defined in Network.Matrix.Events toJSON :: RoomMessage -> Value # toEncoding :: RoomMessage -> Encoding # toJSONList :: [RoomMessage] -> Value # toEncodingList :: [RoomMessage] -> Encoding # |
Instances
Room membership
getJoinedRooms :: ClientSession -> MatrixIO [RoomID] Source #
joinRoomById :: ClientSession -> RoomID -> MatrixIO RoomID Source #