# dev.knotless.defineLabel

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

✓ This is the authoritative definition for this NSID.

## Description

Defines a label pulls and issues of a repository may carry.

## Links

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

## Definitions

### `dev.knotless.defineLabel`

**Type**: `procedure`

Adds the label to the repository's dev.knotless.repo record, in place of any of its name, as `knotless labels add` does. Only its owner, logged in to this appview's web pages, can: the appview writes with the session it keeps for that account, which the pages' session cookie names.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `color` | `string` | No | A hex color, as #d73a4a. |
| `description` | `string` | No | What the label means, for those who put it on. |
| `exclusive` | `boolean` | No | Whether, of its scope's exclusive labels, it stands alone: setting one takes the others off. |
| `name` | `string` | Yes | Up to its last `/`, if it has one, its scope, as kind/bug's is kind. |
| `repo` | `string` (at-uri) | Yes | The repository's dev.knotless.repo record, as dev.knotless.getRepo takes it. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `labels` | `array` | Yes | The labels it defines now. |

#### Errors

- **NotFound**: No such repository.
- **InvalidRequest**: The name is empty or too long, or the color is no hex color.
- **AuthenticationRequired**: No account is logged in to the pages, or its session has ended.
- **Forbidden**: The account logged in is not the repository's owner.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Adds the label to the repository's dev.knotless.repo record, in place of any of its name, as `knotless labels add` does. Only its owner, logged in to this appview's web pages, can: the appview writes with the session it keeps for that account, which the pages' session cookie names.",
      "errors": [
        {
          "description": "No such repository.",
          "name": "NotFound"
        },
        {
          "description": "The name is empty or too long, or the color is no hex color.",
          "name": "InvalidRequest"
        },
        {
          "description": "No account is logged in to the pages, or its session has ended.",
          "name": "AuthenticationRequired"
        },
        {
          "description": "The account logged in is not the repository's owner.",
          "name": "Forbidden"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "color": {
              "description": "A hex color, as #d73a4a.",
              "maxLength": 7,
              "type": "string"
            },
            "description": {
              "description": "What the label means, for those who put it on.",
              "maxGraphemes": 200,
              "maxLength": 1000,
              "type": "string"
            },
            "exclusive": {
              "description": "Whether, of its scope's exclusive labels, it stands alone: setting one takes the others off.",
              "type": "boolean"
            },
            "name": {
              "description": "Up to its last `/`, if it has one, its scope, as kind/bug's is kind.",
              "maxGraphemes": 50,
              "maxLength": 100,
              "type": "string"
            },
            "repo": {
              "description": "The repository's dev.knotless.repo record, as dev.knotless.getRepo takes it.",
              "format": "at-uri",
              "type": "string"
            }
          },
          "required": [
            "repo",
            "name"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "labels": {
              "description": "The labels it defines now.",
              "items": {
                "ref": "dev.knotless.repo#label",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "labels"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Defines a label pulls and issues of a repository may carry.",
  "id": "dev.knotless.defineLabel",
  "lexicon": 1
}
```
