# dev.knotless.awaitDelegation

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

✓ This is the authoritative definition for this NSID.

## Description

Waits a while for the account logged in to this appview's pages to approve a delegation dev.knotless.delegateWrites started.

## Links

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

## Definitions

### `dev.knotless.awaitDelegation`

**Type**: `procedure`

Asks this appview's gateway whether the delegation is approved (dev.knotless.getDelegation), which waits a while for it before saying it is not yet: ask again until done. Once done, the appview remembers the gateway for the account, so that sharing a repository for writing from the pages names it. A procedure, since it writes that. Requires the session cookie the pages' login sets.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `state` | `string` | Yes | The delegation, as dev.knotless.delegateWrites named it. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `done` | `boolean` | Yes | Whether it was approved: false while it waits still. |
| `gateway` | `string` (did) | No | Once done, the gateway that now writes for the account. |

#### Errors

- **InvalidRequest**: No such delegation waits, or the account refused the grant.
- **AuthenticationRequired**: No account is logged in to the pages, or its session has ended.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Asks this appview's gateway whether the delegation is approved (dev.knotless.getDelegation), which waits a while for it before saying it is not yet: ask again until done. Once done, the appview remembers the gateway for the account, so that sharing a repository for writing from the pages names it. A procedure, since it writes that. Requires the session cookie the pages' login sets.",
      "errors": [
        {
          "description": "No such delegation waits, or the account refused the grant.",
          "name": "InvalidRequest"
        },
        {
          "description": "No account is logged in to the pages, or its session has ended.",
          "name": "AuthenticationRequired"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "state": {
              "description": "The delegation, as dev.knotless.delegateWrites named it.",
              "maxLength": 256,
              "type": "string"
            }
          },
          "required": [
            "state"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "done": {
              "description": "Whether it was approved: false while it waits still.",
              "type": "boolean"
            },
            "gateway": {
              "description": "Once done, the gateway that now writes for the account.",
              "format": "did",
              "type": "string"
            }
          },
          "required": [
            "done"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Waits a while for the account logged in to this appview's pages to approve a delegation dev.knotless.delegateWrites started.",
  "id": "dev.knotless.awaitDelegation",
  "lexicon": 1
}
```
