# dev.knotless.awaitDelegation

> 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.

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

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

Type: procedure · POST

### Input (application/json)

- `state` (string, required): The delegation, as dev.knotless.delegateWrites named it.
  - Constraints: maxLength: 256

### Output (application/json)

- `done` (boolean, required): Whether it was approved: false while it waits still.
- `gateway` (string · did): 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.

## 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
}
```
