| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Network.Matrix.Client
Description
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 #
Constructors
| MatrixToken Text |
Arguments
| :: Text | The envirnoment variable name |
| -> IO MatrixToken |
Arguments
| :: 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 #
Constructors
| MatrixError | |
Instances
| Eq MatrixError Source # | |
Defined in Network.Matrix.Internal | |
| Show MatrixError Source # | |
Defined in Network.Matrix.Internal Methods showsPrec :: Int -> MatrixError -> ShowS # show :: MatrixError -> String # showList :: [MatrixError] -> ShowS # | |
| FromJSON MatrixError Source # | |
Defined in Network.Matrix.Internal | |
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 #
Constructors
| MessageText | |
Instances
| Eq MessageText Source # | |
Defined in Network.Matrix.Events | |
| Show MessageText Source # | |
Defined in Network.Matrix.Events Methods showsPrec :: Int -> MessageText -> ShowS # show :: MessageText -> String # showList :: [MessageText] -> ShowS # | |
data RoomMessage Source #
Instances
| Eq RoomMessage Source # | |
Defined in Network.Matrix.Events | |
| Show RoomMessage Source # | |
Defined in Network.Matrix.Events Methods showsPrec :: Int -> RoomMessage -> ShowS # show :: RoomMessage -> String # showList :: [RoomMessage] -> ShowS # | |
| ToJSON RoomMessage Source # | |
Defined in Network.Matrix.Events Methods toJSON :: RoomMessage -> Value # toEncoding :: RoomMessage -> Encoding # toJSONList :: [RoomMessage] -> Value # toEncodingList :: [RoomMessage] -> Encoding # | |
Constructors
| EventRoomMessage RoomMessage |
Room membership
getJoinedRooms :: ClientSession -> MatrixIO [RoomID] Source #
joinRoomById :: ClientSession -> RoomID -> MatrixIO RoomID Source #