{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Lists messages in a channel or in a thread, newest first by default. Messages from the repo-backed channel this one was migrated from are included and marked legacy. Messages moved in from another space are included in their move order, and messages moved out are absent.",
      "errors": [
        {
          "description": "The request has no valid service auth.",
          "name": "AuthRequired"
        },
        {
          "description": "The requesting user may not read this channel or thread.",
          "name": "Forbidden"
        },
        {
          "description": "No channel or thread matches the given space reference.",
          "name": "ChannelNotFound"
        }
      ],
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "cursor": {
              "description": "Pagination cursor for the next page. With around, it continues towards older messages.",
              "type": "string"
            },
            "forwardCursor": {
              "description": "Only set with around, when newer messages remain. Pass it as cursor with reverse set to continue towards newer messages.",
              "type": "string"
            },
            "messages": {
              "description": "The channel's messages.",
              "items": {
                "ref": "social.colibri.beta.channel.defs#messageView",
                "type": "ref"
              },
              "type": "array"
            },
            "threads": {
              "description": "Threads whose anchor message is in this page, so a client can draw a thread's marker under the message it was opened from without a second call. Threads the requesting user may not read are absent.",
              "items": {
                "description": "A thread.",
                "ref": "social.colibri.beta.thread.defs#threadView",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "messages"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "around": {
            "description": "Centres the page on this message record key. The page holds up to limit messages, newest first: the newer half, then the message itself and the older half. cursor and reverse are ignored when this is set.",
            "format": "record-key",
            "type": "string"
          },
          "channel": {
            "description": "The channel or thread to list messages from.",
            "format": "space-ref",
            "type": "string"
          },
          "cursor": {
            "description": "Pagination cursor from a previous call.",
            "type": "string"
          },
          "limit": {
            "default": 50,
            "description": "Maximum number of messages to return.",
            "maximum": 100,
            "minimum": 1,
            "type": "integer"
          },
          "reverse": {
            "default": false,
            "description": "Whether to return the oldest messages first instead of the newest.",
            "type": "boolean"
          }
        },
        "required": [
          "channel"
        ],
        "type": "params"
      },
      "type": "query"
    }
  },
  "id": "social.colibri.beta.channel.listMessages",
  "lexicon": 1
}
