# dev.knotless.pushRefs

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

✓ This is the authoritative definition for this NSID.

## Description

Pushes to a repository through a gateway its owner has delegated writes to: the gateway checks the caller is the owner or a collaborator, then writes the pack and ref updates as the owner. Requires a service token from the caller's PDS, audience the gateway's DID, for this method.

## Links

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

## Definitions

### `dev.knotless.pushRefs#header`

**Type**: `object`

What precedes the pack in the body, on a line of its own.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `name` | `string` | Yes | The repository's name: its dev.knotless.repo record key. |
| `repo` | `string` (did) | Yes | The repository's owner. |
| `updates` | `array` | Yes |  |

### `dev.knotless.pushRefs`

**Type**: `procedure`

The body is one line of JSON, a #header, then a git packfile holding every object the updates need that the repository lacks (empty when every update is a deletion). Each update succeeds or fails on its own.

#### Input

**Encoding**: `application/x-knotless-push`

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `results` | `array` | Yes |  |

### `dev.knotless.pushRefs#result`

**Type**: `object`

How one update went.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `error` | `string` | No | Why the update was refused; absent when it landed. |
| `ref` | `string` | Yes | The update's `dst`. |

### `dev.knotless.pushRefs#update`

**Type**: `object`

One ref to move.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `dst` | `string` | Yes | The full ref name, such as refs/heads/main. |
| `force` | `boolean` | No | Move it even when the move is not a fast-forward. |
| `src` | `string` | No | The hex object ID to point it at; absent to delete the ref. |

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "header": {
      "description": "What precedes the pack in the body, on a line of its own.",
      "properties": {
        "name": {
          "description": "The repository's name: its dev.knotless.repo record key.",
          "maxLength": 100,
          "type": "string"
        },
        "repo": {
          "description": "The repository's owner.",
          "format": "did",
          "type": "string"
        },
        "updates": {
          "items": {
            "ref": "#update",
            "type": "ref"
          },
          "type": "array"
        }
      },
      "required": [
        "repo",
        "name",
        "updates"
      ],
      "type": "object"
    },
    "main": {
      "description": "The body is one line of JSON, a #header, then a git packfile holding every object the updates need that the repository lacks (empty when every update is a deletion). Each update succeeds or fails on its own.",
      "input": {
        "encoding": "application/x-knotless-push"
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "results": {
              "items": {
                "ref": "#result",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "results"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    },
    "result": {
      "description": "How one update went.",
      "properties": {
        "error": {
          "description": "Why the update was refused; absent when it landed.",
          "maxLength": 3000,
          "type": "string"
        },
        "ref": {
          "description": "The update's `dst`.",
          "maxLength": 1024,
          "type": "string"
        }
      },
      "required": [
        "ref"
      ],
      "type": "object"
    },
    "update": {
      "description": "One ref to move.",
      "properties": {
        "dst": {
          "description": "The full ref name, such as refs/heads/main.",
          "maxLength": 1024,
          "type": "string"
        },
        "force": {
          "default": false,
          "description": "Move it even when the move is not a fast-forward.",
          "type": "boolean"
        },
        "src": {
          "description": "The hex object ID to point it at; absent to delete the ref.",
          "maxLength": 64,
          "minLength": 40,
          "type": "string"
        }
      },
      "required": [
        "dst"
      ],
      "type": "object"
    }
  },
  "description": "Pushes to a repository through a gateway its owner has delegated writes to: the gateway checks the caller is the owner or a collaborator, then writes the pack and ref updates as the owner. Requires a service token from the caller's PDS, audience the gateway's DID, for this method.",
  "id": "dev.knotless.pushRefs",
  "lexicon": 1
}
```
