new MatrixUser(userId, dataopt, escape)
Construct a Matrix user.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
userId |
string | The user_id of the user. | |
data |
Object |
<optional> |
Serialized data values |
escape |
boolean | [true] Escape the user's localpart. Modify MatrixUser~ESCAPE_DEFAULT to change the default value. |
- Source:
Members
(static) ESCAPE_DEFAULT
- Source:
Methods
escapeUserId()
Make a userId conform to the matrix spec using QP escaping.
Grammar taken from: https://matrix.org/docs/spec/appendices.html#identifier-grammar
- Source:
get(key) → {*}
Get the data value for the given key.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | An arbitrary bridge-specific key. |
- Source:
Returns:
Stored data for this key. May be undefined.
- Type
- *
getDisplayName() → (nullable) {string}
Get the display name for this Matrix user.
- Source:
Returns:
The display name.
- Type
- string
getId() → {string}
Get the matrix user's ID.
- Source:
Returns:
The user ID
- Type
- string
serialize() → {Object}
Serialize all the data about this user, excluding the user ID.
- Source:
Returns:
The serialised data
- Type
- Object
set(key, val)
Set an arbitrary bridge-specific data value for this user.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | The key to store the data value under. |
val |
* | The data value. This value should be serializable via
JSON.stringify(data) . |
- Source:
setDisplayName(name)
Set the display name for this Matrix user.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The Matrix display name. |
- Source: