From 7f590af0b5dfdc536ad6669bdac2ff5afab25da9 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 30 Nov 2017 10:16:18 +0000 Subject: [PATCH] Add API wrapper for multiple device deletion API (#583) --- src/base-apis.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/base-apis.js b/src/base-apis.js index e3bbbd2bb..20e0e54ab 100644 --- a/src/base-apis.js +++ b/src/base-apis.js @@ -1230,6 +1230,27 @@ MatrixBaseApis.prototype.deleteDevice = function(device_id, auth) { ); }; +/** + * Delete multiple device + * + * @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 {module:http-api.MatrixError} Rejects: with an error response. + */ +MatrixBaseApis.prototype.deleteMultipleDevices = function(devices, auth) { + const body = {devices}; + + if (auth) { + body.auth = auth; + } + + return this._http.authedRequestWithPrefix( + undefined, "POST", "/delete_devices", undefined, body, + httpApi.PREFIX_UNSTABLE, + ); +}; + // Push operations // ===============