# Copyright 2016 OpenMarket Ltd
#
# 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
title: Filter
properties:
  event_fields:
    description: List of event fields to include. If this list is absent then all
      fields are included. The entries are [dot-separated paths for each property](/appendices#dot-separated-property-paths)
      to include. So ['content.body'] will include the 'body' field of the 'content' object.
      A server may include more fields than were requested.
    items:
      type: string
    type: array
  event_format:
    description: The format to use for events. 'client' will return the events in
      a format suitable for clients. 'federation' will return the raw event as received
      over federation. The default is 'client'.
    enum:
    - client
    - federation
    type: string
  presence:
    allOf:
    - $ref: event_filter.yaml
    description: The presence updates to include.
  account_data:
    allOf:
    - $ref: event_filter.yaml
    description: The user account data that isn't associated with rooms to include.
  room:
    title: RoomFilter
    description: Filters to be applied to room data.
    type: object
    properties:
      not_rooms:
        description: A list of room IDs to exclude. If this list is absent then no rooms
          are excluded. A matching room will be excluded even if it is listed in the `'rooms'`
          filter. This filter is applied before the filters in `ephemeral`,
          `state`, `timeline` or `account_data`
        items:
          type: string
        type: array
      rooms:
        description: A list of room IDs to include. If this list is absent then all rooms
          are included. This filter is applied before the filters in `ephemeral`,
          `state`, `timeline` or `account_data`
        items:
          type: string
        type: array
      ephemeral:
        allOf:
        - $ref: room_event_filter.yaml
        description: The ephemeral events to include for rooms. These are the
          events that appear in the `ephemeral` property in the `/sync`
          response.
      include_leave:
        description: Include rooms that the user has left in the sync, default false
        type: boolean
      state:
        type: object
        title: StateFilter
        allOf:
        - $ref: room_event_filter.yaml
        description: The state events to include for rooms.
      timeline:
        allOf:
        - $ref: room_event_filter.yaml
        description: The message and state update events to include for rooms.
      account_data:
        allOf:
        - $ref: room_event_filter.yaml
        description: The per user account data to include for rooms.
