# dev.knotless.createComment

> Writes a dev.knotless.comment record in the account logged in to this appview's web pages, as `knotless comment add` does: with a verdict, a review of the pull's head as it is now. Requires the session cookie the pages' login sets: the appview writes with the session it keeps for that account. Clients holding their own session write the record themselves.

- Kind: procedure
- 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.createComment)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.createComment/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.createComment/analytics)

## Procedure (`dev.knotless.createComment`)

Type: procedure · POST

### Input (application/json)

- `body` (string, required): What it says, in Markdown.
  - Constraints: maxLength: 20000
- `images` (array): Pictures uploaded with dev.knotless.uploadImage; those the body links to are attached.
  - Constraints: maxLength: 32
  - `items` (ref)
    - Reference: `dev.knotless.defs#image`
- `lines` (array): Comments on lines of a pull's diff, at its head as it is now, each starting a thread, written at once: as the review's when it has a body or a verdict, else on their own.
  - Constraints: maxLength: 100
  - `items` (ref)
    - Reference: `#lineComment`
- `repo` (string · at-uri, required): The repository's dev.knotless.repo record, as dev.knotless.getRepo takes it.
- `subject` (string · at-uri, required): The dev.knotless.pull or dev.knotless.issue commented on, or, for a gist, its dev.knotless.repo record; or a dev.knotless.comment on a pull or an issue to answer, in the thread it starts or is in. A comment on a gist takes no verdict or lines.
- `verdict` (string): For a review of a pull: `approve`, or `changes` to ask for changes.
  - Constraints: maxLength: 64, knownValues: approve | changes

### Output (application/json)

- `uri` (string · at-uri, required): The dev.knotless.comment record written: with lines, the review, or without one the first line comment.

### Errors

- `NotFound`: No such repository.
- `AuthenticationRequired`: No account is logged in to the pages, or its session has ended.

## #lineComment (`dev.knotless.createComment#lineComment`)

Type: object

A comment on lines of a pull's diff.

### Properties

- `body` (string, required): What it says, in Markdown.
  - Constraints: maxLength: 20000
- `line` (integer, required): The last line commented on, counting from 1, in the file as it is on that side.
  - Constraints: minimum: 1
- `path` (string, required): The file's path on the side commented on.
  - Constraints: maxLength: 1024
- `side` (string): `new`, the side the pull brings in, or `old`, the side it leaves. Absent, `new`.
  - Constraints: maxLength: 16, knownValues: old | new
- `startLine` (integer): The first, for more than one line.
  - Constraints: minimum: 1

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "lineComment": {
      "description": "A comment on lines of a pull's diff.",
      "properties": {
        "body": {
          "description": "What it says, in Markdown.",
          "maxLength": 20000,
          "type": "string"
        },
        "line": {
          "description": "The last line commented on, counting from 1, in the file as it is on that side.",
          "minimum": 1,
          "type": "integer"
        },
        "path": {
          "description": "The file's path on the side commented on.",
          "maxLength": 1024,
          "type": "string"
        },
        "side": {
          "description": "`new`, the side the pull brings in, or `old`, the side it leaves. Absent, `new`.",
          "knownValues": [
            "old",
            "new"
          ],
          "maxLength": 16,
          "type": "string"
        },
        "startLine": {
          "description": "The first, for more than one line.",
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "path",
        "line",
        "body"
      ],
      "type": "object"
    },
    "main": {
      "description": "Writes a dev.knotless.comment record in the account logged in to this appview's web pages, as `knotless comment add` does: with a verdict, a review of the pull's head as it is now. Requires the session cookie the pages' login sets: the appview writes with the session it keeps for that account. Clients holding their own session write the record themselves.",
      "errors": [
        {
          "description": "No such repository.",
          "name": "NotFound"
        },
        {
          "description": "No account is logged in to the pages, or its session has ended.",
          "name": "AuthenticationRequired"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "body": {
              "description": "What it says, in Markdown.",
              "maxLength": 20000,
              "type": "string"
            },
            "images": {
              "description": "Pictures uploaded with dev.knotless.uploadImage; those the body links to are attached.",
              "items": {
                "ref": "dev.knotless.defs#image",
                "type": "ref"
              },
              "maxLength": 32,
              "type": "array"
            },
            "lines": {
              "description": "Comments on lines of a pull's diff, at its head as it is now, each starting a thread, written at once: as the review's when it has a body or a verdict, else on their own.",
              "items": {
                "ref": "#lineComment",
                "type": "ref"
              },
              "maxLength": 100,
              "type": "array"
            },
            "repo": {
              "description": "The repository's dev.knotless.repo record, as dev.knotless.getRepo takes it.",
              "format": "at-uri",
              "type": "string"
            },
            "subject": {
              "description": "The dev.knotless.pull or dev.knotless.issue commented on, or, for a gist, its dev.knotless.repo record; or a dev.knotless.comment on a pull or an issue to answer, in the thread it starts or is in. A comment on a gist takes no verdict or lines.",
              "format": "at-uri",
              "type": "string"
            },
            "verdict": {
              "description": "For a review of a pull: `approve`, or `changes` to ask for changes.",
              "knownValues": [
                "approve",
                "changes"
              ],
              "maxLength": 64,
              "type": "string"
            }
          },
          "required": [
            "repo",
            "subject",
            "body"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "uri": {
              "description": "The dev.knotless.comment record written: with lines, the review, or without one the first line comment.",
              "format": "at-uri",
              "type": "string"
            }
          },
          "required": [
            "uri"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Comments on a pull, an issue or a gist, or on lines of a pull's diff, or answers a comment, or reviews a pull, as the account logged in to this appview's pages.",
  "id": "dev.knotless.createComment",
  "lexicon": 1
}
```
