~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

7
68 lines · 3.6 KB Raw History
{
  "lexicon": 1,
  "id": "dev.knotless.getBlame",
  "description": "Who last changed each line of a file at a revision.",
  "defs": {
    "main": {
      "type": "query",
      "description": "Who last changed each line of a text file at a revision, as git blame finds it: the file's text, the ranges its highlighting paints, its lines in runs from the same commit, and each of those commits once. A binary file, or one over 256 KiB, is refused. 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": {
        "type": "params",
        "required": ["repo"],
        "properties": {
          "repo": { "type": "string", "format": "at-uri", "description": "The repository's dev.knotless.repo record, as dev.knotless.getFile takes it." },
          "ref": { "type": "string", "maxLength": 1024, "description": "A branch, a tag or a commit, which may run on into the path, as dev.knotless.getFile takes it; the default branch if absent." },
          "path": { "type": "string", "maxLength": 4096, "description": "A file in the tree, from its root." }
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "type": "object",
          "required": ["ref", "path", "lines", "text", "ranges", "hunks", "commits"],
          "properties": {
            "ref": { "type": "string", "description": "The ref or commit shown, as `ref` named it, less any path." },
            "path": { "type": "string", "description": "The file, from the root." },
            "lines": { "type": "integer", "minimum": 1, "description": "How many lines the text has." },
            "text": { "type": "string", "description": "The file's text." },
            "ranges": { "type": "string", "description": "The ranges its highlighting paints, encoded as the pages read them, as dev.knotless.getFile has them." },
            "hunks": {
              "type": "array",
              "description": "Its lines in runs, each last changed by one commit, from the first line on.",
              "items": { "type": "ref", "ref": "#hunk" }
            },
            "commits": {
              "type": "array",
              "description": "Each commit a run names, once.",
              "items": { "type": "ref", "ref": "dev.knotless.defs#commitView" }
            }
          }
        }
      },
      "errors": [
        { "name": "NotFound", "description": "No such repository, revision or file." },
        { "name": "InvalidRequest", "description": "The file is binary, or too large to blame." }
      ]
    },
    "hunk": {
      "type": "object",
      "description": "A run of lines one commit last changed.",
      "required": ["sha", "start", "count"],
      "properties": {
        "sha": { "type": "string", "description": "The commit, in hex: one of `commits`." },
        "start": { "type": "integer", "minimum": 1, "description": "The run's first line, counted from 1." },
        "count": { "type": "integer", "minimum": 1, "description": "How many lines it runs for." },
        "previous": { "type": "ref", "ref": "#previous" }
      }
    },
    "previous": {
      "type": "object",
      "description": "Where blame goes on before the run's commit: its parent, and the file's path there. Absent where the commit made the file.",
      "required": ["sha", "path"],
      "properties": {
        "sha": { "type": "string", "description": "The commit's parent, in hex." },
        "path": { "type": "string", "description": "The file's path in that parent, from the root." }
      }
    }
  }
}