# 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.
openapi: 3.1.0
info:
  title: Matrix Client-Server message redaction API
  version: 1.0.0
paths:
  "/rooms/{roomId}/redact/{eventId}/{txnId}":
    put:
      summary: Strips all non-integrity-critical information out of an event.
      description: |-
        Strips all information out of an event which isn't critical to the
        integrity of the server-side representation of the room.

        This cannot be undone.

        Any user with a power level greater than or equal to the `m.room.redaction`
        event power level may send redaction events in the room. If the user's power
        level greater is also greater than or equal to the `redact` power level
        of the room, the user may redact events sent by other users.

        Server administrators may redact events sent by users on their server.
      operationId: redactEvent
      security:
        - accessTokenQuery: []
        - accessTokenBearer: []
      parameters:
        - in: path
          name: roomId
          description: The room from which to redact the event.
          required: true
          example: "!637q39766251:example.com"
          schema:
            type: string
        - in: path
          name: eventId
          description: The ID of the event to redact
          required: true
          example: bai2b1i9:matrix.org
          schema:
            type: string
        - in: path
          name: txnId
          description: |-
            The [transaction ID](/client-server-api/#transaction-identifiers) for this event. Clients should generate a
            unique ID; it will be used by the server to ensure idempotency of requests.
          required: true
          example: "37"
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example: {
                "reason": "Indecent material"
              }
              properties:
                reason:
                  type: string
                  description: The reason for the event being redacted.
        required: true
      responses:
        "200":
          description: An ID for the redaction event.
          content:
            application/json:
              schema:
                type: object
                properties:
                  event_id:
                    type: string
                    description: A unique identifier for the event.
              examples:
                response:
                  value: {
                    "event_id": "$YUwQidLecu:example.com"
                  }
      tags:
        - Room participation
servers:
  - url: "{protocol}://{hostname}{basePath}"
    variables:
      protocol:
        enum:
          - http
          - https
        default: https
      hostname:
        default: localhost:8008
      basePath:
        default: /_matrix/client/v3
components:
  securitySchemes:
    accessTokenQuery:
      $ref: definitions/security.yaml#/accessTokenQuery
    accessTokenBearer:
      $ref: definitions/security.yaml#/accessTokenBearer
