{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Domains ranked by successful, non-crawler requests over a trailing window. Safe to publish: a domain is left out if it is not serving, has a malware finding, or is denylisted in any way (directly, by pattern, or through its identity, space, record or serving CID). Counts can lag by up to ten minutes.",
      "errors": [
        {
          "description": "No analytics store is configured, so no traffic was recorded. An empty list means something else: the window had no traffic worth ranking.",
          "name": "AnalyticsDisabled"
        }
      ],
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "sites": {
              "items": {
                "ref": "#topSite",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "sites"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "days": {
            "default": 7,
            "description": "How many days back the window reaches from now.",
            "maximum": 30,
            "minimum": 1,
            "type": "integer"
          },
          "limit": {
            "default": 20,
            "description": "Maximum sites to return. Fewer come back if not enough domains qualify.",
            "maximum": 100,
            "minimum": 1,
            "type": "integer"
          },
          "minRequests": {
            "default": 0,
            "description": "Minimum requests a domain needs to be ranked, so near-dead domains do not rank in a quiet window.",
            "minimum": 0,
            "type": "integer"
          }
        },
        "type": "params"
      },
      "type": "query"
    },
    "topSite": {
      "description": "One domain's rank in the window, and what it publishes.",
      "properties": {
        "botRequests": {
          "description": "Crawler responses at any status, reported separately from requests so callers can see what was excluded.",
          "type": "integer"
        },
        "domain": {
          "description": "The hostname.",
          "type": "string"
        },
        "recordCid": {
          "description": "The record version behind the serving snapshot, which lets a later run tell a republished site from an unchanged one. Absent when the domain serves without an active snapshot.",
          "format": "cid",
          "type": "string"
        },
        "requests": {
          "description": "Non-crawler 2xx responses in the window. The ranking uses this figure, so bytes, error loops and scrapers cannot move it.",
          "type": "integer"
        },
        "siteDid": {
          "description": "The domain's registered owner.",
          "format": "did",
          "type": "string"
        }
      },
      "required": [
        "domain",
        "requests",
        "botRequests",
        "siteDid"
      ],
      "type": "object"
    }
  },
  "id": "space.highport.admin.listTopSites",
  "lexicon": 1
}
