You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
implement account data
This commit is contained in:
@@ -722,6 +722,42 @@ MatrixClient.prototype.deleteRoomTag = function(roomId, tagName, callback) {
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {MatrixEvent} account_data event
|
||||
* @param {string} event type to be set
|
||||
* @param {object} content event content
|
||||
* @return {module:client.Promise} Resolves: TODO
|
||||
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
||||
*/
|
||||
MatrixClient.prototype.setAccountData = function(event, eventType, content) {
|
||||
var path = utils.encodeUri("/user/$userId/account_data/$type", {
|
||||
$userId: this.credentials.userId,
|
||||
$type: event.getType(),
|
||||
});
|
||||
return this._http.authedRequestWithPrefix(
|
||||
callback, "PUT", path, undefined, content, httpApi.PREFIX_V2_ALPHA
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} roomId
|
||||
* @param {string} event type to be set
|
||||
* @param {object} content event content
|
||||
* @param {module:client.callback} callback Optional.
|
||||
* @return {module:client.Promise} Resolves: TODO
|
||||
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
||||
*/
|
||||
MatrixClient.prototype.setRoomAccountData = function(roomId, eventType, content, callback) {
|
||||
var path = utils.encodeUri("/user/$userId/rooms/$roomId/account_data/$type", {
|
||||
$userId: this.credentials.userId,
|
||||
$roomId: roomId,
|
||||
$type: eventType,
|
||||
});
|
||||
return this._http.authedRequestWithPrefix(
|
||||
callback, "PUT", path, undefined, content, httpApi.PREFIX_V2_ALPHA
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Set a user's power level.
|
||||
* @param {string} roomId
|
||||
@@ -1782,7 +1818,7 @@ MatrixClient.prototype.setPresence = function(presence, callback) {
|
||||
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
||||
*/
|
||||
MatrixClient.prototype.publicRooms = function(callback) {
|
||||
return this._http.request(callback, "GET", "/publicRooms");
|
||||
return this._http.authedRequest(callback, "GET", "/publicRooms");
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user