| 1 | # This file was auto-generated by Fern from our API Definition. |
| 2 | |
| 3 | import json |
| 4 | from dataclasses import dataclass |
| 5 | from typing import Any, Optional |
| 6 | |
| 7 | |
| 8 | @dataclass(frozen=True) |
| 9 | class ServerSentEvent: |
| 10 | event: str = "message" |
| 11 | data: str = "" |
| 12 | id: str = "" |
| 13 | retry: Optional[int] = None |
| 14 | |
| 15 | def json(self) -> Any: |
| 16 | """Parse the data field as JSON.""" |
| 17 | return json.loads(self.data) |