# Panel Get Tool

`panel_get` reads one panel and one of its versions: its settings, the id of the version people see, and for the version read its assets, its main HTML, the workflows it may call, the tables it may read, the vendor libraries it may use, and the `asset:` names that HTML references but the version does not hold.

## When to Use

The agent uses it before changing a panel with `panel_update`, so the asset ids it patches and the lines a patch copies are the version's own.

## Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `panel` | string | Yes | The panel's id, as `panel_list` or `panel_create` returned it |
| `version` | string | No | The id of the version to read, as `panel_versions` lists it. Left out, the version people see |
| `offset` | integer | No | How many characters of the main HTML to skip: `0` (the default), or `main_html_next_offset` of the previous answer |
| `limit` | integer | No | The most characters of the main HTML to return, from `1` to `20,000`. Left out, `20,000` |

## Returns

| Field | Type | Description |
|-------|------|-------------|
| `id` | string | The panel's id |
| `name` | string | Its name |
| `description` | string | What it is for |
| `revision` | integer | The revision of its settings, which advances with every change of them |
| `current_version` | string or null | The id of the version people see |
| `version` | string | The id of the version read |
| `created_at` | string | When that version was written |
| `main` | string | The name of its main HTML asset, such as `index.html` |
| `files` | array | Every asset the version lists: `id`, `name`, `kind` (`html`, `js`, `css` or `svg`), `hash` (its SHA-256) and `bytes`. Vendor libraries are not among them |
| `workflows` | array | The ids of the workflows it may call |
| `tables` | array | The ids of the tables it may read with `verdalia.api.queryTable` |
| `vendors` | array | The vendor identifiers it may use, such as `verdalia-ui.js`; these come with Verdalia and are never assets |
| `main_html` | string | The main asset's text from `offset`: at most `limit` characters |
| `main_html_total_chars` | integer | The length of the main asset's whole text in characters |
| `main_html_next_offset` | integer or null | The offset of the main asset's text after `main_html`; `null` when `main_html` reaches the end |
| `missing_assets` | array | The `asset:` names the main HTML references that the version does not hold, invalid names included |
| `page_urls` | array of strings | The full URL of every navigation page that shows the panel; empty when none does |
| `editor_url` | string | The full URL of the panel's editor in Settings |

## Example Scenario

```json
{ "panel": "01JC4Z8Q2V6M3K9T1R5X7B0N4D" }
```

## Notes

- One call answers at most 20,000 characters of the main HTML, whoever calls. A longer one is read in parts by calling again with `offset` set to `main_html_next_offset` until it is `null`
- A `limit` below `1` or above `20,000` is refused; an `offset` at or past the end answers empty `main_html`
- `panel_file_get` reads the text of any other asset in `files`, or of a vendor library the version lists
- `panel_update` patches an asset by its `id`, as `files` gives it
- An id that is not a ULID is refused
- A panel the workspace does not have is refused: `No panel has the id <id>`
- A version id the panel does not have is refused: `The panel has no version with the id <id>`
- Risk: read
