Skip to content

Commit

Permalink
Merge pull request #1153 from matrix-org/jryans/cross-signing-setup
Browse files Browse the repository at this point in the history
Add API to get account data from server
  • Loading branch information
jryans authored Jan 16, 2020
2 parents 04bbfae + c5c27b3 commit 8217c0f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1942,6 +1942,25 @@ MatrixClient.prototype.getAccountData = function(eventType) {
return this.store.getAccountData(eventType);
};

/**
* Get account data event of given type for the current user. This variant
* bypasses the local store and gets account data directly from the homeserver,
* which can be useful very early in startup before the initial sync.
* @param {string} eventType The event type
* @return {module:client.Promise} Resolves: The contents of the given account
* data event.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixClient.prototype.getAccountDataFromServer = function(eventType) {
const path = utils.encodeUri("/user/$userId/account_data/$type", {
$userId: this.credentials.userId,
$type: eventType,
});
return this._http.authedRequest(
undefined, "GET", path, undefined,
);
};

/**
* Gets the users that are ignored by this client
* @returns {string[]} The array of users that are ignored (empty if none)
Expand Down

0 comments on commit 8217c0f

Please sign in to comment.