# `MishkaPay.Ash.Object.Spec`
[🔗](https://github.com/mishka-group/mishka_pay/blob/v0.0.1/lib/mishka_pay/ash/__object/spec.ex#L6)

What the provider objects a site manages from its admin keep and do, kind by kind: products,
prices, coupons, promotion codes, payment links and one-off bills (the `:product`, `:price`,
`:coupon`, `:promotion_code`, `:payment_link` and `:invoice` kinds of
`MishkaPay.Ash.Resource`). Each kind names the provider object its webhook events are about,
how to read one again, the row it writes from the provider's answer, and the `MishkaPay` call
of each of its actions. `MishkaPay.Ash.Object.Change` and `MishkaPay.Ash.Object.Listener` run
them.

# `attributes`

```elixir
@spec attributes(struct()) :: map()
```

The row's attributes from the provider's object.

# `call`

```elixir
@spec call(atom(), atom(), map()) :: {:ok, struct()} | :ok | {:error, term()}
```

The `MishkaPay` call of an action: `:add` makes the object from the action's input, the
others act on the row's object. `input` holds the action's arguments set, with `:provider`,
`:tenant` and, on a row, `:id`.

# `capability`

```elixir
@spec capability(atom()) :: MishkaPay.Provider.capability()
```

The provider capability that reads a kind's object: a provider without it cannot give one, so
an event about such an object is not for this kind.

# `fetch`

```elixir
@spec fetch(atom(), String.t(), String.t(), term()) ::
  {:ok, struct()} | {:error, term()}
```

Reads one object of `kind` again from its provider.

# `id_argument`

```elixir
@spec id_argument(atom()) :: atom()
```

The `:sync` argument that names the object: `:product_id`, `:invoice_id`...

# `kinds`

```elixir
@spec kinds() :: [atom()]
```

The kinds of provider objects a site manages from its admin.

# `object`

```elixir
@spec object(atom()) :: String.t()
```

The provider's name of the object a kind keeps, as its webhook events name it.

---

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