1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Merge pull request #694 from matrix-org/hs/fetch-room-event-api

Api to fetch events via /room/.../event/..
This commit is contained in:
Bruno Windels
2018-08-21 14:39:14 +02:00
committed by GitHub

View File

@@ -417,6 +417,25 @@ MatrixBaseApis.prototype.roomState = function(roomId, callback) {
return this._http.authedRequest(callback, "GET", path); return this._http.authedRequest(callback, "GET", path);
}; };
/**
* Get an event in a room by its event id.
* @param {string} roomId
* @param {string} eventId
* @param {module:client.callback} callback Optional.
*
* @return {Promise} Resolves to an object containing the event.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.fetchRoomEvent = function(roomId, eventId, callback) {
const path = utils.encodeUri(
"/rooms/$roomId/event/$eventId", {
$roomId: roomId,
$eventId: eventId,
},
);
return this._http.authedRequest(callback, "GET", path);
};
/** /**
* @param {string} roomId * @param {string} roomId
* @param {string} includeMembership the membership type to include in the response * @param {string} includeMembership the membership type to include in the response