diff --git a/Octokit.Tests.Integration/Clients/RepositoryCommitsClientTests.cs b/Octokit.Tests.Integration/Clients/RepositoryCommitsClientTests.cs index f862366702..7013c2cc32 100644 --- a/Octokit.Tests.Integration/Clients/RepositoryCommitsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/RepositoryCommitsClientTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Reactive.Threading.Tasks; using System.Threading.Tasks; using Octokit; @@ -33,6 +34,14 @@ public async Task CanGetCommit() Assert.NotNull(commit); } + [IntegrationTest] + public async Task CanGetCommitWithFiles() + { + var commit = await _fixture.Get("octokit", "octokit.net", "65a22f4d2cff94a286ac3e96440c810c5509196f"); + + Assert.True(commit.Files.Any(file => file.Filename.EndsWith("IConnection.cs"))); + } + [IntegrationTest] public async Task CanGetListOfCommits() { diff --git a/Octokit/Models/Response/GitHubCommit.cs b/Octokit/Models/Response/GitHubCommit.cs index 315910396b..537df885c3 100644 --- a/Octokit/Models/Response/GitHubCommit.cs +++ b/Octokit/Models/Response/GitHubCommit.cs @@ -15,5 +15,6 @@ public class GitHubCommit : GitReference public Author Committer { get; set; } public string HtmlUrl { get; set; } public IReadOnlyList Parents { get; set; } + public IReadOnlyList Files { get; set; } } } diff --git a/Octokit/Models/Response/GitHubCommitFile.cs b/Octokit/Models/Response/GitHubCommitFile.cs new file mode 100644 index 0000000000..9f2b799582 --- /dev/null +++ b/Octokit/Models/Response/GitHubCommitFile.cs @@ -0,0 +1,68 @@ +using System; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; + +namespace Octokit +{ + /// + /// The affected files in a . + /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] + public class GitHubCommitFile + { + /// + /// The name of the file + /// + [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")] + public string Filename { get; set; } + + /// + /// Number of additions performed on the file. + /// + public int Additions { get; set; } + + /// + /// Number of deletions performed on the file. + /// + public int Deletions { get; set; } + + /// + /// Number of changes performed on the file. + /// + public int Changes { get; set; } + + /// + /// File status, like modified, added, deleted. + /// + public string Status { get; set; } + + /// + /// The url to the file blob. + /// + public string BlobUrl { get; set; } + + /// + /// The url to file contents API. + /// + public string ContentsUrl { get; set; } + + /// + /// The raw url to download the file. + /// + public string RawUrl { get; set; } + + /// + /// The SHA of the file. + /// + public string Sha { get; set; } + + internal string DebuggerDisplay + { + get + { + return String.Format(CultureInfo.InvariantCulture, "Filename: {0} ({1})", Filename, Status); + } + } + } +} \ No newline at end of file diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index ad2ea27641..7cd0d7d0e9 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -77,6 +77,7 @@ +