https://github.com/mewyk/twitchsharp
A modern C# .NET 10 library for the Twitch Helix API and EventSub WebSocket, designed for Native AOT.
https://github.com/mewyk/twitchsharp
aot-compatible csharp dotnet helix-api native-aot twitch twitch-api
Last synced: 4 months ago
JSON representation
A modern C# .NET 10 library for the Twitch Helix API and EventSub WebSocket, designed for Native AOT.
- Host: GitHub
- URL: https://github.com/mewyk/twitchsharp
- Owner: Mewyk
- License: mit
- Created: 2026-02-17T09:59:12.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-02-19T15:43:04.000Z (4 months ago)
- Last Synced: 2026-02-19T18:46:14.767Z (4 months ago)
- Topics: aot-compatible, csharp, dotnet, helix-api, native-aot, twitch, twitch-api
- Language: C#
- Homepage: https://github.com/Mewyk/TwitchSharp
- Size: 618 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# TwitchSharp
A .NET 10 library for the Twitch Helix API and EventSub WebSocket, designed for Native AOT from the ground up.
WARNING: I am currently handling getting the root namespace released back into the pool, so currently all package except the root namespace is on Nuget. Also, pleae be advised that this is an *alpha* release. Release 0.2.0 will have the full documentation once I get Nuget resolved.
## Features
- **Full Helix API coverage** -- 30 endpoint categories with typed request/response models
- **EventSub WebSocket client** -- real-time events with automatic reconnection and keepalive monitoring
- **Native AOT compatible** -- trimming-safe with source-generated JSON serialization (zero reflection)
- **Built-in resilience** -- automatic retries with exponential backoff, rate limiting, and token management
- **Dependency injection ready** -- first-class integration with `Microsoft.Extensions.Hosting`
- **Modern C# 14** -- sealed records, file-scoped namespaces, collection expressions, and `field` keyword
## Packages
| Package | Description |
|---------|-------------|
| `TwitchSharp` | Core primitives, exceptions, and pagination helpers |
| `TwitchSharp.Api` | Helix API client with authentication and rate limiting |
| `TwitchSharp.EventSub` | EventSub WebSocket client for real-time events |
| `TwitchSharp.Hosting` | Dependency injection and hosted service integration |
| `TwitchSharp.Extensions.Authentication` | Interactive OAuth PKCE flow for desktop/CLI apps |
## Quick Start
### Standalone usage
```csharp
await using var client = TwitchApiClient.Create(new TwitchApiClientOptions
{
ClientId = "your_client_id",
ClientSecret = "your_client_secret"
});
var users = await client.Users.GetUsersAsync(logins: ["twitchdev"]);
```
### With dependency injection
```csharp
var builder = Host.CreateApplicationBuilder(args);
builder.AddTwitchApi();
builder.AddTwitchEventSub();
var app = builder.Build();
app.Run();
```
Configure via `appsettings.json`:
```json
{
"Twitch": {
"ClientId": "your_client_id",
"ClientSecret": "your_client_secret"
}
}
```
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and coding guidelines.
## License
[MIT](LICENSE)