MHanafy.GithubClient
1.0.0
See the version list below for details.
dotnet add package MHanafy.GithubClient --version 1.0.0
NuGet\Install-Package MHanafy.GithubClient -Version 1.0.0
<PackageReference Include="MHanafy.GithubClient" Version="1.0.0" />
paket add MHanafy.GithubClient --version 1.0.0
#r "nuget: MHanafy.GithubClient, 1.0.0"
// Install MHanafy.GithubClient as a Cake Addin #addin nuget:?package=MHanafy.GithubClient&version=1.0.0 // Install MHanafy.GithubClient as a Cake Tool #tool nuget:?package=MHanafy.GithubClient&version=1.0.0
GithubClient
A .Net GitHub client that allows easy access to Github API, making developing Github apps a breaze.
To get started, you'll need to create a new Github App, this can be either private or public To create a new app, visit https://github.com/settings/apps
To use this library, you'll need:
- A private key, grab one by heading to your app's page, and selecting
Generate a private key
and download the key to your local machine - The AppId, which you can get from the settings page
Now, start using the library as follows:
var keyPath = "key.pem"; //The location of the Github private key
var appId = 0; //the App Id as shown on Github
await using var keyStream = File.OpenRead(keyPath);
var jwtTokenFactory = new JwtTokenFactory(keyStream, AppId);
var client = new GithubHttpClient(jwtTokenFactory);
//listing all installations that the app has access to
var installations = await client.GetInstallations();
//Get an installation token to access the first installation; tokens are then renewed automatically before expiry
var token = await client.GetInstallationToken(installationId);
//Start interacting with the installation using the installation token
var checkSuites = await client.GetCheckSuites(token, repo, pull.Head.Sha)
This library provides models for various Github objects, but you can also issue raw requests if some models are missing
var url = $"https://api.github.com/app/installations";
var payload = $"";
var result = await client.Execute(System.Net.Http.HttpMethod.Get, url, token, payload);
For detailed example, update the sample app settings.json
file with the App ID and the location of the private key file, and run it to see how easy it's to utilize github's new API from .Net.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- jwt (>= 5.3.1)
- Microsoft.Extensions.Options (>= 1.1.0)
- PemUtils (>= 3.0.0.81)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.