diff --git a/lib/client.js b/lib/client.js index c984b5295..7bdce24b4 100644 --- a/lib/client.js +++ b/lib/client.js @@ -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 // ==============================