# `PaperTiger.Hydrator`
[🔗](https://github.com/EnaiaInc/paper_tiger/blob/v1.2.2/lib/paper_tiger/hydrator.ex#L1)

Expands nested object references based on `expand[]` query parameters.

Stripe allows expanding related objects in responses. Instead of returning
just an ID, the full object is returned.

## Examples

    # Without expansion
    %Subscription{customer: "cus_123"}

    # With expand[]=customer
    %Subscription{customer: %Customer{id: "cus_123", email: "..."}}

    # Nested expansion: expand[]=customer.default_source
    %Subscription{
      customer: %Customer{
        id: "cus_123",
        default_source: %Card{id: "card_123", last4: "4242"}
      }
    }

## Usage

    # In resource handlers
    expand_params = parse_expand_params(conn.query_params)
    hydrated = PaperTiger.Hydrator.hydrate(subscription, expand_params)

# `fetch_by_id`

```elixir
@spec fetch_by_id(String.t()) :: {:ok, map()} | {:error, :not_found | :unknown_prefix}
```

Fetches a resource by ID from the appropriate store.

Automatically determines the correct store based on the ID prefix.

# `hydrate`

```elixir
@spec hydrate(map() | struct(), [String.t()]) :: map() | struct()
```

Hydrates a resource by expanding specified fields.
...

---

*Consult [api-reference.md](api-reference.md) for complete listing*
