node-red-contrib-matrix-cha.../src/matrix-room-users.html
Skylar Sadlier 4bd2dce434 - Docs for various nodes updated (closes #9)
- Fixed some nodes not matching how their docs describe how they function (such as node configuration should always take precedence over inputs)
2021-09-02 10:51:47 -06:00

81 lines
3.7 KiB
HTML

<script type="text/javascript">
RED.nodes.registerType('matrix-room-users',{
category: 'matrix',
color: '#00b7ca',
icon: "matrix.png",
outputLabels: ["success", "error"],
inputs:1,
outputs:2,
defaults: {
name: { value: null },
server: { value: "", type: "matrix-server-config" },
roomId: { value: "" }
},
label: function() {
return this.name || "Room User List";
},
paletteLabel: 'Room User List'
});
</script>
<script type="text/html" data-template-name="matrix-room-users">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-server"><i class="fa fa-user"></i> Matrix Server Config</label>
<input type="text" id="node-input-server">
</div>
<div class="form-row">
<label for="node-input-server"><i class="fa fa-user"></i> Room Id</label>
<input type="text" id="node-input-roomId" placeholder="msg.topic">
</div>
<div class="form-tips">
This only works on Synapse servers. The user also must be an administrator.
</div>
</script>
<script type="text/html" data-help-name="matrix-room-users">
<h3>Details</h3>
<p>This node returns a map of MXIDs to member info objects for members of the room. The current user must be in the room for it to work, unless it is an Application Service in which case any of the AS's users must be in the room. This API is primarily for Application Services and should be faster to respond than /members as it can be implemented more efficiently on the server.</p>
<a href="https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-rooms-roomid-joined-members" target="_blank">Matrix API Endpoint Information</a>
<h3>Inputs</h3>
<dl class="message-properties">
<dt class="optional">msg.topic
<span class="property-type">integer</span>
</dt>
<dd> Room ID to get member list from. Ignored if configured on the node, otherwise it's required.</dd>
</dl>
<h3>Outputs</h3>
<ol class="node-ports">
<li>Success
<dl class="message-properties">
<dt>msg.payload <span class="property-type">object</span></dt>
<dd>the response object from the server.</dd>
<dt>msg.payload.joined <span class="property-type">object</span></dt>
<dd>A map from user ID to a RoomMember object. The key of each item is the <code>userId</code>. <a href="https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-rooms-roomid-joined-members" target="_blank">Click here</a> for details on what this contains (or do a test and dump the output).</dd>
<dt>msg.payload.joined.[userId].display_name <span class="property-type">string</span></dt>
<dd>The display name of the user this object is representing.</dd>
<dt>msg.payload.joined.[userId].avatar_url <span class="property-type">string</span></dt>
<dd>The mxc avatar url of the user this object is representing.</dd>
</dl>
</li>
<li>Error
<dl class="message-properties">
<dt>msg.error <span class="property-type">string</span></dt>
<dd>the error that occurred.</dd>
</dl>
</li>
</ol>
<h3>References</h3>
<ul>
<li><a href="https://matrix-org.github.io/synapse/develop/admin_api/user_admin_api.html#list-accounts">Matrix Docs</a> - List Accounts API method information</li>
</ul>
</script>