You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-12-04 05:02:41 +03:00
Merge branch 'develop' into push-rules-settings
# Conflicts: # lib/sync.js
This commit is contained in:
@@ -191,6 +191,17 @@ MatrixClient.prototype.getIdentityServerUrl = function() {
|
||||
return this.idBaseUrl;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the domain for this client's MXID
|
||||
* @return {?string} Domain of this MXID
|
||||
*/
|
||||
MatrixClient.prototype.getDomain = function() {
|
||||
if (this.credentials && this.credentials.userId) {
|
||||
return this.credentials.userId.replace(/^.*?:/, '');
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the access token associated with this account.
|
||||
* @return {?String} The access_token or null
|
||||
@@ -201,7 +212,7 @@ MatrixClient.prototype.getAccessToken = function() {
|
||||
|
||||
/**
|
||||
* Get the local part of the current user ID e.g. "foo" in "@foo:bar".
|
||||
* @return {?String} The user ID localpart or null.
|
||||
* @return {?string} The user ID localpart or null.
|
||||
*/
|
||||
MatrixClient.prototype.getUserIdLocalpart = function() {
|
||||
if (this.credentials && this.credentials.userId) {
|
||||
@@ -597,6 +608,14 @@ MatrixClient.prototype.getUser = function(userId) {
|
||||
return this.store.getUser(userId);
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve all known users.
|
||||
* @return {User[]} A list of users, or an empty list if there is no data store.
|
||||
*/
|
||||
MatrixClient.prototype.getUsers = function() {
|
||||
return this.store.getUsers();
|
||||
};
|
||||
|
||||
// Room operations
|
||||
// ===============
|
||||
|
||||
@@ -742,6 +761,43 @@ MatrixClient.prototype.deleteRoomTag = function(roomId, tagName, callback) {
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} eventType 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.setAccountData = function(eventType, content, callback) {
|
||||
var path = utils.encodeUri("/user/$userId/account_data/$type", {
|
||||
$userId: this.credentials.userId,
|
||||
$type: eventType,
|
||||
});
|
||||
return this._http.authedRequestWithPrefix(
|
||||
callback, "PUT", path, undefined, content, httpApi.PREFIX_V2_ALPHA
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} roomId
|
||||
* @param {string} eventType 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
|
||||
@@ -1410,6 +1466,23 @@ MatrixClient.prototype.createAlias = function(alias, roomId, callback) {
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete an alias to room ID mapping. This alias must be on your local server
|
||||
* and you must have sufficient access to do this operation.
|
||||
* @param {string} alias The room alias to delete.
|
||||
* @param {module:client.callback} callback Optional.
|
||||
* @return {module:client.Promise} Resolves: TODO.
|
||||
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
||||
*/
|
||||
MatrixClient.prototype.deleteAlias = function(alias, callback) {
|
||||
var path = utils.encodeUri("/directory/room/$alias", {
|
||||
$alias: alias
|
||||
});
|
||||
return this._http.authedRequest(
|
||||
callback, "DELETE", path, undefined, undefined
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get room info for the given alias.
|
||||
* @param {string} alias The room alias to resolve.
|
||||
@@ -1810,7 +1883,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");
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2973,7 +3046,12 @@ MatrixClient.prototype.requestEmailToken = function(email, clientSecret,
|
||||
return this._http.idServerRequest(
|
||||
callback, "POST", "/validate/email/requestToken",
|
||||
params, httpApi.PREFIX_IDENTITY_V1
|
||||
);
|
||||
).then(function(res) {
|
||||
if (typeof res === "string") {
|
||||
return JSON.parse(res);
|
||||
}
|
||||
return res;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user