{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Connect a space so bard reads and publishes the authority's site and tile records from it. Authority only, and the delegation token must be the authority's own. Bard exchanges the token for a credential under its own key, registers for notifications, bootstraps the authority's repo, and records the space. Idempotent.",
      "errors": [
        {
          "description": "Only the space's authority may connect it.",
          "name": "NotSpaceAuthority"
        },
        {
          "description": "The delegation token's issuer is not the calling identity.",
          "name": "GrantIssuerMismatch"
        },
        {
          "description": "The delegation token is past its lifetime.",
          "name": "GrantExpired"
        },
        {
          "description": "The space host refused the exchange.",
          "name": "GrantRefused"
        },
        {
          "description": "The space's app access does not admit bard; the space is recorded and will sync once it does.",
          "name": "AppNotAllowed"
        },
        {
          "description": "This identity has reached its connected-space limit.",
          "name": "SpaceQuotaExceeded"
        },
        {
          "description": "Space support is disabled on this deployment.",
          "name": "SpacesDisabled"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "delegationToken": {
              "description": "A delegation token minted by the authority for this space; spent immediately and never stored.",
              "type": "string"
            },
            "space": {
              "description": "The space, at://{authority}/space/space.highport.sites.space/{skey}.",
              "format": "at-uri",
              "type": "string"
            }
          },
          "required": [
            "space",
            "delegationToken"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "ref": "space.highport.defs#spaceView",
          "type": "ref"
        }
      },
      "type": "procedure"
    }
  },
  "id": "space.highport.manage.connectSpace",
  "lexicon": 1
}
