-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
52 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Nager.PublicSuffix.WebApi.GitHub.Models; | ||
|
||
namespace Nager.PublicSuffix.WebApi.GitHub | ||
{ | ||
/// <summary> | ||
/// GitHub Client | ||
/// </summary> | ||
public class GitHubClient | ||
{ | ||
private readonly HttpClient _httpClient; | ||
|
||
/// <summary> | ||
/// GitHub Client | ||
/// </summary> | ||
/// <param name="httpClient"></param> | ||
public GitHubClient(HttpClient httpClient) | ||
{ | ||
this._httpClient = httpClient; | ||
this._httpClient.DefaultRequestHeaders.Add("User-Agent", "Nager.PublicSuffix"); | ||
} | ||
|
||
/// <summary> | ||
/// GetCommitAsync | ||
/// </summary> | ||
/// <param name="owner"></param> | ||
/// <param name="repository"></param> | ||
/// <param name="branch"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
public async Task<GitHubCommit?> GetCommitAsync( | ||
string owner, | ||
string repository, | ||
string branch, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
var requestUri = $"https://api.github.com/repos/{owner}/{repository}/commits/{branch}"; | ||
|
||
return await this._httpClient.GetFromJsonAsync<GitHubCommit>(requestUri, cancellationToken); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ager.PublicSuffix.WebApi/Models/Author.cs → ...blicSuffix.WebApi/GitHub/Models/Author.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
....PublicSuffix.WebApi/Models/CommitInfo.cs → ...Suffix.WebApi/GitHub/Models/CommitInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...r.PublicSuffix.WebApi/Models/Committer.cs → ...cSuffix.WebApi/GitHub/Models/Committer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Nager.PublicSuffix.WebApi/Models/File.cs → ...PublicSuffix.WebApi/GitHub/Models/File.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ublicSuffix.WebApi/Models/GitHubCommit.cs → ...ffix.WebApi/GitHub/Models/GitHubCommit.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Nager.PublicSuffix.WebApi/Models/Tree.cs → ...PublicSuffix.WebApi/GitHub/Models/Tree.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ublicSuffix.WebApi/Models/Verification.cs → ...ffix.WebApi/GitHub/Models/Verification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters