# quest.cozysky.getGiftState

> Gift backlinks for one player: gifts other players set down or sent for them (gifts[].to = did), which of their own gifts others have accepted (giftsAccepted[].from = did), and which others sent back (giftsReturned[].from = did). Served by getGiftState.lua.

- Kind: query
- Authority: cozysky.quest
- Lexicon: 1
- Published by [cozysky.quest](https://lexicon.garden/identity/did:plc:r3t343mn4ksrkgzustdwj5iv), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:r3t343mn4ksrkgzustdwj5iv/quest.cozysky.getGiftState)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:r3t343mn4ksrkgzustdwj5iv/quest.cozysky.getGiftState/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:r3t343mn4ksrkgzustdwj5iv/quest.cozysky.getGiftState/analytics)

## Query (`quest.cozysky.getGiftState`)

Type: query · GET

### Parameters (query string)

- `did` (string · did, required)

### Output (application/json)

- `accepted` (array, required)
  - `items` (ref)
    - Reference: `#acceptance`
- `incoming` (array, required): quest.cozysky.save#gift entries addressed to did (set down in their grove, or sent: no area), each with the giver added as 'from'.
  - `items` (unknown)
- `returned` (array): did's gifts that the fren sent back; did's client takes them back into hand. Absent from older index scripts.
  - `items` (ref)
    - Reference: `#acceptance`

## #acceptance (`quest.cozysky.getGiftState#acceptance`)

Type: object

### Properties

- `by` (string · did, required): Who accepted it (under returned: who sent it back).
- `k` (string, required): The gift's key in did's save.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "acceptance": {
      "properties": {
        "by": {
          "description": "Who accepted it (under returned: who sent it back).",
          "format": "did",
          "type": "string"
        },
        "k": {
          "description": "The gift's key in did's save.",
          "type": "string"
        }
      },
      "required": [
        "by",
        "k"
      ],
      "type": "object"
    },
    "main": {
      "description": "Gift backlinks for one player: gifts other players set down or sent for them (gifts[].to = did), which of their own gifts others have accepted (giftsAccepted[].from = did), and which others sent back (giftsReturned[].from = did). Served by getGiftState.lua.",
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "accepted": {
              "items": {
                "ref": "#acceptance",
                "type": "ref"
              },
              "type": "array"
            },
            "incoming": {
              "description": "quest.cozysky.save#gift entries addressed to did (set down in their grove, or sent: no area), each with the giver added as 'from'.",
              "items": {
                "type": "unknown"
              },
              "type": "array"
            },
            "returned": {
              "description": "did's gifts that the fren sent back; did's client takes them back into hand. Absent from older index scripts.",
              "items": {
                "ref": "#acceptance",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "incoming",
            "accepted"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "did": {
            "format": "did",
            "type": "string"
          }
        },
        "required": [
          "did"
        ],
        "type": "params"
      },
      "type": "query"
    }
  },
  "id": "quest.cozysky.getGiftState",
  "lexicon": 1
}
```
