VodOnDemand.TwitchEverywhere.Rest
0.9.0
dotnet add package VodOnDemand.TwitchEverywhere.Rest --version 0.9.0
NuGet\Install-Package VodOnDemand.TwitchEverywhere.Rest -Version 0.9.0
<PackageReference Include="VodOnDemand.TwitchEverywhere.Rest" Version="0.9.0" />
<PackageVersion Include="VodOnDemand.TwitchEverywhere.Rest" Version="0.9.0" />
<PackageReference Include="VodOnDemand.TwitchEverywhere.Rest" />
paket add VodOnDemand.TwitchEverywhere.Rest --version 0.9.0
#r "nuget: VodOnDemand.TwitchEverywhere.Rest, 0.9.0"
#:package VodOnDemand.TwitchEverywhere.Rest@0.9.0
#addin nuget:?package=VodOnDemand.TwitchEverywhere.Rest&version=0.9.0
#tool nuget:?package=VodOnDemand.TwitchEverywhere.Rest&version=0.9.0
TwitchEverywhere.Rest
TwitchEverywhere.Rest is a .NET library that allows connecting to the Twitch Helix API and making REST calls to it using System.Text.Json.
The goal of this library is to provide a lightweight, strongly typed API for clients so they can avoid parsing raw strings as much as possible.
The library will support the latest LTS version of .NET and non LTS versions IF it is newer than the LTS version. So for example before .NET 8, the library supported .NET 6 (LTS) and 7 but once .NET 8 was released support for 6 and 7 was dropped.
How To Use It
You will need to provide the following values as parameters to the TwitchEverywhere.Core.TwitchConnectionOptions record:
TwitchConnectionOptions options = new(
Channel: channel,
AccessToken: accessToken,
RefreshToken: refreshToken,
ClientId: clientId,
ClientSecret: clientSecret,
ClientName: clientName
);
Then initialize RestClient and pass in the options to the constructor.
Finally call the appropriate API:
RestClient restClient = new( options );
GetUsersResponse users = await m_restClient.GetUsersByLogin(
logins: [ "userLogin" ]
);
if (users.StatusCode != HttpStatusCode.OK) {
Console.WriteLine( "Error in GetUsers request with status code: " + users.StatusCode );
return;
}
And that's it, you have successfully made a call to the Helix API! 🎉
Sample CLI App
There is a sample CLI application here that is included as an example in this repo and you can use it to connect with Twitch – give it a try!
In order to connect you need to create an appsettings.json file in the root of the TwitchEverywhereCLI project with the following parameters:
{
"AccessToken": "your_twitch_access_token",
"RefreshToken": "your_twitch_refresh_token",
"ClientId": "your_client_id",
"ClientSecret": "your_client_secret",
"ClientName": "your_client_name_all_lowercase",
"Channel": "channel_you_want_to_connect_to"
}
Performance
See the README in the TwitchEverywhere.Benchmark project here
Note that currently there are no benchmarks for TwitchEverywhere.Rest but they will be added in the future.
Supported Functionality
Twitch Helix API
Users
| Endpoint | Supported | API Link |
|---|---|---|
| Get Users | ✅ | https://dev.twitch.tv/docs/api/reference/#get-users |
| Update User | ✅ | https://dev.twitch.tv/docs/api/reference/#update-user |
| Get User Block List | ✅ | https://dev.twitch.tv/docs/api/reference/#get-user-block-list |
| Block User | ✅ | https://dev.twitch.tv/docs/api/reference/#block-user |
Videos
| Endpoint | Supported | API Link |
|---|---|---|
| Get Videos | ✅ | https://dev.twitch.tv/docs/api/reference/#get-videos |
Channels
| Endpoint | Supported | API Link |
|---|---|---|
| Get Channel Info | ✅ | https://dev.twitch.tv/docs/api/reference/#get-channel-information |
Streams
| Endpoint | Supported | API Link |
|---|---|---|
| Get Streams | ✅ | https://dev.twitch.tv/docs/api/reference/#get-streams |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- VodOnDemand.TwitchEverywhere.Core (>= 0.9.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.