{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Publish a version of an app artifact of one of the person's chats, as publishApp does: its document and words copied as blobs of the person's own repository, then a place.hud.app record written at rkey, a new one or in place of the one there. The artifact keeps where it was published. A view artifact has no publish. Requires auth: the workspace's web session (its cookie, with X-HUD: 1 and the server's own Origin) or a HUD access token as Bearer.",
      "errors": [
        {
          "description": "No chat of this id is the person's, or it has no such artifact or version.",
          "name": "NotFound"
        },
        {
          "description": "The artifact is a view, or the rkey is not one: what is wrong is named.",
          "name": "InvalidRequest"
        },
        {
          "description": "No live web session or HUD access token, or the person's sign-in at their PDS ended: sign in.",
          "name": "AuthRequired"
        },
        {
          "description": "Their PDS refused the write, or the version's files could not be read; or they signed in before HUD asked to publish apps, which the message says: sign in again.",
          "name": "UpstreamFailure"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "artifact": {
              "description": "The artifact's key.",
              "maxLength": 40,
              "minLength": 1,
              "type": "string"
            },
            "chat": {
              "maxLength": 12,
              "minLength": 12,
              "type": "string"
            },
            "rkey": {
              "description": "The app's record key, its address's last part: 1 to 64 of a-z, 0-9 and -.",
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            },
            "version": {
              "description": "The version to publish; its latest by default.",
              "minimum": 1,
              "type": "integer"
            }
          },
          "required": [
            "chat",
            "artifact",
            "rkey"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "cid": {
              "format": "cid",
              "type": "string"
            },
            "uri": {
              "format": "at-uri",
              "type": "string"
            },
            "url": {
              "description": "The app's page, to share: /a/<handle>/<rkey> on this server.",
              "format": "uri",
              "type": "string"
            }
          },
          "required": [
            "uri",
            "cid",
            "url"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Publish an app a chat made.",
  "id": "place.hud.publishChatArtifact",
  "lexicon": 1
}
