1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

chore: remove custom promise, use es6 standard

Signed-off-by: Jack Works <jackworks@protonmail.com>
This commit is contained in:
Jack Works
2020-01-22 11:00:15 +08:00
committed by Travis Ralston
parent 7c79e7e836
commit 468fb2cc41
11 changed files with 190 additions and 201 deletions

View File

@@ -172,7 +172,7 @@ MatrixBaseApis.prototype.makeTxnId = function() {
* Check whether a username is available prior to registration. An error response
* indicates an invalid/unavailable username.
* @param {string} username The username to check the availability of.
* @return {module:client.Promise} Resolves: to `true`.
* @return {Promise} Resolves: to `true`.
*/
MatrixBaseApis.prototype.isUsernameAvailable = function(username) {
return this._http.authedRequest(
@@ -193,7 +193,7 @@ MatrixBaseApis.prototype.isUsernameAvailable = function(username) {
* @param {string} guestAccessToken
* @param {string} inhibitLogin
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.register = function(
@@ -258,7 +258,7 @@ MatrixBaseApis.prototype.register = function(
* @param {Object=} opts Registration options
* @param {Object} opts.body JSON HTTP body to provide.
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.registerGuest = function(opts, callback) {
@@ -271,7 +271,7 @@ MatrixBaseApis.prototype.registerGuest = function(opts, callback) {
* @param {Object} data parameters for registration request
* @param {string=} kind type of user to register. may be "guest"
* @param {module:client.callback=} callback
* @return {module:client.Promise} Resolves: to the /register response
* @return {Promise} Resolves: to the /register response
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.registerRequest = function(data, kind, callback) {
@@ -287,7 +287,7 @@ MatrixBaseApis.prototype.registerRequest = function(data, kind, callback) {
/**
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.loginFlows = function(callback) {
@@ -298,7 +298,7 @@ MatrixBaseApis.prototype.loginFlows = function(callback) {
* @param {string} loginType
* @param {Object} data
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.login = function(loginType, data, callback) {
@@ -329,7 +329,7 @@ MatrixBaseApis.prototype.login = function(loginType, data, callback) {
* @param {string} user
* @param {string} password
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.loginWithPassword = function(user, password, callback) {
@@ -342,7 +342,7 @@ MatrixBaseApis.prototype.loginWithPassword = function(user, password, callback)
/**
* @param {string} relayState URL Callback after SAML2 Authentication
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.loginWithSAML2 = function(relayState, callback) {
@@ -379,7 +379,7 @@ MatrixBaseApis.prototype.getSsoLoginUrl = function(redirectUrl, loginType) {
/**
* @param {string} token Login token previously received from homeserver
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.loginWithToken = function(token, callback) {
@@ -396,7 +396,7 @@ MatrixBaseApis.prototype.loginWithToken = function(token, callback) {
* it is up to the caller to either reset or destroy the MatrixClient after
* this method succeeds.
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: On success, the empty object
* @return {Promise} Resolves: On success, the empty object
*/
MatrixBaseApis.prototype.logout = function(callback) {
return this._http.authedRequest(
@@ -414,7 +414,7 @@ MatrixBaseApis.prototype.logout = function(callback) {
* @param {boolean} erase Optional. If set, send as `erase` attribute in the
* JSON request body, indicating whether the account should be erased. Defaults
* to false.
* @return {module:client.Promise} Resolves: On success, the empty object
* @return {Promise} Resolves: On success, the empty object
*/
MatrixBaseApis.prototype.deactivateAccount = function(auth, erase) {
if (typeof(erase) === 'function') {
@@ -467,7 +467,7 @@ MatrixBaseApis.prototype.getFallbackAuthUrl = function(loginType, authSessionId)
* @param {string} options.name The name to give this room.
* @param {string} options.topic The topic to give this room.
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: <code>{room_id: {string},
* @return {Promise} Resolves: <code>{room_id: {string},
* room_alias: {string(opt)}}</code>
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
@@ -512,7 +512,7 @@ MatrixBaseApis.prototype.fetchRelations =
/**
* @param {string} roomId
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.roomState = function(roomId, callback) {
@@ -545,7 +545,7 @@ MatrixBaseApis.prototype.fetchRoomEvent = function(roomId, eventId, callback) {
* @param {string} excludeMembership the membership type to exclude from the response
* @param {string} atEventId the id of the event for which moment in the timeline the members should be returned for
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: dictionary of userid to profile information
* @return {Promise} Resolves: dictionary of userid to profile information
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.members =
@@ -572,7 +572,7 @@ function(roomId, includeMembership, excludeMembership, atEventId, callback) {
* Upgrades a room to a new protocol version
* @param {string} roomId
* @param {string} newVersion The target version to upgrade to
* @return {module:client.Promise} Resolves: Object with key 'replacement_room'
* @return {Promise} Resolves: Object with key 'replacement_room'
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.upgradeRoom = function(roomId, newVersion) {
@@ -585,7 +585,7 @@ MatrixBaseApis.prototype.upgradeRoom = function(roomId, newVersion) {
/**
* @param {string} groupId
* @return {module:client.Promise} Resolves: Group summary object
* @return {Promise} Resolves: Group summary object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getGroupSummary = function(groupId) {
@@ -595,7 +595,7 @@ MatrixBaseApis.prototype.getGroupSummary = function(groupId) {
/**
* @param {string} groupId
* @return {module:client.Promise} Resolves: Group profile object
* @return {Promise} Resolves: Group profile object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getGroupProfile = function(groupId) {
@@ -610,7 +610,7 @@ MatrixBaseApis.prototype.getGroupProfile = function(groupId) {
* @param {string=} profile.avatar_url MXC avatar URL
* @param {string=} profile.short_description A short description of the room
* @param {string=} profile.long_description A longer HTML description of the room
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.setGroupProfile = function(groupId, profile) {
@@ -626,7 +626,7 @@ MatrixBaseApis.prototype.setGroupProfile = function(groupId, profile) {
* least a 'type' field which is 'open' if anyone can join the group
* the group without prior approval, or 'invite' if an invite is
* required to join.
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.setGroupJoinPolicy = function(groupId, policy) {
@@ -643,7 +643,7 @@ MatrixBaseApis.prototype.setGroupJoinPolicy = function(groupId, policy) {
/**
* @param {string} groupId
* @return {module:client.Promise} Resolves: Group users list object
* @return {Promise} Resolves: Group users list object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getGroupUsers = function(groupId) {
@@ -653,7 +653,7 @@ MatrixBaseApis.prototype.getGroupUsers = function(groupId) {
/**
* @param {string} groupId
* @return {module:client.Promise} Resolves: Group users list object
* @return {Promise} Resolves: Group users list object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getGroupInvitedUsers = function(groupId) {
@@ -663,7 +663,7 @@ MatrixBaseApis.prototype.getGroupInvitedUsers = function(groupId) {
/**
* @param {string} groupId
* @return {module:client.Promise} Resolves: Group rooms list object
* @return {Promise} Resolves: Group rooms list object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getGroupRooms = function(groupId) {
@@ -674,7 +674,7 @@ MatrixBaseApis.prototype.getGroupRooms = function(groupId) {
/**
* @param {string} groupId
* @param {string} userId
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.inviteUserToGroup = function(groupId, userId) {
@@ -688,7 +688,7 @@ MatrixBaseApis.prototype.inviteUserToGroup = function(groupId, userId) {
/**
* @param {string} groupId
* @param {string} userId
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.removeUserFromGroup = function(groupId, userId) {
@@ -703,7 +703,7 @@ MatrixBaseApis.prototype.removeUserFromGroup = function(groupId, userId) {
* @param {string} groupId
* @param {string} userId
* @param {string} roleId Optional.
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.addUserToGroupSummary = function(groupId, userId, roleId) {
@@ -719,7 +719,7 @@ MatrixBaseApis.prototype.addUserToGroupSummary = function(groupId, userId, roleI
/**
* @param {string} groupId
* @param {string} userId
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.removeUserFromGroupSummary = function(groupId, userId) {
@@ -734,7 +734,7 @@ MatrixBaseApis.prototype.removeUserFromGroupSummary = function(groupId, userId)
* @param {string} groupId
* @param {string} roomId
* @param {string} categoryId Optional.
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.addRoomToGroupSummary = function(groupId, roomId, categoryId) {
@@ -750,7 +750,7 @@ MatrixBaseApis.prototype.addRoomToGroupSummary = function(groupId, roomId, categ
/**
* @param {string} groupId
* @param {string} roomId
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.removeRoomFromGroupSummary = function(groupId, roomId) {
@@ -765,7 +765,7 @@ MatrixBaseApis.prototype.removeRoomFromGroupSummary = function(groupId, roomId)
* @param {string} groupId
* @param {string} roomId
* @param {bool} isPublic Whether the room-group association is visible to non-members
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.addRoomToGroup = function(groupId, roomId, isPublic) {
@@ -786,7 +786,7 @@ MatrixBaseApis.prototype.addRoomToGroup = function(groupId, roomId, isPublic) {
* @param {string} groupId
* @param {string} roomId
* @param {bool} isPublic Whether the room-group association is visible to non-members
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.updateGroupRoomVisibility = function(groupId, roomId, isPublic) {
@@ -806,7 +806,7 @@ MatrixBaseApis.prototype.updateGroupRoomVisibility = function(groupId, roomId, i
/**
* @param {string} groupId
* @param {string} roomId
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.removeRoomFromGroup = function(groupId, roomId) {
@@ -820,7 +820,7 @@ MatrixBaseApis.prototype.removeRoomFromGroup = function(groupId, roomId) {
/**
* @param {string} groupId
* @param {Object} opts Additional options to send alongside the acceptance.
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.acceptGroupInvite = function(groupId, opts = null) {
@@ -833,7 +833,7 @@ MatrixBaseApis.prototype.acceptGroupInvite = function(groupId, opts = null) {
/**
* @param {string} groupId
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.joinGroup = function(groupId) {
@@ -846,7 +846,7 @@ MatrixBaseApis.prototype.joinGroup = function(groupId) {
/**
* @param {string} groupId
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.leaveGroup = function(groupId) {
@@ -858,7 +858,7 @@ MatrixBaseApis.prototype.leaveGroup = function(groupId) {
};
/**
* @return {module:client.Promise} Resolves: The groups to which the user is joined
* @return {Promise} Resolves: The groups to which the user is joined
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getJoinedGroups = function() {
@@ -870,7 +870,7 @@ MatrixBaseApis.prototype.getJoinedGroups = function() {
* @param {Object} content Request content
* @param {string} content.localpart The local part of the desired group ID
* @param {Object} content.profile Group profile object
* @return {module:client.Promise} Resolves: Object with key group_id: id of the created group
* @return {Promise} Resolves: Object with key group_id: id of the created group
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.createGroup = function(content) {
@@ -882,7 +882,7 @@ MatrixBaseApis.prototype.createGroup = function(content) {
/**
* @param {string[]} userIds List of user IDs
* @return {module:client.Promise} Resolves: Object as exmaple below
* @return {Promise} Resolves: Object as exmaple below
*
* {
* "users": {
@@ -903,7 +903,7 @@ MatrixBaseApis.prototype.getPublicisedGroups = function(userIds) {
/**
* @param {string} groupId
* @param {bool} isPublic Whether the user's membership of this group is made public
* @return {module:client.Promise} Resolves: Empty object
* @return {Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.setGroupPublicity = function(groupId, isPublic) {
@@ -922,7 +922,7 @@ MatrixBaseApis.prototype.setGroupPublicity = function(groupId, isPublic) {
* @param {string} eventType
* @param {string} stateKey
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getStateEvent = function(roomId, eventType, stateKey, callback) {
@@ -946,7 +946,7 @@ MatrixBaseApis.prototype.getStateEvent = function(roomId, eventType, stateKey, c
* @param {Object} content
* @param {string} stateKey
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.sendStateEvent = function(roomId, eventType, content, stateKey,
@@ -969,7 +969,7 @@ MatrixBaseApis.prototype.sendStateEvent = function(roomId, eventType, content, s
* @param {string} roomId
* @param {Number} limit
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.roomInitialSync = function(roomId, limit, callback) {
@@ -1000,7 +1000,7 @@ MatrixBaseApis.prototype.roomInitialSync = function(roomId, limit, callback) {
* @param {object} opts Options for the read markers.
* @param {object} opts.hidden True to hide the read receipt from other users. <b>This
* property is currently unstable and may change in the future.</b>
* @return {module:client.Promise} Resolves: the empty object, {}.
* @return {Promise} Resolves: the empty object, {}.
*/
MatrixBaseApis.prototype.setRoomReadMarkersHttpRequest =
function(roomId, rmEventId, rrEventId, opts) {
@@ -1020,7 +1020,7 @@ MatrixBaseApis.prototype.setRoomReadMarkersHttpRequest =
};
/**
* @return {module:client.Promise} Resolves: A list of the user's current rooms
* @return {Promise} Resolves: A list of the user's current rooms
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getJoinedRooms = function() {
@@ -1031,7 +1031,7 @@ MatrixBaseApis.prototype.getJoinedRooms = function() {
/**
* Retrieve membership info. for a room.
* @param {string} roomId ID of the room to get membership for
* @return {module:client.Promise} Resolves: A list of currently joined users
* @return {Promise} Resolves: A list of currently joined users
* and their profile data.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
@@ -1055,7 +1055,7 @@ MatrixBaseApis.prototype.getJoinedRoomMembers = function(roomId) {
* @param {object} options.filter Filter parameters
* @param {string} options.filter.generic_search_term String to search for
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.publicRooms = function(options, callback) {
@@ -1087,7 +1087,7 @@ MatrixBaseApis.prototype.publicRooms = function(options, callback) {
* @param {string} alias The room alias to create.
* @param {string} roomId The room ID to link the alias to.
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO.
* @return {Promise} Resolves: TODO.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.createAlias = function(alias, roomId, callback) {
@@ -1107,7 +1107,7 @@ MatrixBaseApis.prototype.createAlias = function(alias, roomId, callback) {
* 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 {Promise} Resolves: TODO.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.deleteAlias = function(alias, callback) {
@@ -1123,7 +1123,7 @@ MatrixBaseApis.prototype.deleteAlias = function(alias, callback) {
* Get room info for the given alias.
* @param {string} alias The room alias to resolve.
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: Object with room_id and servers.
* @return {Promise} Resolves: Object with room_id and servers.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getRoomIdForAlias = function(alias, callback) {
@@ -1139,7 +1139,7 @@ MatrixBaseApis.prototype.getRoomIdForAlias = function(alias, callback) {
/**
* @param {string} roomAlias
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.resolveRoomAlias = function(roomAlias, callback) {
@@ -1152,7 +1152,7 @@ MatrixBaseApis.prototype.resolveRoomAlias = function(roomAlias, callback) {
* Get the visibility of a room in the current HS's room directory
* @param {string} roomId
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getRoomDirectoryVisibility =
@@ -1170,7 +1170,7 @@ MatrixBaseApis.prototype.getRoomDirectoryVisibility =
* in the public directory, or "private" to make
* it invisible.
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: result object
* @return {Promise} Resolves: result object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.setRoomDirectoryVisibility =
@@ -1193,7 +1193,7 @@ MatrixBaseApis.prototype.setRoomDirectoryVisibility =
* in the public directory, or "private" to make
* it invisible.
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: result object
* @return {Promise} Resolves: result object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.setRoomDirectoryVisibilityAppService =
@@ -1216,7 +1216,7 @@ MatrixBaseApis.prototype.setRoomDirectoryVisibilityAppService =
* @param {string} opts.term the term with which to search.
* @param {number} opts.limit the maximum number of results to return. The server will
* apply a limit if unspecified.
* @return {module:client.Promise} Resolves: an array of results.
* @return {Promise} Resolves: an array of results.
*/
MatrixBaseApis.prototype.searchUserDirectory = function(opts) {
const body = {
@@ -1272,7 +1272,7 @@ MatrixBaseApis.prototype.searchUserDirectory = function(opts) {
* data has been uploaded, with an object containing the fields `loaded`
* (number of bytes transferred) and `total` (total size, if known).
*
* @return {module:client.Promise} Resolves to response object, as
* @return {Promise} Resolves to response object, as
* determined by this.opts.onlyData, opts.rawResponse, and
* opts.onlyContentUri. Rejects with an error (usually a MatrixError).
*/
@@ -1282,7 +1282,7 @@ MatrixBaseApis.prototype.uploadContent = function(file, opts) {
/**
* Cancel a file upload in progress
* @param {module:client.Promise} promise The promise returned from uploadContent
* @param {Promise} promise The promise returned from uploadContent
* @return {boolean} true if canceled, otherwise false
*/
MatrixBaseApis.prototype.cancelUpload = function(promise) {
@@ -1310,7 +1310,7 @@ MatrixBaseApis.prototype.getCurrentUploads = function() {
* @param {string} info The kind of info to retrieve (e.g. 'displayname',
* 'avatar_url').
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getProfileInfo = function(userId, info, callback) {
@@ -1332,7 +1332,7 @@ MatrixBaseApis.prototype.getProfileInfo = function(userId, info, callback) {
/**
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getThreePids = function(callback) {
@@ -1352,7 +1352,7 @@ MatrixBaseApis.prototype.getThreePids = function(callback) {
* @param {Object} creds
* @param {boolean} bind
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: on success
* @return {Promise} Resolves: on success
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.addThreePid = function(creds, bind, callback) {
@@ -1375,7 +1375,7 @@ MatrixBaseApis.prototype.addThreePid = function(creds, bind, callback) {
*
* @param {Object} data A object with 3PID validation data from having called
* `account/3pid/<medium>/requestToken` on the homeserver.
* @return {module:client.Promise} Resolves: on success
* @return {Promise} Resolves: on success
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.addThreePidOnly = async function(data) {
@@ -1398,7 +1398,7 @@ MatrixBaseApis.prototype.addThreePidOnly = async function(data) {
* @param {Object} data A object with 3PID validation data from having called
* `validate/<medium>/requestToken` on the identity server. It should also
* contain `id_server` and `id_access_token` fields as well.
* @return {module:client.Promise} Resolves: on success
* @return {Promise} Resolves: on success
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.bindThreePid = async function(data) {
@@ -1418,7 +1418,7 @@ MatrixBaseApis.prototype.bindThreePid = async function(data) {
* @param {string} medium The threepid medium (eg. 'email')
* @param {string} address The threepid address (eg. 'bob@example.com')
* this must be as returned by getThreePids.
* @return {module:client.Promise} Resolves: on success
* @return {Promise} Resolves: on success
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.unbindThreePid = async function(medium, address) {
@@ -1439,7 +1439,7 @@ MatrixBaseApis.prototype.unbindThreePid = async function(medium, address) {
* @param {string} medium The threepid medium (eg. 'email')
* @param {string} address The threepid address (eg. 'bob@example.com')
* this must be as returned by getThreePids.
* @return {module:client.Promise} Resolves: The server response on success
* @return {Promise} Resolves: The server response on success
* (generally the empty JSON object)
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
@@ -1457,7 +1457,7 @@ MatrixBaseApis.prototype.deleteThreePid = function(medium, address) {
* @param {Object} authDict
* @param {string} newPassword The new desired password.
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.setPassword = function(authDict, newPassword, callback) {
@@ -1478,7 +1478,7 @@ MatrixBaseApis.prototype.setPassword = function(authDict, newPassword, callback)
/**
* Gets all devices recorded for the logged-in user
* @return {module:client.Promise} Resolves: result object
* @return {Promise} Resolves: result object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getDevices = function() {
@@ -1492,7 +1492,7 @@ MatrixBaseApis.prototype.getDevices = function() {
*
* @param {string} device_id device to update
* @param {Object} body body of request
* @return {module:client.Promise} Resolves: result object
* @return {Promise} Resolves: result object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.setDeviceDetails = function(device_id, body) {
@@ -1508,7 +1508,7 @@ MatrixBaseApis.prototype.setDeviceDetails = function(device_id, body) {
*
* @param {string} device_id device to delete
* @param {object} auth Optional. Auth data to supply for User-Interactive auth.
* @return {module:client.Promise} Resolves: result object
* @return {Promise} Resolves: result object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.deleteDevice = function(device_id, auth) {
@@ -1530,7 +1530,7 @@ MatrixBaseApis.prototype.deleteDevice = function(device_id, auth) {
*
* @param {string[]} devices IDs of the devices to delete
* @param {object} auth Optional. Auth data to supply for User-Interactive auth.
* @return {module:client.Promise} Resolves: result object
* @return {Promise} Resolves: result object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.deleteMultipleDevices = function(devices, auth) {
@@ -1552,7 +1552,7 @@ MatrixBaseApis.prototype.deleteMultipleDevices = function(devices, auth) {
* Gets all pushers registered for the logged-in user
*
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: Array of objects representing pushers
* @return {Promise} Resolves: Array of objects representing pushers
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getPushers = function(callback) {
@@ -1567,7 +1567,7 @@ MatrixBaseApis.prototype.getPushers = function(callback) {
*
* @param {Object} pusher Object representing a pusher
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: Empty json object on success
* @return {Promise} Resolves: Empty json object on success
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.setPusher = function(pusher, callback) {
@@ -1579,7 +1579,7 @@ MatrixBaseApis.prototype.setPusher = function(pusher, callback) {
/**
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getPushRules = function(callback) {
@@ -1594,7 +1594,7 @@ MatrixBaseApis.prototype.getPushRules = function(callback) {
* @param {string} ruleId
* @param {Object} body
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.addPushRule = function(scope, kind, ruleId, body, callback) {
@@ -1613,7 +1613,7 @@ MatrixBaseApis.prototype.addPushRule = function(scope, kind, ruleId, body, callb
* @param {string} kind
* @param {string} ruleId
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.deletePushRule = function(scope, kind, ruleId, callback) {
@@ -1632,7 +1632,7 @@ MatrixBaseApis.prototype.deletePushRule = function(scope, kind, ruleId, callback
* @param {string} ruleId
* @param {boolean} enabled
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: result object
* @return {Promise} Resolves: result object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.setPushRuleEnabled = function(scope, kind,
@@ -1653,7 +1653,7 @@ MatrixBaseApis.prototype.setPushRuleEnabled = function(scope, kind,
* @param {string} ruleId
* @param {array} actions
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: result object
* @return {Promise} Resolves: result object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.setPushRuleActions = function(scope, kind,
@@ -1677,7 +1677,7 @@ MatrixBaseApis.prototype.setPushRuleActions = function(scope, kind,
* @param {string} opts.next_batch the batch token to pass in the query string
* @param {Object} opts.body the JSON object to pass to the request body.
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.search = function(opts, callback) {
@@ -1703,7 +1703,7 @@ MatrixBaseApis.prototype.search = function(opts, callback) {
*
* @param {module:client.callback=} callback
*
* @return {module:client.Promise} Resolves: result object. Rejects: with
* @return {Promise} Resolves: result object. Rejects: with
* an error response ({@link module:http-api.MatrixError}).
*/
MatrixBaseApis.prototype.uploadKeysRequest = function(content, opts, callback) {
@@ -1729,7 +1729,7 @@ MatrixBaseApis.prototype.uploadKeySignatures = function(content) {
* @param {string=} opts.token sync token to pass in the query request, to help
* the HS give the most recent results
*
* @return {module:client.Promise} Resolves: result object. Rejects: with
* @return {Promise} Resolves: result object. Rejects: with
* an error response ({@link module:http-api.MatrixError}).
*/
MatrixBaseApis.prototype.downloadKeysForUsers = function(userIds, opts) {
@@ -1761,7 +1761,7 @@ MatrixBaseApis.prototype.downloadKeysForUsers = function(userIds, opts) {
*
* @param {string} [key_algorithm = signed_curve25519] desired key type
*
* @return {module:client.Promise} Resolves: result object. Rejects: with
* @return {Promise} Resolves: result object. Rejects: with
* an error response ({@link module:http-api.MatrixError}).
*/
MatrixBaseApis.prototype.claimOneTimeKeys = function(devices, key_algorithm) {
@@ -1790,7 +1790,7 @@ MatrixBaseApis.prototype.claimOneTimeKeys = function(devices, key_algorithm) {
* @param {string} oldToken
* @param {string} newToken
*
* @return {module:client.Promise} Resolves: result object. Rejects: with
* @return {Promise} Resolves: result object. Rejects: with
* an error response ({@link module:http-api.MatrixError}).
*/
MatrixBaseApis.prototype.getKeyChanges = function(oldToken, newToken) {
@@ -1825,7 +1825,7 @@ MatrixBaseApis.prototype.uploadDeviceSigningKeys = function(auth, keys) {
* general) was added as part of the v2 API version.
*
* @param {object} hsOpenIdToken
* @return {module:client.Promise} Resolves: with object containing an Identity
* @return {Promise} Resolves: with object containing an Identity
* Server access token.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
@@ -1861,7 +1861,7 @@ MatrixBaseApis.prototype.registerWithIdentityServer = function(hsOpenIdToken) {
* @param {string} identityAccessToken The `access_token` field of the identity
* server `/account/register` response (see {@link registerWithIdentityServer}).
*
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
* @throws Error if no identity server is set
*/
@@ -1927,7 +1927,7 @@ MatrixBaseApis.prototype.requestEmailToken = async function(
* @param {string} identityAccessToken The `access_token` field of the Identity
* Server `/account/register` response (see {@link registerWithIdentityServer}).
*
* @return {module:client.Promise} Resolves: TODO
* @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
* @throws Error if no identity server is set
*/
@@ -1987,7 +1987,7 @@ MatrixBaseApis.prototype.requestMsisdnToken = async function(
* @param {string} identityAccessToken The `access_token` field of the Identity
* Server `/account/register` response (see {@link registerWithIdentityServer}).
*
* @return {module:client.Promise} Resolves: Object, currently with no parameters.
* @return {Promise} Resolves: Object, currently with no parameters.
* @return {module:http-api.MatrixError} Rejects: with an error response.
* @throws Error if No ID server is set
*/
@@ -2038,7 +2038,7 @@ MatrixBaseApis.prototype.submitMsisdnToken = async function(
* This must be the same value submitted in the requestToken call.
* @param {string} msisdnToken The MSISDN token, as enetered by the user.
*
* @return {module:client.Promise} Resolves: Object, currently with no parameters.
* @return {Promise} Resolves: Object, currently with no parameters.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.submitMsisdnTokenOtherUrl = function(
@@ -2164,7 +2164,7 @@ MatrixBaseApis.prototype.identityHashedLookup = async function(
* @param {string} identityAccessToken The `access_token` field of the Identity
* Server `/account/register` response (see {@link registerWithIdentityServer}).
*
* @return {module:client.Promise} Resolves: A threepid mapping
* @return {Promise} Resolves: A threepid mapping
* object or the empty object if no mapping
* exists
* @return {module:http-api.MatrixError} Rejects: with an error response.
@@ -2232,7 +2232,7 @@ MatrixBaseApis.prototype.lookupThreePid = async function(
* @param {string} identityAccessToken The `access_token` field of the Identity
* Server `/account/register` response (see {@link registerWithIdentityServer}).
*
* @return {module:client.Promise} Resolves: Lookup results from IS.
* @return {Promise} Resolves: Lookup results from IS.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.bulkLookupThreePids = async function(
@@ -2289,7 +2289,7 @@ MatrixBaseApis.prototype.bulkLookupThreePids = async function(
* @param {string} identityAccessToken The `access_token` field of the Identity
* Server `/account/register` response (see {@link registerWithIdentityServer}).
*
* @return {module:client.Promise} Resolves: an object with account info.
* @return {Promise} Resolves: an object with account info.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getIdentityAccount = function(
@@ -2312,7 +2312,7 @@ MatrixBaseApis.prototype.getIdentityAccount = function(
* content to send. Map from user_id to device_id to content object.
* @param {string=} txnId transaction id. One will be made up if not
* supplied.
* @return {module:client.Promise} Resolves to the result object
* @return {Promise} Resolves to the result object
*/
MatrixBaseApis.prototype.sendToDevice = function(
eventType, contentMap, txnId,
@@ -2341,7 +2341,7 @@ MatrixBaseApis.prototype.sendToDevice = function(
/**
* Get the third party protocols that can be reached using
* this HS
* @return {module:client.Promise} Resolves to the result object
* @return {Promise} Resolves to the result object
*/
MatrixBaseApis.prototype.getThirdpartyProtocols = function() {
return this._http.authedRequest(
@@ -2363,7 +2363,7 @@ MatrixBaseApis.prototype.getThirdpartyProtocols = function() {
* @param {string} protocol The protocol given in getThirdpartyProtocols()
* @param {object} params Protocol-specific parameters, as given in the
* response to getThirdpartyProtocols()
* @return {module:client.Promise} Resolves to the result object
* @return {Promise} Resolves to the result object
*/
MatrixBaseApis.prototype.getThirdpartyLocation = function(protocol, params) {
const path = utils.encodeUri("/thirdparty/location/$protocol", {
@@ -2379,7 +2379,7 @@ MatrixBaseApis.prototype.getThirdpartyLocation = function(protocol, params) {
* @param {string} protocol The protocol given in getThirdpartyProtocols()
* @param {object} params Protocol-specific parameters, as given in the
* response to getThirdpartyProtocols()
* @return {module:client.Promise} Resolves to the result object
* @return {Promise} Resolves to the result object
*/
MatrixBaseApis.prototype.getThirdpartyUser = function(protocol, params) {
const path = utils.encodeUri("/thirdparty/user/$protocol", {
@@ -2414,7 +2414,7 @@ MatrixBaseApis.prototype.agreeToTerms = function(
* @param {string} eventId The event to report.
* @param {number} score The score to rate this content as where -100 is most offensive and 0 is inoffensive.
* @param {string} reason The reason the content is being reported. May be blank.
* @returns {module:client.Promise} Resolves to an empty object if successful
* @returns {Promise} Resolves to an empty object if successful
*/
MatrixBaseApis.prototype.reportEvent = function(roomId, eventId, score, reason) {
const path = utils.encodeUri("/rooms/$roomId/report/$eventId", {