mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
Merge pull request #608 from kzu/IncludeFilesInCommit
Include files array in the github commit.
This commit is contained in:
@@ -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 class RepositoryCommitsClientTests : IDisposable
|
||||
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()
|
||||
{
|
||||
|
||||
@@ -15,5 +15,6 @@ namespace Octokit
|
||||
public Author Committer { get; set; }
|
||||
public string HtmlUrl { get; set; }
|
||||
public IReadOnlyList<GitReference> Parents { get; set; }
|
||||
public IReadOnlyList<GitHubCommitFile> Files { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
68
Octokit/Models/Response/GitHubCommitFile.cs
Normal file
68
Octokit/Models/Response/GitHubCommitFile.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
/// The affected files in a <see cref="GitHubCommit"/>.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class GitHubCommitFile
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the file
|
||||
/// </summary>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
|
||||
public string Filename { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of additions performed on the file.
|
||||
/// </summary>
|
||||
public int Additions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of deletions performed on the file.
|
||||
/// </summary>
|
||||
public int Deletions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of changes performed on the file.
|
||||
/// </summary>
|
||||
public int Changes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// File status, like modified, added, deleted.
|
||||
/// </summary>
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The url to the file blob.
|
||||
/// </summary>
|
||||
public string BlobUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The url to file contents API.
|
||||
/// </summary>
|
||||
public string ContentsUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The raw url to download the file.
|
||||
/// </summary>
|
||||
public string RawUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The SHA of the file.
|
||||
/// </summary>
|
||||
public string Sha { get; set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return String.Format(CultureInfo.InvariantCulture, "Filename: {0} ({1})", Filename, Status);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,6 +130,7 @@
|
||||
<Compile Include="Models\Response\GistFile.cs" />
|
||||
<Compile Include="Models\Response\GistFork.cs" />
|
||||
<Compile Include="Models\Response\GistHistory.cs" />
|
||||
<Compile Include="Models\Response\GitHubCommitFile.cs" />
|
||||
<Compile Include="Models\Response\GitReference.cs" />
|
||||
<Compile Include="Models\Response\GitTag.cs" />
|
||||
<Compile Include="Models\Response\Issue.cs" />
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
<Compile Include="Models\Response\Blob.cs" />
|
||||
<Compile Include="Models\Response\CommitStatus.cs" />
|
||||
<Compile Include="Models\Response\EventInfo.cs" />
|
||||
<Compile Include="Models\Response\GitHubCommitFile.cs" />
|
||||
<Compile Include="Models\Response\GitReference.cs" />
|
||||
<Compile Include="Models\Response\GitTag.cs" />
|
||||
<Compile Include="Models\Response\Issue.cs" />
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
<Compile Include="Models\Response\Blob.cs" />
|
||||
<Compile Include="Models\Response\CommitStatus.cs" />
|
||||
<Compile Include="Models\Response\EventInfo.cs" />
|
||||
<Compile Include="Models\Response\GitHubCommitFile.cs" />
|
||||
<Compile Include="Models\Response\GitReference.cs" />
|
||||
<Compile Include="Models\Response\GitTag.cs" />
|
||||
<Compile Include="Models\Response\Issue.cs" />
|
||||
@@ -345,5 +346,5 @@
|
||||
<Compile Include="Models\Request\CommitRequest.cs" />
|
||||
<Compile Include="Models\Response\RepositoryPermissions.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -221,6 +221,7 @@
|
||||
<Compile Include="Models\Response\GistFile.cs" />
|
||||
<Compile Include="Models\Response\GistFork.cs" />
|
||||
<Compile Include="Models\Response\GistHistory.cs" />
|
||||
<Compile Include="Models\Response\GitHubCommitFile.cs" />
|
||||
<Compile Include="Models\Response\GitReference.cs" />
|
||||
<Compile Include="Models\Response\GitTag.cs" />
|
||||
<Compile Include="Models\Response\EventInfo.cs" />
|
||||
|
||||
@@ -228,6 +228,7 @@
|
||||
<Compile Include="Models\Response\GistFile.cs" />
|
||||
<Compile Include="Models\Response\GistFork.cs" />
|
||||
<Compile Include="Models\Response\GistHistory.cs" />
|
||||
<Compile Include="Models\Response\GitHubCommitFile.cs" />
|
||||
<Compile Include="Models\Response\GitReference.cs" />
|
||||
<Compile Include="Models\Response\GitTag.cs" />
|
||||
<Compile Include="Models\Response\EventInfo.cs" />
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
<Compile Include="Models\Request\NewDeployKey.cs" />
|
||||
<Compile Include="Models\Request\PublicKey.cs" />
|
||||
<Compile Include="Models\Request\CommitRequest.cs" />
|
||||
<Compile Include="Models\Response\GitHubCommitFile.cs" />
|
||||
<Compile Include="Models\Response\RepositoryPermissions.cs" />
|
||||
<Compile Include="Models\Response\DeployKey.cs" />
|
||||
<Compile Include="Models\Request\OauthLoginRequest.cs" />
|
||||
|
||||
Reference in New Issue
Block a user