Skip to content

Commit 4c39ce8

Browse files
authored
Add method to fetch the MSC3266 Room Summary of a Room (#1988)
1 parent 94ff0ea commit 4c39ce8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: src/client.ts

+20
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,12 @@ interface IThirdPartyUser {
671671
protocol: string;
672672
fields: object;
673673
}
674+
675+
interface IRoomSummary extends Omit<IPublicRoomsChunkRoom, "canonical_alias" | "aliases"> {
676+
room_type?: RoomType;
677+
membership?: string;
678+
is_encrypted: boolean;
679+
}
674680
/* eslint-enable camelcase */
675681

676682
/**
@@ -8521,6 +8527,20 @@ export class MatrixClient extends EventEmitter {
85218527
public supportsExperimentalThreads(): boolean {
85228528
return this.clientOpts?.experimentalThreadSupport || false;
85238529
}
8530+
8531+
/**
8532+
* Fetches the summary of a room as defined by an initial version of MSC3266 and implemented in Synapse
8533+
* Proposed at https://github.com/matrix-org/matrix-doc/pull/3266
8534+
* @param {string} roomIdOrAlias The ID or alias of the room to get the summary of.
8535+
* @param {string[]?} via The list of servers which know about the room if only an ID was provided.
8536+
*/
8537+
public async getRoomSummary(roomIdOrAlias: string, via?: string[]): Promise<IRoomSummary> {
8538+
const path = utils.encodeUri("/rooms/$roomid/summary", { $roomid: roomIdOrAlias });
8539+
return this.http.authedRequest(undefined, "GET", path, { via }, null, {
8540+
qsStringifyOptions: { arrayFormat: 'repeat' },
8541+
prefix: "/_matrix/client/unstable/im.nheko.summary",
8542+
});
8543+
}
85248544
}
85258545

85268546
/**

0 commit comments

Comments
 (0)