# dev.knotless.getTree

> Published by [lexicons.knotless.dev](https://lexicon.garden/identity/did:plc:yqsg7znbbhfmj3a2nrpnaerk)

✓ This is the authoritative definition for this NSID.

## Description

A directory of a repository at a revision.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.getTree)
- [Documentation](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.getTree/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.getTree/examples)

## Definitions

### `dev.knotless.getTree#entry`

**Type**: `object`

One entry of a directory.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `kind` | `string` | Yes | A directory, a file, or a submodule's commit. |
| `name` | `string` | Yes |  |
| `size` | `integer` | No | A file's size, in bytes. |

### `dev.knotless.getTree`

**Type**: `query`

A directory at a revision: its entries, folders first, the commit that last changed it, its README, and what the repository's runners report of the revision. Nothing at all, for a repository never pushed. No authentication needed; asked as an account, with a service token or the pages' session cookie, a private repository it is a member of is read too, and the answer is that account's alone.

#### Parameters

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `path` | `string` | No | A path in the tree, from its root. |
| `ref` | `string` | No | A branch, a tag or a commit; the default branch if absent. It may run on into the path, as a web address names them: the longest branch or tag that starts it is the ref, and what follows goes before `path`. |
| `repo` | `string` (at-uri) | Yes | The repository's dev.knotless.repo record. Its authority may be a handle; a name the repository had before, or an owner it moved from with its agreement, finds it under the name it has now. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `checks` | `array` | Yes | The newest run of each workflow at `lastCommit`, by the runners the repository names: the revision shown, at the root. |
| `empty` | `boolean` | No | True for a repository never pushed, whose tree is nothing. |
| `entries` | `array` | Yes |  |
| `languages` | `array` | Yes | What the repository is written in, most first: at the root of its default branch, and nowhere else. |
| `lastCommit` | `ref` → `dev.knotless.defs#commitView` | No | The newest commit that changed the directory. |
| `path` | `string` | Yes | The directory, from the root; empty for the root. |
| `readme` | `ref` → `#readme` | No |  |
| `ref` | `string` | Yes | The ref or commit shown, as `ref` named it, less any path. |

#### Errors

- **NotFound**: No such repository, revision, path or record.

### `dev.knotless.getTree#readme`

**Type**: `object`

The directory's README: the first file whose name starts with `readme`, ignoring case.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `html` | `string` | No | A Markdown README, made into HTML: raw HTML shown as text, and links made relative to the directory. |
| `name` | `string` | Yes | Its file name. |
| `text` | `string` | No | Any other README, as it is. |

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "entry": {
      "description": "One entry of a directory.",
      "properties": {
        "kind": {
          "description": "A directory, a file, or a submodule's commit.",
          "knownValues": [
            "tree",
            "blob",
            "commit"
          ],
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "size": {
          "description": "A file's size, in bytes.",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "name",
        "kind"
      ],
      "type": "object"
    },
    "main": {
      "description": "A directory at a revision: its entries, folders first, the commit that last changed it, its README, and what the repository's runners report of the revision. Nothing at all, for a repository never pushed. No authentication needed; asked as an account, with a service token or the pages' session cookie, a private repository it is a member of is read too, and the answer is that account's alone.",
      "errors": [
        {
          "description": "No such repository, revision, path or record.",
          "name": "NotFound"
        }
      ],
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "checks": {
              "description": "The newest run of each workflow at `lastCommit`, by the runners the repository names: the revision shown, at the root.",
              "items": {
                "ref": "dev.knotless.defs#checkView",
                "type": "ref"
              },
              "type": "array"
            },
            "empty": {
              "description": "True for a repository never pushed, whose tree is nothing.",
              "type": "boolean"
            },
            "entries": {
              "items": {
                "ref": "#entry",
                "type": "ref"
              },
              "type": "array"
            },
            "languages": {
              "description": "What the repository is written in, most first: at the root of its default branch, and nowhere else.",
              "items": {
                "ref": "dev.knotless.defs#languageView",
                "type": "ref"
              },
              "type": "array"
            },
            "lastCommit": {
              "description": "The newest commit that changed the directory.",
              "ref": "dev.knotless.defs#commitView",
              "type": "ref"
            },
            "path": {
              "description": "The directory, from the root; empty for the root.",
              "type": "string"
            },
            "readme": {
              "ref": "#readme",
              "type": "ref"
            },
            "ref": {
              "description": "The ref or commit shown, as `ref` named it, less any path.",
              "type": "string"
            }
          },
          "required": [
            "ref",
            "path",
            "entries",
            "checks",
            "languages"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "path": {
            "description": "A path in the tree, from its root.",
            "maxLength": 4096,
            "type": "string"
          },
          "ref": {
            "description": "A branch, a tag or a commit; the default branch if absent. It may run on into the path, as a web address names them: the longest branch or tag that starts it is the ref, and what follows goes before `path`.",
            "maxLength": 1024,
            "type": "string"
          },
          "repo": {
            "description": "The repository's dev.knotless.repo record. Its authority may be a handle; a name the repository had before, or an owner it moved from with its agreement, finds it under the name it has now.",
            "format": "at-uri",
            "type": "string"
          }
        },
        "required": [
          "repo"
        ],
        "type": "params"
      },
      "type": "query"
    },
    "readme": {
      "description": "The directory's README: the first file whose name starts with `readme`, ignoring case.",
      "properties": {
        "html": {
          "description": "A Markdown README, made into HTML: raw HTML shown as text, and links made relative to the directory.",
          "type": "string"
        },
        "name": {
          "description": "Its file name.",
          "type": "string"
        },
        "text": {
          "description": "Any other README, as it is.",
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "type": "object"
    }
  },
  "description": "A directory of a repository at a revision.",
  "id": "dev.knotless.getTree",
  "lexicon": 1
}
```
