From b14759a27b29f79064244c9ca8d2dda60bb91b42 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 4 Aug 2022 17:15:16 -0400 Subject: [PATCH] Add `room_types` and `room_type` to `/publicRooms` (#1199) MSC: https://github.com/matrix-org/matrix-spec-proposals/pull/3827 Incorporates https://github.com/matrix-org/matrix-spec-proposals/pull/3858 --- .../client_server/newsfragments/1199.feature | 1 + .../definitions/public_rooms_chunk.yaml | 5 +++++ .../definitions/public_rooms_response.yaml | 3 ++- data/api/client-server/list_public_rooms.yaml | 17 +++++++++++++--- data/api/client-server/space_hierarchy.yaml | 1 + data/api/server-server/public_rooms.yaml | 20 +++++++++++++++---- 6 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 changelogs/client_server/newsfragments/1199.feature diff --git a/changelogs/client_server/newsfragments/1199.feature b/changelogs/client_server/newsfragments/1199.feature new file mode 100644 index 000000000..ca32e966b --- /dev/null +++ b/changelogs/client_server/newsfragments/1199.feature @@ -0,0 +1 @@ +Add `room_types` filter and `room_type` response to `/publicRooms`, as per [MSC3827](https://github.com/matrix-org/matrix-spec-proposals/pull/3827). \ No newline at end of file diff --git a/data/api/client-server/definitions/public_rooms_chunk.yaml b/data/api/client-server/definitions/public_rooms_chunk.yaml index ff563a3c5..9c6ae6fcb 100644 --- a/data/api/client-server/definitions/public_rooms_chunk.yaml +++ b/data/api/client-server/definitions/public_rooms_chunk.yaml @@ -57,6 +57,11 @@ properties: The room's join rule. When not present, the room is assumed to be `public`. example: "public" + room_type: + type: string + x-addedInMatrixVersion: "1.4" + description: |- + The `type` of room (from [`m.room.create`](/client-server-api/#mroomcreate)), if any. required: - room_id - num_joined_members diff --git a/data/api/client-server/definitions/public_rooms_response.yaml b/data/api/client-server/definitions/public_rooms_response.yaml index 23f38eff3..ba2b712c9 100644 --- a/data/api/client-server/definitions/public_rooms_response.yaml +++ b/data/api/client-server/definitions/public_rooms_response.yaml @@ -62,7 +62,8 @@ example: { "room_id": "!ol19s:bleecker.street", "topic": "Tasty tasty cheese", "world_readable": true, - "join_rule": "public" + "join_rule": "public", + "room_type": "m.space" } ], "next_batch": "p190q", diff --git a/data/api/client-server/list_public_rooms.yaml b/data/api/client-server/list_public_rooms.yaml index b702f1bff..6391bbbda 100644 --- a/data/api/client-server/list_public_rooms.yaml +++ b/data/api/client-server/list_public_rooms.yaml @@ -198,8 +198,18 @@ paths: generic_search_term: type: string description: |- - A string to search for in the room metadata, e.g. name, - topic, canonical alias etc. (Optional). + An optional string to search for in the room metadata, e.g. name, + topic, canonical alias, etc. + room_types: + type: array + x-addedInMatrixVersion: "1.4" + items: + type: string + description: |- + An optional list of [room types](/client-server-api/#types) to search + for. To include rooms without a room type, specify `null` within this + list. When not specified, all applicable rooms (regardless of type) + are returned. include_all_networks: type: boolean description: |- @@ -215,7 +225,8 @@ paths: example: { "limit": 10, "filter": { - "generic_search_term": "foo" + "generic_search_term": "foo", + "room_types": [null, "m.space"] }, "include_all_networks": false, "third_party_instance_id": "irc" diff --git a/data/api/client-server/space_hierarchy.yaml b/data/api/client-server/space_hierarchy.yaml index 91bf67c9f..9469d0c1b 100644 --- a/data/api/client-server/space_hierarchy.yaml +++ b/data/api/client-server/space_hierarchy.yaml @@ -129,6 +129,7 @@ paths: - type: object title: ChildRoomsChunk properties: + # Override x-addedInMatrixVersion for room_type (this endpoint had it first) room_type: type: string description: |- diff --git a/data/api/server-server/public_rooms.yaml b/data/api/server-server/public_rooms.yaml index ba949bcc8..c65a649a3 100644 --- a/data/api/server-server/public_rooms.yaml +++ b/data/api/server-server/public_rooms.yaml @@ -110,8 +110,18 @@ paths: generic_search_term: type: string description: |- - A string to search for in the room metadata, e.g. name, - topic, canonical alias etc. (Optional). + An optional string to search for in the room metadata, e.g. name, + topic, canonical alias, etc. + room_types: + type: array + x-addedInMatrixVersion: "1.4" + items: + type: string + description: |- + An optional list of [room types](/client-server-api/#types) to search + for. To include rooms without a room type, specify `null` within this + list. When not specified, all applicable rooms (regardless of type) + are returned. include_all_networks: type: boolean description: |- @@ -127,7 +137,8 @@ paths: example: { "limit": 10, "filter": { - "generic_search_term": "foo" + "generic_search_term": "foo", + "room_types": [null, "m.space"] }, "include_all_networks": false, "third_party_instance_id": "irc" @@ -185,7 +196,8 @@ paths: "room_id": "!ol19s:bleecker.street", "topic": "Tasty tasty cheese", "world_readable": true, - "join_rule": "public" + "join_rule": "public", + "room_type": "m.space" } ], "next_batch": "p190q",