# Конверт события: CloudEvents

Каждое событие живого потока — объект [CloudEvents 1.0](https://cloudevents.io/) с одинаковым набором полей. Поле `data` содержит данные, которые зависят от типа события.

## Поля

Конверт CloudEvents 1.0 в формате JSON.

| Поле | Тип | Описание |
|---|---|---|
| `specversion` | строка, всегда `1.0` |  |
| `id` | строка, `evt_…` | у каждого события своё: см. [события](#события) |
| `type` | строка | у каждого события своё: см. [события](#события) |
| `source` | строка (ссылка), всегда `https://api.donatty.com/v1/streamer` |  |
| `subject` | строка | у каждого события своё: см. [события](#события) |
| `time` | строка (дата и время) | Когда событие записано, RFC 3339 в UTC. |
| `datacontenttype` | строка, всегда `application/json` |  |
| `dataschema` | строка (ссылка) | у каждого события своё: см. [события](#события) |
| `data` | объект | у каждого события своё: см. [события](#события) |

## Пример

```json
{
  "specversion": "1.0",
  "id": "evt_1f0b7c52-3a9e-4d16-8c41-6e5d2a9b7f03",
  "type": "donation.created",
  "source": "https://api.donatty.com/v1/streamer",
  "subject": "don_0f6e2a4c-91b3-4d7a-8c5e-3b2a1f0e9d84",
  "time": "2026-11-09T10:15:30.123456Z",
  "datacontenttype": "application/json",
  "dataschema": "https://api.donatty.com/v1/asyncapi.yaml#/components/schemas/DonationEventData",
  "data": {
    "id": "don_0f6e2a4c-91b3-4d7a-8c5e-3b2a1f0e9d84",
    "createdAt": "2026-11-09T10:15:30.123456Z",
    "source": "DONATTY",
    "donorName": "Alex",
    "message": "Thanks for the stream!",
    "amount": {
      "value": "500.00",
      "currency": "RUB"
    },
    "feeCompensation": null,
    "paymentMethod": "SBP",
    "goal": {
      "id": "goal_7e3a9c10-4b2d-4f8e-a1c6-0d9b8e7f6a52",
      "title": "New microphone"
    },
    "moderation": {
      "status": "PENDING",
      "deadline": "2026-11-09T10:16:30Z"
    },
    "media": {
      "title": "Song of the day",
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
      "provider": "YOUTUBE",
      "durationSeconds": 212,
      "moderation": {
        "status": "PENDING",
        "deadline": "2026-11-09T10:16:30Z"
      }
    },
    "isTest": false
  }
}
```

## События

| Событие | Канал |
|---|---|
| [`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) |
