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

Add methods to get (and set) pushers

This commit is contained in:
David Baker
2016-04-12 13:11:00 +01:00
parent c21d5634bb
commit cff7c8a59f

View File

@@ -1904,6 +1904,38 @@ MatrixClient.prototype.setPresence = function(presence, callback) {
);
};
// Pushers
// =======
/**
* 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 {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixClient.prototype.getPushers = function(callback) {
var path = "/pushers";
return this._http.authedRequest(
callback, "GET", path, undefined, undefined
);
};
/**
* Adds a new pusher or updates an existing pusher
*
* @param {Object} pusher Object representing a pusher
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: Empty json object on success
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixClient.prototype.setPusher = function(pusher, callback) {
var path = "/pushers/set";
return this._http.authedRequest(
callback, "POST", path, null, pusher
);
};
// Public (non-authed) operations
// ==============================