You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
Expose getPresence endpoint
This commit is contained in:
@@ -521,4 +521,19 @@ describe("MatrixClient", function() {
|
|||||||
xit("should be able to peek into a room using peekInRoom", function(done) {
|
xit("should be able to peek into a room using peekInRoom", function(done) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("getPresence", function() {
|
||||||
|
it("should send a presence HTTP GET", function() {
|
||||||
|
httpLookups = [{
|
||||||
|
method: "GET",
|
||||||
|
path: `/presence/${encodeURIComponent(userId)}/status`,
|
||||||
|
data: {
|
||||||
|
"presence": "unavailable",
|
||||||
|
"last_active_ago": 420845,
|
||||||
|
},
|
||||||
|
}];
|
||||||
|
client.getPresence(userId);
|
||||||
|
expect(httpLookups.length).toEqual(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3841,6 +3841,19 @@ MatrixClient.prototype.setPresence = function(opts, callback) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} userId The user to get presence for
|
||||||
|
* @param {module:client.callback} callback Optional.
|
||||||
|
* @return {Promise} Resolves: The presence state for this user.
|
||||||
|
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
||||||
|
*/
|
||||||
|
MatrixClient.prototype.getPresence = function(userId, callback) {
|
||||||
|
const path = utils.encodeUri("/presence/$userId/status", {
|
||||||
|
$userId: userId,
|
||||||
|
});
|
||||||
|
|
||||||
|
return this._http.authedRequest(callback, "GET", path, undefined, undefined);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve older messages from the given room and put them in the timeline.
|
* Retrieve older messages from the given room and put them in the timeline.
|
||||||
|
|||||||
Reference in New Issue
Block a user