# dev.knotless.getLastCommits

> The newest commit to change each entry of a directory at a revision, as its history shows it: a commit that left an entry as one of its parents had it did not change it. Asked apart from dev.knotless.getTree, as finding them can walk a long history. 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.

- Kind: query
- Authority: knotless.dev
- Lexicon: 1
- Published by [lexicons.knotless.dev](https://lexicon.garden/identity/did:plc:yqsg7znbbhfmj3a2nrpnaerk), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.getLastCommits)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.getLastCommits/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.getLastCommits/analytics)

## Query (`dev.knotless.getLastCommits`)

Type: query · GET

### Parameters (query string)

- `path` (string): A directory in the tree, from its root.
  - Constraints: maxLength: 4096
- `ref` (string): A branch, a tag or a commit, which may run on into the path, as dev.knotless.getTree takes it; the default branch if absent.
  - Constraints: maxLength: 1024
- `repo` (string · at-uri, required): The repository's dev.knotless.repo record, as dev.knotless.getTree takes it.

### Output (application/json)

- `commitCount` (integer): How many commits the ref's history holds, its own among them. Only when `path` is the root.
  - Constraints: minimum: 0
- `commits` (array, required): Each commit an entry names, once.
  - `items` (ref)
    - Reference: `dev.knotless.defs#commitView`
- `entries` (array, required): Each entry of the directory, in the tree's order.
  - `items` (ref)
    - Reference: `#entry`
- `path` (string, required): The directory, from the root; empty for the root.
- `ref` (string, required): The ref or commit shown, as `ref` named it, less any path.

### Errors

- `NotFound`: No such repository, revision or directory.

## #entry (`dev.knotless.getLastCommits#entry`)

Type: object

One entry of the directory, and the commit that last changed it.

### Properties

- `name` (string, required): The entry's name in the directory.
- `sha` (string, required): The commit that last changed it, in hex: one of `commits`.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "entry": {
      "description": "One entry of the directory, and the commit that last changed it.",
      "properties": {
        "name": {
          "description": "The entry's name in the directory.",
          "type": "string"
        },
        "sha": {
          "description": "The commit that last changed it, in hex: one of `commits`.",
          "type": "string"
        }
      },
      "required": [
        "name",
        "sha"
      ],
      "type": "object"
    },
    "main": {
      "description": "The newest commit to change each entry of a directory at a revision, as its history shows it: a commit that left an entry as one of its parents had it did not change it. Asked apart from dev.knotless.getTree, as finding them can walk a long history. 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 or directory.",
          "name": "NotFound"
        }
      ],
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "commitCount": {
              "description": "How many commits the ref's history holds, its own among them. Only when `path` is the root.",
              "minimum": 0,
              "type": "integer"
            },
            "commits": {
              "description": "Each commit an entry names, once.",
              "items": {
                "ref": "dev.knotless.defs#commitView",
                "type": "ref"
              },
              "type": "array"
            },
            "entries": {
              "description": "Each entry of the directory, in the tree's order.",
              "items": {
                "ref": "#entry",
                "type": "ref"
              },
              "type": "array"
            },
            "path": {
              "description": "The directory, from the root; empty for the root.",
              "type": "string"
            },
            "ref": {
              "description": "The ref or commit shown, as `ref` named it, less any path.",
              "type": "string"
            }
          },
          "required": [
            "ref",
            "path",
            "entries",
            "commits"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "path": {
            "description": "A directory in the tree, from its root.",
            "maxLength": 4096,
            "type": "string"
          },
          "ref": {
            "description": "A branch, a tag or a commit, which may run on into the path, as dev.knotless.getTree takes it; the default branch if absent.",
            "maxLength": 1024,
            "type": "string"
          },
          "repo": {
            "description": "The repository's dev.knotless.repo record, as dev.knotless.getTree takes it.",
            "format": "at-uri",
            "type": "string"
          }
        },
        "required": [
          "repo"
        ],
        "type": "params"
      },
      "type": "query"
    }
  },
  "description": "The newest commit to change each entry of a directory.",
  "id": "dev.knotless.getLastCommits",
  "lexicon": 1
}
```
