forked from petabridge/akka-bootcamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGithubClientFactory.cs
More file actions
27 lines (24 loc) · 817 Bytes
/
Copy pathGithubClientFactory.cs
File metadata and controls
27 lines (24 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using Octokit;
using Octokit.Internal;
namespace GithubActors
{
/// <summary>
/// Creates <see cref="GitHubClient"/> instances.
/// </summary>
public static class GithubClientFactory
{
/// <summary>
/// OAuth token - necessary to generate authenticated requests
/// and achieve non-terrible hourly API rate limit
/// </summary>
public static string OAuthToken { get; set; }
public static GitHubClient GetUnauthenticatedClient()
{
return new GitHubClient(new ProductHeaderValue("AkkaBootcamp-Unit3"));
}
public static GitHubClient GetClient()
{
return new GitHubClient(new ProductHeaderValue("AkkaBootcamp-Unit3"), new InMemoryCredentialStore(new Credentials(OAuthToken)));
}
}
}