# Структуры ответов и событий

Здесь описаны тела ответов REST и события живого потока. Таблицы полей и примеры берутся из описаний API — [OpenAPI](https://api.donatty.com/v1/openapi.json) и [AsyncAPI](https://api.donatty.com/v1/asyncapi.yaml), поэтому совпадают с тем, что отдаёт сервер.

## Как читать таблицы

- **Тип** — строка, целое число, true или false, объект или список. «или null» значит, что поле может прийти со значением `null`.
- По умолчанию поле присутствует в ответе, даже если его значение `null`. Если поле может отсутствовать, рядом с его именем написано «может отсутствовать».
- ID, время и деньги — общие форматы в разделе [«Деньги, форматы и списки»](https://developers.donatty.com/data.md#форматы); схемы денег `Money` и `ExactMoney` — ниже.
- Незнакомые поля и новые значения — в разделе [«Совместимость»](https://developers.donatty.com/changelog.md#совместимость).

## `Money`

**Входит в:** [`Donation`](https://developers.donatty.com/structures/donation.md#donation), [`Goal`](https://developers.donatty.com/structures/goal.md#goal), [`Top`](https://developers.donatty.com/structures/stats.md#top), [`Total`](https://developers.donatty.com/structures/stats.md#total)

| Поле | Тип | Описание |
|---|---|---|
| `value` | строка | Десятичная сумма с двумя знаками после запятой. |
| `currency` | строка | Код ISO 4217. |

### Пример

```json
{
  "value": "500.00",
  "currency": "RUB"
}
```

## `ExactMoney`

**Входит в:** [`PlatformEvent`](https://developers.donatty.com/structures/platform-event.md#platformevent)

Точная сумма платформы без округления: в отличие от `Money`, дробная часть не обрезается до двух знаков. В ней не меньше минорных единиц валюты (`5.00` USD, `500` JPY, `1.500` KWD) и больше знаков, если платформа прислала больше.

| Поле | Тип | Описание |
|---|---|---|
| `value` | строка | Десятичная сумма, до шести знаков после точки, без округления. |
| `currency` | строка | Код валюты, как его прислала платформа: у YouTube — ISO 4217. Сумма не пересчитывается. |

## Ответы REST

| Структура | Метод |
|---|---|
| [`Money`](https://developers.donatty.com/structures.md#money) | внутри других структур |
| [`ExactMoney`](https://developers.donatty.com/structures.md#exactmoney) | внутри других структур |
| [`Streamer`](https://developers.donatty.com/structures/streamer.md#streamer) | [`GET /v1/streamer`](https://developers.donatty.com/reference/streamer.md) |
| [`Donation`](https://developers.donatty.com/structures/donation.md#donation) | [`GET /v1/donations`](https://developers.donatty.com/reference/donations.md) |
| [`DonationPage`](https://developers.donatty.com/structures/donation.md#donationpage) | [`GET /v1/donations`](https://developers.donatty.com/reference/donations.md) |
| [`Goal`](https://developers.donatty.com/structures/goal.md#goal) | [`GET /v1/goals`](https://developers.donatty.com/reference/goals.md) |
| [`GoalPage`](https://developers.donatty.com/structures/goal.md#goalpage) | [`GET /v1/goals`](https://developers.donatty.com/reference/goals.md) |
| [`Top`](https://developers.donatty.com/structures/stats.md#top) | [`GET /v1/stats/top`](https://developers.donatty.com/reference/stats-top.md) |
| [`Total`](https://developers.donatty.com/structures/stats.md#total) | [`GET /v1/stats/total`](https://developers.donatty.com/reference/stats-total.md) |
| [`PlatformEvent`](https://developers.donatty.com/structures/platform-event.md#platformevent) | [`GET /v1/platform-events`](https://developers.donatty.com/reference/platform-events.md) |
| [`PlatformEventPage`](https://developers.donatty.com/structures/platform-event.md#platformeventpage) | [`GET /v1/platform-events`](https://developers.donatty.com/reference/platform-events.md) |
| [`SourceStatus`](https://developers.donatty.com/structures/event-source.md#sourcestatus) | [`GET /v1/event-sources`](https://developers.donatty.com/reference/event-sources.md) |
| [`SourceStatusList`](https://developers.donatty.com/structures/event-source.md#sourcestatuslist) | [`GET /v1/event-sources`](https://developers.donatty.com/reference/event-sources.md) |
| [`Problem`](https://developers.donatty.com/structures/problem.md#problem) | Все методы |

## События потока

| Событие | Канал |
|---|---|
| [`donation.created`](https://developers.donatty.com/structures/donation-events.md#donationcreated) | [`donations`](https://developers.donatty.com/realtime/channels.md) |
| [`donation.moderated`](https://developers.donatty.com/structures/donation-events.md#donationmoderated) | [`donations`](https://developers.donatty.com/realtime/channels.md) |
| [`donation.replayed`](https://developers.donatty.com/structures/donation-events.md#donationreplayed) | [`donations`](https://developers.donatty.com/realtime/channels.md) |
| [`goal.updated`](https://developers.donatty.com/structures/goal-events.md#goalupdated) | [`goals`](https://developers.donatty.com/realtime/channels.md) |
| [`twitch.follow`](https://developers.donatty.com/structures/twitch-events.md#twitchfollow) | [`twitch`](https://developers.donatty.com/realtime/channels.md) |
| [`twitch.subscription`](https://developers.donatty.com/structures/twitch-events.md#twitchsubscription) | [`twitch`](https://developers.donatty.com/realtime/channels.md) |
| [`twitch.subscription.gift`](https://developers.donatty.com/structures/twitch-events.md#twitchsubscriptiongift) | [`twitch`](https://developers.donatty.com/realtime/channels.md) |
| [`twitch.subscription.received`](https://developers.donatty.com/structures/twitch-events.md#twitchsubscriptionreceived) | [`twitch`](https://developers.donatty.com/realtime/channels.md) |
| [`twitch.cheer`](https://developers.donatty.com/structures/twitch-events.md#twitchcheer) | [`twitch`](https://developers.donatty.com/realtime/channels.md) |
| [`twitch.raid`](https://developers.donatty.com/structures/twitch-events.md#twitchraid) | [`twitch`](https://developers.donatty.com/realtime/channels.md) |
| [`twitch.reward.redeemed`](https://developers.donatty.com/structures/twitch-events.md#twitchrewardredeemed) | [`twitch`](https://developers.donatty.com/realtime/channels.md) |
| [`twitch.hype_train.level_changed`](https://developers.donatty.com/structures/twitch-events.md#twitchhype_trainlevel_changed) | [`twitch`](https://developers.donatty.com/realtime/channels.md) |
| [`youtube.subscriber`](https://developers.donatty.com/structures/youtube-events.md#youtubesubscriber) | [`youtube`](https://developers.donatty.com/realtime/channels.md) |
| [`youtube.member`](https://developers.donatty.com/structures/youtube-events.md#youtubemember) | [`youtube`](https://developers.donatty.com/realtime/channels.md) |
| [`youtube.super_chat`](https://developers.donatty.com/structures/youtube-events.md#youtubesuper_chat) | [`youtube`](https://developers.donatty.com/realtime/channels.md) |
| [`youtube.super_sticker`](https://developers.donatty.com/structures/youtube-events.md#youtubesuper_sticker) | [`youtube`](https://developers.donatty.com/realtime/channels.md) |
| [`source.status_changed`](https://developers.donatty.com/structures/service-events.md#sourcestatus_changed) | [`donations`](https://developers.donatty.com/realtime/channels.md), [`twitch`](https://developers.donatty.com/realtime/channels.md), [`youtube`](https://developers.donatty.com/realtime/channels.md) |
