# pet.trezy.resolveFeeding

> Published by [trezy.pet](https://lexicon.garden/identity/did:plc:ollch4g7tes2reb5eceiwuol)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:ollch4g7tes2reb5eceiwuol/pet.trezy.resolveFeeding)
- [Documentation](https://lexicon.garden/lexicon/did:plc:ollch4g7tes2reb5eceiwuol/pet.trezy.resolveFeeding/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:ollch4g7tes2reb5eceiwuol/pet.trezy.resolveFeeding/examples)

## Definitions

### `pet.trezy.resolveFeeding#drop`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `x` | `integer` | Yes |  |
| `food` | `string` | Yes |  |
| `rkey` | `string` | Yes |  |
| `droppedAt` | `string` (datetime) | Yes |  |

### `pet.trezy.resolveFeeding`

**Type**: `procedure`

Settle what happened in the terrarium while nobody was watching, and report the state feeding needs. Called on load. HappyView has no scheduler — the only job trigger is job.run:<type>, fired by jobs.create — so an absence is replayed here rather than ticked by a cron. The player cannot tell the difference: they close the tab with four morsels down and come back to find the pets fed and one morsel left. What they gain is that the gap is computed at the moment it can be REPORTED, and that resolution runs while their OAuth session is definitely alive, which a background job could not rely on.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `drops` | `array` | No | The terrarium as it stands AFTER resolution: the client's opening morsel list, so load is one call rather than two. |
| `eaten` | `array` | No | What was eaten during the absence, oldest first — the homecoming's material. Empty when nothing was. |
| `error` | `string` | No | Present instead of the answer. A stable machine code the client branches on — add codes, never rename them. ⚠ THE CLIENT MUST TREAT A REFUSAL AS 'UNKNOWN', NEVER AS 'NOBODY IS HUNGRY': the first stops pets claiming food, the second would render a world where nothing is ever hungry and quietly disable feeding. |
| `message` | `string` | No |  |
| `deadlines` | `array` | No | How long until each staged pet may be fed again. ⚠ EVERY STAGED PET APPEARS HERE, INCLUDING ONES THAT DID NOT EAT. The client reads a pet missing from this list as 'not known yet' and excludes it from claiming food entirely, so an omission is a pet that can never be fed. This is also the only thing that tells a client every pet's cooldown at once: getPets returns at-uris only, and getStats answers for one pet. |

### `pet.trezy.resolveFeeding#eaten`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `pet` | `string` (at-uri) | Yes |  |
| `food` | `string` | Yes |  |
| `eatenAt` | `string` (datetime) | Yes | When the pet would have eaten it — in the past, since the whole point is that this already happened. The matching pet.trezy.activity carries the same value as its createdAt. |

### `pet.trezy.resolveFeeding#deadline`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `pet` | `string` (at-uri) | Yes |  |
| `feedCooldownRemaining` | `integer` | Yes | Seconds until this pet may be fed again; 0 means hungry now. Named to match getStats, which reports the same quantity for a single pet. |

## Raw Schema

```json
{
  "id": "pet.trezy.resolveFeeding",
  "defs": {
    "drop": {
      "type": "object",
      "required": [
        "rkey",
        "food",
        "x",
        "droppedAt"
      ],
      "properties": {
        "x": {
          "type": "integer"
        },
        "food": {
          "type": "string"
        },
        "rkey": {
          "type": "string"
        },
        "droppedAt": {
          "type": "string",
          "format": "datetime"
        }
      }
    },
    "main": {
      "type": "procedure",
      "input": {
        "schema": {
          "type": "object",
          "required": [],
          "properties": {}
        },
        "encoding": "application/json"
      },
      "output": {
        "schema": {
          "type": "object",
          "required": [],
          "properties": {
            "drops": {
              "type": "array",
              "items": {
                "ref": "#drop",
                "type": "ref"
              },
              "description": "The terrarium as it stands AFTER resolution: the client's opening morsel list, so load is one call rather than two."
            },
            "eaten": {
              "type": "array",
              "items": {
                "ref": "#eaten",
                "type": "ref"
              },
              "description": "What was eaten during the absence, oldest first — the homecoming's material. Empty when nothing was."
            },
            "error": {
              "type": "string",
              "description": "Present instead of the answer. A stable machine code the client branches on — add codes, never rename them. ⚠ THE CLIENT MUST TREAT A REFUSAL AS 'UNKNOWN', NEVER AS 'NOBODY IS HUNGRY': the first stops pets claiming food, the second would render a world where nothing is ever hungry and quietly disable feeding.",
              "knownValues": [
                "not-authenticated",
                "unavailable"
              ]
            },
            "message": {
              "type": "string"
            },
            "deadlines": {
              "type": "array",
              "items": {
                "ref": "#deadline",
                "type": "ref"
              },
              "description": "How long until each staged pet may be fed again. ⚠ EVERY STAGED PET APPEARS HERE, INCLUDING ONES THAT DID NOT EAT. The client reads a pet missing from this list as 'not known yet' and excludes it from claiming food entirely, so an omission is a pet that can never be fed. This is also the only thing that tells a client every pet's cooldown at once: getPets returns at-uris only, and getStats answers for one pet."
            }
          }
        },
        "encoding": "application/json"
      },
      "description": "Settle what happened in the terrarium while nobody was watching, and report the state feeding needs. Called on load. HappyView has no scheduler — the only job trigger is job.run:<type>, fired by jobs.create — so an absence is replayed here rather than ticked by a cron. The player cannot tell the difference: they close the tab with four morsels down and come back to find the pets fed and one morsel left. What they gain is that the gap is computed at the moment it can be REPORTED, and that resolution runs while their OAuth session is definitely alive, which a background job could not rely on."
    },
    "eaten": {
      "type": "object",
      "required": [
        "pet",
        "food",
        "eatenAt"
      ],
      "properties": {
        "pet": {
          "type": "string",
          "format": "at-uri"
        },
        "food": {
          "type": "string"
        },
        "eatenAt": {
          "type": "string",
          "format": "datetime",
          "description": "When the pet would have eaten it — in the past, since the whole point is that this already happened. The matching pet.trezy.activity carries the same value as its createdAt."
        }
      }
    },
    "deadline": {
      "type": "object",
      "required": [
        "pet",
        "feedCooldownRemaining"
      ],
      "properties": {
        "pet": {
          "type": "string",
          "format": "at-uri"
        },
        "feedCooldownRemaining": {
          "type": "integer",
          "minimum": 0,
          "description": "Seconds until this pet may be fed again; 0 means hungry now. Named to match getStats, which reports the same quantity for a single pet."
        }
      }
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
