From 13fcff9688cc1ecb772f1b0fcf63d213621bc09c Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 18 Dec 2015 16:23:48 +0000 Subject: [PATCH] Allow passing a next_batch token into /search for backfill --- lib/client.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index 50bec8400..503e3b05c 100644 --- a/lib/client.js +++ b/lib/client.js @@ -2098,14 +2098,19 @@ MatrixClient.prototype.searchMessageText = function(opts, callback) { /** * Perform a server-side search. * @param {Object} opts + * @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 {module:http-api.MatrixError} Rejects: with an error response. */ MatrixClient.prototype.search = function(opts, callback) { + var queryparams = {}; + if (opts.next_batch) { + queryparams.next_batch = opts.next_batch; + } return this._http.authedRequest( - callback, "POST", "/search", undefined, opts.body + callback, "POST", "/search", queryparams, opts.body ); };