# place.hud.previewApp

> Keep a frame app, checked as place.hud.publishApp checks one, for 30 minutes in this server's memory, to run at /a/preview/<id> as a published one runs: its writes answered as a preview's, never sent, its entries those of app where given. Nothing reaches the person's PDS. 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.

- Kind: procedure
- Authority: hud.place
- Lexicon: 1
- Published by [lexicons.hud.place](https://lexicon.garden/identity/did:plc:3tzbz4pml36u4mkresb6pdhv), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:3tzbz4pml36u4mkresb6pdhv/place.hud.previewApp)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:3tzbz4pml36u4mkresb6pdhv/place.hud.previewApp/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:3tzbz4pml36u4mkresb6pdhv/place.hud.previewApp/analytics)

## Procedure (`place.hud.previewApp`)

Type: procedure · POST

### Input (application/json)

- `app` (string · at-uri): The published app it would replace, whose entries the preview reads.
- `html` (string, required): Its document, UTF-8, everything it loads inline.
  - Constraints: maxLength: 2000000
- `kinds` (array, required): Its kinds of entry, each a name (1 to 64 letters and digits in lowerCamelCase) and a lexicon object def.
  - Constraints: minLength: 1, maxLength: 16
  - `items` (ref)
    - Reference: `place.hud.app#kind`
- `name` (string, required): What the app is called.
  - Constraints: maxLength: 640, maxGraphemes: 64
- `origins` (array): The https origins it loads pictures and audio from, as place.hud.app holds them: each one a view HUD trusts names.
  - Constraints: maxLength: 8
  - `items` (ref)
    - Reference: `place.hud.app#origin`
- `reads` (array): Public collections it reads beyond its entries, as place.hud.app holds them.
  - Constraints: maxLength: 16
  - `items` (ref)
    - Reference: `place.hud.app#collection`
- `summary` (string): What it is.
  - Constraints: maxLength: 3000, maxGraphemes: 300
- `words` (unknown): Its words by language, en among them.
- `writers` (array): Who alone may write its entries: anyone where it is left out.
  - Constraints: maxLength: 200
  - `items` (ref)
    - Reference: `place.hud.app#writer`
- `writes` (array): Collections it writes in the person's repository beyond its entries, as place.hud.app holds them: each one whose record lexicon HUD bundles.
  - Constraints: maxLength: 8
  - `items` (ref)
    - Reference: `place.hud.app#collection`

### Output (application/json)

- `preview` (string, required): The preview's id: 26 characters of a-z and 2-7.
  - Constraints: minLength: 26, maxLength: 26
- `url` (string, required): Its page's path: /a/preview/<id>.
  - Constraints: maxLength: 64

### Errors

- `InvalidRequest`: The app is not one HUD runs: what is wrong is named.
- `AuthRequired`: No live web session or HUD access token: sign in.
- `LimitReached`: This server keeps as many previews as it holds: try again in a while.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Keep a frame app, checked as place.hud.publishApp checks one, for 30 minutes in this server's memory, to run at /a/preview/<id> as a published one runs: its writes answered as a preview's, never sent, its entries those of app where given. Nothing reaches the person's PDS. 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": "The app is not one HUD runs: what is wrong is named.",
          "name": "InvalidRequest"
        },
        {
          "description": "No live web session or HUD access token: sign in.",
          "name": "AuthRequired"
        },
        {
          "description": "This server keeps as many previews as it holds: try again in a while.",
          "name": "LimitReached"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "app": {
              "description": "The published app it would replace, whose entries the preview reads.",
              "format": "at-uri",
              "type": "string"
            },
            "html": {
              "description": "Its document, UTF-8, everything it loads inline.",
              "maxLength": 2000000,
              "type": "string"
            },
            "kinds": {
              "description": "Its kinds of entry, each a name (1 to 64 letters and digits in lowerCamelCase) and a lexicon object def.",
              "items": {
                "ref": "place.hud.app#kind",
                "type": "ref"
              },
              "maxLength": 16,
              "minLength": 1,
              "type": "array"
            },
            "name": {
              "description": "What the app is called.",
              "maxGraphemes": 64,
              "maxLength": 640,
              "type": "string"
            },
            "origins": {
              "description": "The https origins it loads pictures and audio from, as place.hud.app holds them: each one a view HUD trusts names.",
              "items": {
                "ref": "place.hud.app#origin",
                "type": "ref"
              },
              "maxLength": 8,
              "type": "array"
            },
            "reads": {
              "description": "Public collections it reads beyond its entries, as place.hud.app holds them.",
              "items": {
                "ref": "place.hud.app#collection",
                "type": "ref"
              },
              "maxLength": 16,
              "type": "array"
            },
            "summary": {
              "description": "What it is.",
              "maxGraphemes": 300,
              "maxLength": 3000,
              "type": "string"
            },
            "words": {
              "description": "Its words by language, en among them.",
              "type": "unknown"
            },
            "writers": {
              "description": "Who alone may write its entries: anyone where it is left out.",
              "items": {
                "ref": "place.hud.app#writer",
                "type": "ref"
              },
              "maxLength": 200,
              "type": "array"
            },
            "writes": {
              "description": "Collections it writes in the person's repository beyond its entries, as place.hud.app holds them: each one whose record lexicon HUD bundles.",
              "items": {
                "ref": "place.hud.app#collection",
                "type": "ref"
              },
              "maxLength": 8,
              "type": "array"
            }
          },
          "required": [
            "name",
            "html",
            "kinds"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "preview": {
              "description": "The preview's id: 26 characters of a-z and 2-7.",
              "maxLength": 26,
              "minLength": 26,
              "type": "string"
            },
            "url": {
              "description": "Its page's path: /a/preview/<id>.",
              "maxLength": 64,
              "type": "string"
            }
          },
          "required": [
            "preview",
            "url"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Preview a frame app before publishing it.",
  "id": "place.hud.previewApp",
  "lexicon": 1
}
```
