mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-09 04:56:29 +00:00
added overloads on I(Observable)RepositoryCommitsClient
This commit is contained in:
@@ -34,6 +34,21 @@ namespace Octokit
|
||||
return ApiConnection.Get<CompareResult>(ApiUrls.RepoCompare(owner, name, @base, head));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compare two references in a repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="base">The reference to use as the base commit</param>
|
||||
/// <param name="head">The reference to use as the head commit</param>
|
||||
/// <returns>A <see cref="CompareResult"/> for the specified references.</returns>
|
||||
public Task<CompareResult> Compare(int repositoryId, string @base, string head)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(@base, "base");
|
||||
Ensure.ArgumentNotNullOrEmptyString(head, "head");
|
||||
|
||||
return ApiConnection.Get<CompareResult>(ApiUrls.RepoCompare(repositoryId, @base, head));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single commit for a given repository
|
||||
/// </summary>
|
||||
@@ -50,6 +65,19 @@ namespace Octokit
|
||||
return ApiConnection.Get<GitHubCommit>(ApiUrls.RepositoryCommit(owner, name, reference));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single commit for a given repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="reference">The reference for the commit (SHA)</param>
|
||||
/// <returns>A <see cref="GitHubCommit"/> for the specified commit SHA.</returns>
|
||||
public Task<GitHubCommit> Get(int repositoryId, string reference)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
|
||||
|
||||
return ApiConnection.Get<GitHubCommit>(ApiUrls.RepositoryCommit(repositoryId, reference));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all commits for a given repository
|
||||
/// </summary>
|
||||
@@ -64,6 +92,16 @@ namespace Octokit
|
||||
return GetAll(owner, name, new CommitRequest(), ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all commits for a given repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <returns>A <see cref="IReadOnlyList{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
|
||||
public Task<IReadOnlyList<GitHubCommit>> GetAll(int repositoryId)
|
||||
{
|
||||
return GetAll(repositoryId, new CommitRequest(), ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all commits for a given repository
|
||||
/// </summary>
|
||||
@@ -79,6 +117,17 @@ namespace Octokit
|
||||
return GetAll(owner, name, new CommitRequest(), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all commits for a given repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns>A <see cref="IReadOnlyList{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
|
||||
public Task<IReadOnlyList<GitHubCommit>> GetAll(int repositoryId, ApiOptions options)
|
||||
{
|
||||
return GetAll(repositoryId, new CommitRequest(), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all commits for a given repository
|
||||
/// </summary>
|
||||
@@ -95,6 +144,19 @@ namespace Octokit
|
||||
return GetAll(owner, name, request, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all commits for a given repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="request">Used to filter list of commits returned</param>
|
||||
/// <returns>A <see cref="IReadOnlyList{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
|
||||
public Task<IReadOnlyList<GitHubCommit>> GetAll(int repositoryId, CommitRequest request)
|
||||
{
|
||||
Ensure.ArgumentNotNull(request, "request");
|
||||
|
||||
return GetAll(repositoryId, request, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all commits for a given repository
|
||||
/// </summary>
|
||||
@@ -108,10 +170,26 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(request, "request");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return ApiConnection.GetAll<GitHubCommit>(ApiUrls.RepositoryCommits(owner, name), request.ToParametersDictionary(), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all commits for a given repository
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="request">Used to filter list of commits returned</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns>A <see cref="IReadOnlyList{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
|
||||
public Task<IReadOnlyList<GitHubCommit>> GetAll(int repositoryId, CommitRequest request, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNull(request, "request");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return ApiConnection.GetAll<GitHubCommit>(ApiUrls.RepositoryCommits(repositoryId), request.ToParametersDictionary(), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the SHA-1 of a commit reference
|
||||
/// </summary>
|
||||
@@ -127,5 +205,18 @@ namespace Octokit
|
||||
|
||||
return ApiConnection.Get<string>(ApiUrls.RepositoryCommit(owner, name, reference), null, AcceptHeaders.CommitReferenceSha1Preview);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the SHA-1 of a commit reference
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="reference">The repository reference</param>
|
||||
/// <returns>A <see cref="string"/> for the specified repository reference.</returns>
|
||||
public Task<string> GetSha1(int repositoryId, string reference)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
|
||||
|
||||
return ApiConnection.Get<string>(ApiUrls.RepositoryCommit(repositoryId, reference), null, AcceptHeaders.CommitReferenceSha1Preview);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user