# Copyright 2018, 2021 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

type: object
description: A list of the rooms on the server.
required: ["chunk"]
properties:
  chunk:
    title: "PublicRoomsChunks"
    type: array
    description: |-
      A paginated chunk of public rooms.
    items:
      allOf:
        - $ref: "public_rooms_chunk.yaml"
        - type: object
          properties:
            # Override description of join_rule
            join_rule:
              type: string
              description: |-
                The room's join rule. When not present, the room is assumed to
                be `public`. Note that rooms with `invite` join rules are not
                expected here, but rooms with `knock` rules are given their
                near-public nature.
              example: "public"
  next_batch:
    type: string
    description: |-
      A pagination token for the response. The absence of this token
      means there are no more results to fetch and the client should
      stop paginating.
  prev_batch:
    type: string
    description: |-
      A pagination token that allows fetching previous results. The
      absence of this token means there are no results before this
      batch, i.e. this is the first batch.
  total_room_count_estimate:
    type: integer
    description: |-
        An estimate on the total number of public rooms, if the
        server has an estimate.
example: {
  "chunk": [
    {
      "avatar_url": "mxc://bleecker.street/CHEDDARandBRIE",
      "guest_can_join": false,
      "name": "CHEESE",
      "num_joined_members": 37,
      "room_id": "!ol19s:bleecker.street",
      "topic": "Tasty tasty cheese",
      "world_readable": true,
      "join_rule": "public"
    }
  ],
  "next_batch": "p190q",
  "prev_batch": "p1902",
  "total_room_count_estimate": 115
}
