Class MatrixHttpClient
java.lang.Object
io.meeds.chat.service.utils.MatrixHttpClient
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DurationLongest wait a bounded login spends on a 429 answer before its one retry. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthenticateUser(String userName, String password) Authenticates a user using his userName and passwordcreateDirectMessagingRoom(String inviteeMatrixId, String accessToken) Creates a direct messaging room as the user owning the access token, with the payload the web chat sends: a private, trusted room flagged as direct, the other participant invited, guests forbidden.createRoom(String name, String description, String token) createUserAccount(org.exoplatform.services.organization.User user, String token) deleteMedia(String mediaId, String accessToken) voiddeletePusher(String appId, String pushkey, String accessToken, Duration timeout) Deletes a pusher of the account owning the access token: the client API deletes a pusher by setting its pair (appId,pushkey) with a null kind.booleandeleteRoom(String matrixRoomId, String accessToken) Deletes a Matrix roomdisableAccount(String userName, boolean eraseData, String token) getAccessToken(String userJWTToken) Get an authenticated access token for the administrative tasksgetAccessToken(String userJWTToken, Duration timeout) Logs in with a JWT likegetAccessToken(String), with a bounded wait: each request is bounded bytimeout, and a 429 answer is waited for at most once, never more thanMAX_RATE_LIMIT_WAIT, before one retry.getEventById(String eventId, String roomId, String accessToken) Retrieves an event from Matrix by its Id.getEventById(String eventId, String roomId, String accessToken, Duration timeout) Reads one event likegetEventById(String, String, String), the request bounded bytimeout.getMediaInfo(String mediaId, String accessToken) getOverriddenRateLimitForUser(String userIdOnMatrix, String accessToken) Gets the overridden the rate limits for a given usergetPushers(String accessToken, Duration timeout) Lists the pushers of the account owning the access token.getPushRules(String accessToken, Duration timeout) Lists the global push rules of the account owning the access token, every kind, server defaults included.getRoomDisplayName(String roomIdLocalPart, String currentUserMatrixId, String accessToken) Reads a room's display name from Matrix itself, as the given user: itsm.room.name, or — for a two-member room, i.e.getRoomMessages(String matrixRoomId, int limit, String accessToken) Retrieves the most recent messages of a room as the user owning the given access token, using the Matrix client API (/_matrix/client/v3/rooms/{roomId}/messages).getRoomMessages(String matrixRoomId, int limit, String accessToken, Duration timeout) Reads the most recent messages of a room likegetRoomMessages(String, int, String), the request bounded bytimeout: a timeout or a transport failure is thrown, never answered as an empty list.getRoomSettings(String matrixRoomId, String accessToken) Get permissions settings of a roomgetUnreadRooms(String accessToken, int timelineLimit) Returns, for the user owning the given access token, the rooms that have unread notifications together with their recent timeline messages, using a lightweight/synccall.Retrieve the user details from Matrix serverReads the details of a Matrix user likegetUser(String, String), the request bounded bytimeout.getUserDisplayName(String userMatrixId, String matrixAccessToken) getUserPresence(String matrixIdOfUser, String accessToken) Retrieve the user presence from Matrix serverbooleaninvalidateAccessToken(String accessToken) Invalidates an access token on Matrix serverbooleaninviteUserToRoom(String roomId, String userMatrixId, String invitationMessage, String token) Invites a user to a specific room on MatrixbooleanisUserMemberOfRoom(String matrixRoomId, String matrixIdOfUser, String accessToken) Checks if a user is a member of a roombooleanjoinUserToRoom(String matrixRoomId, String matrixIdOfUser, String token) Adds directly a user to a roombooleankickUserFromRoom(String roomId, String userMatrixId, String raisonMessage, String token) Kicks a user out of a specific room on MatrixbooleanmakeUserAdminInRoom(String matrixRoomId, String matrixIdOfUser, String token) Make user an admin of the roomoverrideRateLimitForUser(String userIdOnMatrix, int messagesPerSecond, int burstCount, String accessToken) Overrides the rate limits for a given userrenameRoom(String roomId, String newRoomName, String token) saveUserAccount(org.exoplatform.social.core.identity.model.Identity user, String matrixUserId, boolean isNew, String token) Saves the user account on MatrixsaveUserAccount(org.exoplatform.social.core.identity.model.Identity user, String matrixUserId, boolean isNew, String token, boolean isEnableUserOperation, boolean isUserEnabled) Saves the user accountsearchMessages(String query, String roomIdLocalPart, int limit, String accessToken) Runs a Matrix full-text search of message bodies as the user owning the given access token, optionally scoped to a single room.sendMessage(String matrixRoomId, String text, String transactionId, String accessToken) Sends a textual message to a room as the user owning the given access token, using the Matrix client API.sendMessage(String matrixRoomId, org.json.JSONObject content, String transactionId, String accessToken, Duration timeout) Sends a message built by the caller to a room as the user owning the given access token, the request bounded bytimeout: a timeout or a transport failure is thrown.voidsendReadReceipt(String matrixRoomId, String eventId, String accessToken) Posts anm.readreceipt on behalf of a user: a Matrix read receipt is a high-water mark, everything up to the event becomes read.voidsetDirectRoomsAccountData(String userMatrixId, Map<String, String[]> directRooms, String accessToken) Replaces them.directaccount data of the user owning the access token, which tells Matrix clients which of their rooms are direct messages and with whom.voidsetPusher(MatrixPusher pusher, String accessToken, Duration timeout) Sets an HTTP pusher of the account owning the access token, which pushes event ids only (event_id_only).voidsetPushRuleEnabled(String kind, String ruleId, boolean enabled, String accessToken, Duration timeout) Enables or disables one global push rule of the account owning the access token.setUserPresence(String matrixIdOfUser, String presence, String statusMessage, String accessToken) Set the user presence on Matrix serverbooleanupdateRoomAvatar(String matrixRoomId, String avatarURL, String accessToken) Update room avatarbooleanupdateRoomDescription(String matrixRoomId, String description, String accessToken) Updates the room descriptionupdateRoomSettings(String matrixRoomId, MatrixRoomPermissions roomSettings, String accessToken) Updates the room settings.booleanupdateUserAvatar(String userMatrixId, String avatarURL, String accessToken) Update the user avatarvoidupdateUserDisplayName(String userMatrixId, String displayName, String token) Sets a new display name for the useruploadFile(String fileName, String mimeType, byte[] imageBytes, String accessToken)
-
Field Details
-
MAX_RATE_LIMIT_WAIT
Longest wait a bounded login spends on a 429 answer before its one retry.
-
-
Constructor Details
-
MatrixHttpClient
public MatrixHttpClient()
-
-
Method Details
-
getAccessToken
public String getAccessToken(String userJWTToken) throws org.exoplatform.ws.frameworks.json.impl.JsonException, IOException, InterruptedException Get an authenticated access token for the administrative tasks- Parameters:
userJWTToken- JWT token used to authenticate the admin user- Returns:
- String the access token for the authenticated user
- Throws:
org.exoplatform.ws.frameworks.json.impl.JsonExceptionIOExceptionInterruptedException
-
getAccessToken
public String getAccessToken(String userJWTToken, Duration timeout) throws IOException, InterruptedException Logs in with a JWT likegetAccessToken(String), with a bounded wait: each request is bounded bytimeout, and a 429 answer is waited for at most once, never more thanMAX_RATE_LIMIT_WAIT, before one retry. Any other failure, a second 429 included, throws.- Parameters:
userJWTToken- the JWT of the account to log intimeout- the timeout of each request- Returns:
- the access token
- Throws:
IOException- when a request fails or times outInterruptedException- when the wait or a request is interrupted
-
getPushers
public List<MatrixPusher> getPushers(String accessToken, Duration timeout) throws IOException, InterruptedException Lists the pushers of the account owning the access token.- Parameters:
accessToken- the account's access tokentimeout- the request timeout- Returns:
- the account's pushers, never null
- Throws:
MatrixUnauthorizedException- when the token is rejectedMatrixException- when Synapse answers another errorIOException- when the request fails or times outInterruptedException- when the request is interrupted
-
setPusher
public void setPusher(MatrixPusher pusher, String accessToken, Duration timeout) throws IOException, InterruptedException Sets an HTTP pusher of the account owning the access token, which pushes event ids only (event_id_only). Synapse replaces any pusher of the sameappIdandpushkey, and keeps the account's other pushers (appendfalse only concerns another account holding the same pushkey).- Parameters:
pusher- the pusher to setaccessToken- the account's access tokentimeout- the request timeout- Throws:
MatrixUnauthorizedException- when the token is rejectedMatrixException- when Synapse answers another errorIOException- when the request fails or times outInterruptedException- when the request is interrupted
-
deletePusher
public void deletePusher(String appId, String pushkey, String accessToken, Duration timeout) throws IOException, InterruptedException Deletes a pusher of the account owning the access token: the client API deletes a pusher by setting its pair (appId,pushkey) with a null kind.- Parameters:
appId- the pusher's application idpushkey- the pusher's keyaccessToken- the account's access tokentimeout- the request timeout- Throws:
MatrixUnauthorizedException- when the token is rejectedMatrixException- when Synapse answers another errorIOException- when the request fails or times outInterruptedException- when the request is interrupted
-
getPushRules
public List<MatrixPushRule> getPushRules(String accessToken, Duration timeout) throws IOException, InterruptedException Lists the global push rules of the account owning the access token, every kind, server defaults included.- Parameters:
accessToken- the account's access tokentimeout- the request timeout- Returns:
- the account's global push rules, never null
- Throws:
MatrixUnauthorizedException- when the token is rejectedMatrixException- when Synapse answers another errorIOException- when the request fails or times outInterruptedException- when the request is interrupted
-
setPushRuleEnabled
public void setPushRuleEnabled(String kind, String ruleId, boolean enabled, String accessToken, Duration timeout) throws IOException, InterruptedException Enables or disables one global push rule of the account owning the access token. The rule id is percent-encoded into the path.- Parameters:
kind- the rule kindruleId- the rule idenabled- the state to setaccessToken- the account's access tokentimeout- the request timeout- Throws:
MatrixUnauthorizedException- when the token is rejectedMatrixException- when Synapse answers another errorIOException- when the request fails or times outInterruptedException- when the request is interrupted
-
authenticateUser
public String authenticateUser(String userName, String password) throws org.exoplatform.ws.frameworks.json.impl.JsonException, IOException, InterruptedException Authenticates a user using his userName and password- Parameters:
userName- the usernamepassword- the user password- Returns:
- String : access token for the authenticated user
- Throws:
org.exoplatform.ws.frameworks.json.impl.JsonExceptionIOExceptionInterruptedException
-
createRoom
-
createDirectMessagingRoom
public String createDirectMessagingRoom(String inviteeMatrixId, String accessToken) throws IOException, InterruptedException Creates a direct messaging room as the user owning the access token, with the payload the web chat sends: a private, trusted room flagged as direct, the other participant invited, guests forbidden.- Parameters:
inviteeMatrixId- the full Matrix id of the other participantaccessToken- the creating user's Matrix access token- Returns:
- the full id of the created room, as Synapse returns it
- Throws:
MatrixUnauthorizedException- when the token is rejectedMatrixException- when Synapse answers another errorIOException- when the request failsInterruptedException- when the request is interrupted
-
setDirectRoomsAccountData
public void setDirectRoomsAccountData(String userMatrixId, Map<String, String[]> directRooms, String accessToken) throws IOException, InterruptedExceptionReplaces them.directaccount data of the user owning the access token, which tells Matrix clients which of their rooms are direct messages and with whom.- Parameters:
userMatrixId- the full Matrix id of the userdirectRooms- the room ids of the user's direct messages, by the full Matrix id of the other participantaccessToken- the user's Matrix access token- Throws:
MatrixUnauthorizedException- when the token is rejectedMatrixException- when Synapse answers another errorIOException- when the request failsInterruptedException- when the request is interrupted
-
createUserAccount
-
updateUserDisplayName
public void updateUserDisplayName(String userMatrixId, String displayName, String token) throws IOException, InterruptedException, org.exoplatform.ws.frameworks.json.impl.JsonException Sets a new display name for the user- Parameters:
userMatrixId- the ID of the user on MatrixdisplayName- the new display nametoken- the access token- Throws:
IOExceptionInterruptedExceptionorg.exoplatform.ws.frameworks.json.impl.JsonException
-
saveUserAccount
public String saveUserAccount(org.exoplatform.social.core.identity.model.Identity user, String matrixUserId, boolean isNew, String token) Saves the user account on Matrix- Parameters:
user- the user identitymatrixUserId- the user Matrix ID to setisNew- if the user has been just createdtoken- the authorization token- Returns:
- the user Matrix ID
-
saveUserAccount
public String saveUserAccount(org.exoplatform.social.core.identity.model.Identity user, String matrixUserId, boolean isNew, String token, boolean isEnableUserOperation, boolean isUserEnabled) Saves the user account- Parameters:
user- the UsermatrixUserId- the corresponding matrix IDisNew- if the user account is onetoken- the access tokenisEnableUserOperation- is this an operation to enable/disable the user on Matrix- Returns:
- the user Matrix ID
-
disableAccount
-
renameRoom
-
inviteUserToRoom
-
kickUserFromRoom
-
joinUserToRoom
-
makeUserAdminInRoom
-
isUserMemberOfRoom
public boolean isUserMemberOfRoom(String matrixRoomId, String matrixIdOfUser, String accessToken) throws IOException, InterruptedException Checks if a user is a member of a room- Parameters:
matrixRoomId- the room IDmatrixIdOfUser- the ID of the user on Matrix- Returns:
- true if the user is a member of the room, false otherwise
- Throws:
IOExceptionInterruptedException
-
getRoomSettings
public MatrixRoomPermissions getRoomSettings(String matrixRoomId, String accessToken) throws IOException, InterruptedException, org.exoplatform.ws.frameworks.json.impl.JsonException Get permissions settings of a room- Parameters:
matrixRoomId-- Returns:
- MatrixRoomPermissions object containing settings of the room
- Throws:
IOExceptionInterruptedExceptionorg.exoplatform.ws.frameworks.json.impl.JsonException
-
updateRoomSettings
public String updateRoomSettings(String matrixRoomId, MatrixRoomPermissions roomSettings, String accessToken) throws IOException, InterruptedException, org.exoplatform.ws.frameworks.json.impl.JsonException Updates the room settings. From room version 12 (MSC4289) the creators of a room have unlimited power and Synapse refuses a power levels event whose users map lists one of them, so they are left out of the users sent for such a room. In an older room the users map is sent unchanged: its creator's power comes from that map.- Parameters:
matrixRoomId- the Id of the room- Returns:
- MatrixRoomPermissions updated room settings
- Throws:
IOExceptionInterruptedExceptionorg.exoplatform.ws.frameworks.json.impl.JsonException
-
uploadFile
-
updateRoomAvatar
-
updateUserAvatar
-
updateRoomDescription
-
deleteRoom
-
getUserDisplayName
public String getUserDisplayName(String userMatrixId, String matrixAccessToken) throws IOException, InterruptedException, org.exoplatform.ws.frameworks.json.impl.JsonException - Throws:
IOExceptionInterruptedExceptionorg.exoplatform.ws.frameworks.json.impl.JsonException
-
getUserPresence
public String getUserPresence(String matrixIdOfUser, String accessToken) throws IOException, InterruptedException, org.exoplatform.ws.frameworks.json.impl.JsonException Retrieve the user presence from Matrix server- Parameters:
matrixIdOfUser- the ID of the user on MatrixaccessToken- the access token- Returns:
- the value of the presence
- Throws:
IOExceptionInterruptedExceptionorg.exoplatform.ws.frameworks.json.impl.JsonException
-
getUser
public String getUser(String matrixIdOfUser, String accessToken) throws IOException, InterruptedException Retrieve the user details from Matrix server- Parameters:
matrixIdOfUser- the ID of the user on MatrixaccessToken- the access token- Returns:
- String representing JSON of the user
- Throws:
IOExceptionInterruptedException
-
getUser
public String getUser(String matrixIdOfUser, String accessToken, Duration timeout) throws IOException, InterruptedException Reads the details of a Matrix user likegetUser(String, String), the request bounded bytimeout.- Parameters:
matrixIdOfUser- the Matrix id of the useraccessToken- the administrator's access tokentimeout- the request timeout- Returns:
- the user's details, as Synapse's admin API returns them
- Throws:
IOException- when the request fails or times outInterruptedException- when the request is interrupted
-
setUserPresence
public String setUserPresence(String matrixIdOfUser, String presence, String statusMessage, String accessToken) throws IOException, InterruptedException, org.exoplatform.ws.frameworks.json.impl.JsonException Set the user presence on Matrix server- Parameters:
matrixIdOfUser- the ID of the user n Matrixpresence- the presence value : 'online, offline , unavailable"statusMessage- : the personalized status messageaccessToken- the access token- Returns:
- Throws:
IOExceptionInterruptedExceptionorg.exoplatform.ws.frameworks.json.impl.JsonException
-
overrideRateLimitForUser
public String overrideRateLimitForUser(String userIdOnMatrix, int messagesPerSecond, int burstCount, String accessToken) throws IOException, InterruptedException Overrides the rate limits for a given user- Parameters:
userIdOnMatrix- the user Id on MatrixmessagesPerSecond- the allowed number of messages per secondburstCount- how many actions that can be performed before being limitedaccessToken- the access token- Returns:
- String the applied rate limits configuration
- Throws:
IOExceptionInterruptedException
-
getOverriddenRateLimitForUser
public String getOverriddenRateLimitForUser(String userIdOnMatrix, String accessToken) throws IOException, InterruptedException Gets the overridden the rate limits for a given user- Parameters:
userIdOnMatrix- the user Id on MatrixaccessToken- the access token- Returns:
- String the applied rate limits configuration
- Throws:
IOExceptionInterruptedException
-
getEventById
public MatrixMessage getEventById(String eventId, String roomId, String accessToken) throws IOException, InterruptedException, org.exoplatform.ws.frameworks.json.impl.JsonException Retrieves an event from Matrix by its Id. The message content is the plain-textbody; the HTMLformatted_bodyis kept apart inMatrixMessage#getFormattedContent()when the content declares theorg.matrix.custom.htmlformat. The room id and the event id are percent-encoded into the path: an event id of a room version 3 room can contain/and+, and an unencoded/makes Synapse answer 404.- Parameters:
eventId- the event IDroomId- the room IDaccessToken- the access token used to read the event- Returns:
- the message, null when the event is missing or not readable with that token
- Throws:
IOException- when the request failsInterruptedException- when the request is interruptedorg.exoplatform.ws.frameworks.json.impl.JsonException- when the response cannot be parsed
-
getEventById
public MatrixMessage getEventById(String eventId, String roomId, String accessToken, Duration timeout) throws IOException, InterruptedException, org.exoplatform.ws.frameworks.json.impl.JsonException Reads one event likegetEventById(String, String, String), the request bounded bytimeout.- Parameters:
eventId- the event IDroomId- the room IDaccessToken- the access token used to read the eventtimeout- the request timeout- Returns:
- the message, null when the event is missing or not readable with that token
- Throws:
IOException- when the request fails or times outInterruptedException- when the request is interruptedorg.exoplatform.ws.frameworks.json.impl.JsonException- when the response cannot be parsed
-
getRoomMessages
public List<MatrixMessage> getRoomMessages(String matrixRoomId, int limit, String accessToken) throws IOException, InterruptedException, org.exoplatform.ws.frameworks.json.impl.JsonException Retrieves the most recent messages of a room as the user owning the given access token, using the Matrix client API (/_matrix/client/v3/rooms/{roomId}/messages). Synapse enforces the user's own visibility (membership, history visibility, redactions); if the user is not allowed to read the room an empty list is returned. Events are returned newest-first (thedir=bdirection).- Parameters:
matrixRoomId- the room local part (without the server name suffix)limit- the maximum number of events to fetchaccessToken- the requesting user's Matrix access token- Returns:
- the
m.room.messageevents the user can see, newest first - Throws:
IOExceptionInterruptedExceptionorg.exoplatform.ws.frameworks.json.impl.JsonException
-
getRoomMessages
public List<MatrixMessage> getRoomMessages(String matrixRoomId, int limit, String accessToken, Duration timeout) throws IOException, InterruptedException, org.exoplatform.ws.frameworks.json.impl.JsonException Reads the most recent messages of a room likegetRoomMessages(String, int, String), the request bounded bytimeout: a timeout or a transport failure is thrown, never answered as an empty list.- Parameters:
matrixRoomId- the room local part (without the server name suffix)limit- the maximum number of events to fetchaccessToken- the requesting user's Matrix access tokentimeout- the request timeout- Returns:
- the
m.room.messageevents the user can see, newest first - Throws:
IOException- when the request fails or times outInterruptedException- when the request is interruptedorg.exoplatform.ws.frameworks.json.impl.JsonException- when the response cannot be parsed
-
getUnreadRooms
public List<MatrixUnreadRoom> getUnreadRooms(String accessToken, int timelineLimit) throws IOException, InterruptedException, org.exoplatform.ws.frameworks.json.impl.JsonException Returns, for the user owning the given access token, the rooms that have unread notifications together with their recent timeline messages, using a lightweight/synccall. Synapse only returns rooms the user has joined, so visibility is naturally enforced.- Parameters:
accessToken- the requesting user's Matrix access tokentimelineLimit- the maximum number of recent events to fetch per room- Returns:
- the user's unread rooms, never
null - Throws:
IOExceptionInterruptedExceptionorg.exoplatform.ws.frameworks.json.impl.JsonException
-
getRoomDisplayName
public String getRoomDisplayName(String roomIdLocalPart, String currentUserMatrixId, String accessToken) Reads a room's display name from Matrix itself, as the given user: itsm.room.name, or — for a two-member room, i.e. a direct message — the other member's display name. Used to name a conversation the platform does not track, so it is shown by its real name instead of a placeholder.- Parameters:
roomIdLocalPart- the room local part (without the server name suffix)currentUserMatrixId- the requesting user's full Matrix id, used to pick the other member of a direct messageaccessToken- the requesting user's Matrix access token- Returns:
- the room display name, or
nullwhen Matrix has none either
-
searchMessages
public List<MatrixMessage> searchMessages(String query, String roomIdLocalPart, int limit, String accessToken) throws IOException, InterruptedException, org.exoplatform.ws.frameworks.json.impl.JsonException Runs a Matrix full-text search of message bodies as the user owning the given access token, optionally scoped to a single room. Synapse enforces the user's visibility, so only rooms the user can see are searched. Uses the/_matrix/client/v3/searchendpoint (room_events category), ordered by recency.An edited message is stored by Matrix as an additional
m.room.messageevent (m.relates_to.rel_type = m.replace) whose fallback body repeats the text, so Synapse returns both the original and every edit as separate hits. Each edit is therefore folded back onto the event it replaces, redacted events are dropped, and the hits are de-duplicated by event id, so one message counts once and each hit points at an event the client actually renders.- Parameters:
query- the free-text search termroomIdLocalPart- the room local part to scope the search to, ornull/blank to search across all of the user's roomslimit- the maximum number of hits to returnaccessToken- the requesting user's Matrix access token- Returns:
- the matching messages, most recent first, each carrying its room id, one entry per message
- Throws:
IOExceptionInterruptedExceptionorg.exoplatform.ws.frameworks.json.impl.JsonException
-
sendMessage
public String sendMessage(String matrixRoomId, String text, String transactionId, String accessToken) throws IOException, InterruptedException, org.exoplatform.ws.frameworks.json.impl.JsonException Sends a textual message to a room as the user owning the given access token, using the Matrix client API. Synapse enforces that the user is allowed to send to the room.- Parameters:
matrixRoomId- the room local part (without the server name suffix)text- the plain text message bodytransactionId- a unique client transaction id (for idempotency)accessToken- the requesting user's Matrix access token- Returns:
- the created event id
- Throws:
IOExceptionInterruptedExceptionorg.exoplatform.ws.frameworks.json.impl.JsonException
-
sendMessage
public String sendMessage(String matrixRoomId, org.json.JSONObject content, String transactionId, String accessToken, Duration timeout) throws IOException, InterruptedException, org.exoplatform.ws.frameworks.json.impl.JsonException Sends a message built by the caller to a room as the user owning the given access token, the request bounded bytimeout: a timeout or a transport failure is thrown. The content is sent as is, so a reply, its HTML body and its mentions travel exactly as the caller shaped them.- Parameters:
matrixRoomId- the room local part (without the server name suffix)content- them.room.messagecontenttransactionId- a client transaction id; the same id for the same room and user makes a retry idempotentaccessToken- the requesting user's Matrix access tokentimeout- the request timeout- Returns:
- the created event id
- Throws:
IOException- when the request fails or times outInterruptedException- when the request is interruptedorg.exoplatform.ws.frameworks.json.impl.JsonException- when the response cannot be parsed
-
sendReadReceipt
public void sendReadReceipt(String matrixRoomId, String eventId, String accessToken) throws IOException, InterruptedException Posts anm.readreceipt on behalf of a user: a Matrix read receipt is a high-water mark, everything up to the event becomes read.- Parameters:
matrixRoomId- the room local ideventId- the event read up toaccessToken- the user's Matrix access token- Throws:
IOExceptionInterruptedException
-
invalidateAccessToken
Invalidates an access token on Matrix server- Parameters:
accessToken-- Returns:
- Throws:
IOExceptionInterruptedException
-
getMediaInfo
public Optional<MediaInfo> getMediaInfo(String mediaId, String accessToken) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
deleteMedia
public HttpResponse<String> deleteMedia(String mediaId, String accessToken) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-