@@ -55,7 +55,7 @@ using GitHub.Octokit.Client.Authentication;
55
55
56
56
var tokenProvider = new TokenProvider (Environment .GetEnvironmentVariable (" GITHUB_TOKEN" ) ?? " " );
57
57
var adapter = RequestAdapter .Create (new TokenAuthProvider (tokenProvider ));
58
- await MakeRequest ( new GitHubClient (adapter ) );
58
+ var gitHubClient = new GitHubClient (adapter );
59
59
60
60
try
61
61
{
@@ -84,6 +84,8 @@ var adapter = new ClientFactory()
84
84
.WithBaseUrl (" https://api.github.com" )
85
85
.Build ();
86
86
87
+ var gitHubClient = new GitHubClient (adapter );
88
+
87
89
try
88
90
{
89
91
var response = await gitHubClient .Repositories .GetAsync ();
@@ -102,21 +104,21 @@ This SDK supports [Personal Access Tokens (classic)](https://docs.github.com/en/
102
104
In order to use either type of Personal Access token, you can use the ` TokenAuthProvider ` constructor option when constructing a new token provider, like so:
103
105
104
106
``` csharp
105
- var tokenProvider = new TokenProvider (Environment .GetEnvironmentVariable (" GITHUB_TOKEN" ) ?? " " );
106
- var adapter = RequestAdapter .Create (new TokenAuthProvider (tokenProvider ));
107
- var gitHubClient = new GitHubClient (adapter );
107
+ var tokenProvider = new TokenProvider (Environment .GetEnvironmentVariable (" GITHUB_TOKEN" ) ?? " " );
108
+ var adapter = RequestAdapter .Create (new TokenAuthProvider (tokenProvider ));
109
+ var gitHubClient = new GitHubClient (adapter );
108
110
```
109
111
110
112
In order to authenticate as a GitHub App, you can use the ` AppInstallationAuthProvider ` constructor option:
111
113
112
114
``` csharp
113
- var githubAppTokenProvider = new GitHubAppTokenProvider ();
114
- var rsa = RSA .Create ();
115
- rsa .ImportFromPem (PRIVATE_KEY_PATH );
115
+ var githubAppTokenProvider = new GitHubAppTokenProvider ();
116
+ var rsa = RSA .Create ();
117
+ rsa .ImportFromPem (PRIVATE_KEY_PATH );
116
118
117
- var aiAccessTokenProvider = new AppInstallationTokenProvider (CLIENT_ID , rsa , INSTALLATION_ID , githubAppTokenProvider );
118
- var aiAdapter = RequestAdapter .Create (new AppInstallationAuthProvider (aiAccessTokenProvider ));
119
- var aiGitHubClient = new GitHubClient (aiAdapter );
119
+ var aiAccessTokenProvider = new AppInstallationTokenProvider (CLIENT_ID , rsa , INSTALLATION_ID , githubAppTokenProvider );
120
+ var aiAdapter = RequestAdapter .Create (new AppInstallationAuthProvider (aiAccessTokenProvider ));
121
+ var aiGitHubClient = new GitHubClient (aiAdapter );
120
122
```
121
123
122
124
To see more detailed examples, view [ the cli/ directory in this repo] ( cli/ ) .
0 commit comments