File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
matrix-client/src/Network/Matrix Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -226,6 +226,9 @@ mkRequest ClientSession {..} = mkRequest' baseUrl token
226226doRequest :: FromJSON a => ClientSession -> HTTP. Request -> MatrixIO a
227227doRequest ClientSession {.. } = doRequest' manager
228228
229+ doRequestExpectEmptyResponse :: ClientSession -> String -> HTTP. Request -> MatrixIO ()
230+ doRequestExpectEmptyResponse sess apiName request = fmap (ensureEmptyObject apiName) <$> doRequest sess request
231+
229232-- | 'getTokenOwner' gets information about the owner of a given access token.
230233getTokenOwner :: ClientSession -> MatrixIO UserID
231234getTokenOwner session =
@@ -631,10 +634,10 @@ inviteToRoom :: ClientSession -> RoomID -> UserID -> Maybe T.Text -> MatrixIO ()
631634inviteToRoom session (RoomID rid) (UserID uid) reason = do
632635 request <- mkRequest session True $ " /_matrix/client/v3/rooms/" <> rid <> " /invite"
633636 let body = object $ [(" user_id" , toJSON uid)] <> catMaybes [fmap ((" reason" ,) . toJSON) reason]
634- fmap (ensureEmptyObject " invite" ) <$> (doRequest session $
637+ doRequestExpectEmptyResponse session " invite" $
635638 request { HTTP. method = " POST"
636639 , HTTP. requestBody = HTTP. RequestBodyLBS $ encode body
637- })
640+ }
638641
639642-- | Note that this API takes either a room ID or alias, unlike 'joinRoomById'
640643-- https://spec.matrix.org/v1.1/client-server-api/#post_matrixclientv3joinroomidoralias
You can’t perform that action at this time.
0 commit comments