openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
src/Utility/ServerSentEvent.cs
24lines · modecode
| 1 | #nullable enable |
| 2 | |
| 3 | namespace OpenAI; |
| 4 | |
| 5 | /// <summary> |
| 6 | /// Represents an SSE event. |
| 7 | /// See SSE specification: https://html.spec.whatwg.org/multipage/server-sent-events.html |
| 8 | /// </summary> |
| 9 | internal readonly struct ServerSentEvent |
| 10 | { |
| 11 | // Gets the value of the SSE "event type" buffer, used to distinguish |
| 12 | // between event kinds. |
| 13 | public string EventType { get; } |
| 14 | |
| 15 | // Gets the value of the SSE "data" buffer, which holds the payload of the |
| 16 | // server-sent event. |
| 17 | public string Data { get; } |
| 18 | |
| 19 | public ServerSentEvent(string type, string data) |
| 20 | { |
| 21 | EventType = type; |
| 22 | Data = data; |
| 23 | } |
| 24 | } |
| 25 | |