From 4f044de79ec2ab2ecadcd56d4aea35d2a055fc1c Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 26 Jun 2019 15:48:39 +0200 Subject: [PATCH] add jsdocs --- src/base-apis.js | 11 ++++++++++- src/client.js | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/base-apis.js b/src/base-apis.js index 3b0238a21..59d73dc87 100644 --- a/src/base-apis.js +++ b/src/base-apis.js @@ -438,7 +438,16 @@ MatrixBaseApis.prototype.createRoom = function(options, callback) { callback, "POST", "/createRoom", undefined, options, ); }; - +/** + * Fetches relations for a given event + * @param {string} roomId the room of the event + * @param {string} eventId the id of the event + * @param {string} relationType the rel_type of the relations requested + * @param {string} eventType the event type of the relations requested + * @param {Object} opts options with optional values for the request. + * @param {Object} opts.from the pagination token returned from a previous request as `next_batch` to return following relations. + * @return {Object} the response, with chunk and next_batch. + */ MatrixBaseApis.prototype.fetchRelations = async function(roomId, eventId, relationType, eventType, opts) { const queryParams = {}; diff --git a/src/client.js b/src/client.js index 1f0f43266..2c9694ef7 100644 --- a/src/client.js +++ b/src/client.js @@ -3965,6 +3965,16 @@ MatrixClient.prototype.getCanResetTimelineCallback = function() { return this._canResetTimelineCallback; }; +/** + * Returns relations for a given event + * @param {string} roomId the room of the event + * @param {string} eventId the id of the event + * @param {string} relationType the rel_type of the relations requested + * @param {string} eventType the event type of the relations requested + * @param {Object} opts options with optional values for the request. + * @param {Object} opts.from the pagination token returned from a previous request as `nextBatch` to return following relations. + * @return {Object} an object with `events` as `MatrixEvent[]` and optionally `nextBatch` if more relations are available. + */ MatrixClient.prototype.relations = async function(roomId, eventId, relationType, eventType, opts = {}) { const result = await this.fetchRelations(