# dev.knotless.shareRepo

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

✓ This is the authoritative definition for this NSID.

## Description

Lets an account push to a repository, or read a private one.

## Links

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

## Definitions

### `dev.knotless.shareRepo`

**Type**: `procedure`

Names the account among the collaborators of the repository's dev.knotless.repo record, as `knotless share --write` does: it pushes and commits through the gateway the owner delegated writes to, which must be named first, as `knotless delegate` names it. 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 |
|----------|------|----------|-------------|
| `repo` | `string` (at-uri) | Yes | The repository's dev.knotless.repo record, as dev.knotless.getRepo takes it. |
| `with` | `string` (at-identifier) | Yes | The account, by handle or DID. |
| `write` | `boolean` | No | Whether it may push, as `knotless share --write` lets it; false lets it only read a private repository, and open pulls and issues there, as `knotless share` does, taking back any push it had. True when absent. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `collaborators` | `array` | Yes | The accounts that may push to it now. |

#### Errors

- **NotFound**: No such repository.
- **InvalidRequest**: There is no such account, the owner has delegated writes to no gateway, or a public repository was shared for reading, which anyone may.
- **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": "Names the account among the collaborators of the repository's dev.knotless.repo record, as `knotless share --write` does: it pushes and commits through the gateway the owner delegated writes to, which must be named first, as `knotless delegate` names it. 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": "There is no such account, the owner has delegated writes to no gateway, or a public repository was shared for reading, which anyone may.",
          "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": {
            "repo": {
              "description": "The repository's dev.knotless.repo record, as dev.knotless.getRepo takes it.",
              "format": "at-uri",
              "type": "string"
            },
            "with": {
              "description": "The account, by handle or DID.",
              "format": "at-identifier",
              "type": "string"
            },
            "write": {
              "description": "Whether it may push, as `knotless share --write` lets it; false lets it only read a private repository, and open pulls and issues there, as `knotless share` does, taking back any push it had. True when absent.",
              "type": "boolean"
            }
          },
          "required": [
            "repo",
            "with"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "collaborators": {
              "description": "The accounts that may push to it now.",
              "items": {
                "ref": "dev.knotless.defs#actorView",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "collaborators"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Lets an account push to a repository, or read a private one.",
  "id": "dev.knotless.shareRepo",
  "lexicon": 1
}
```
