added overloads on I(Observable)RepositoryCommitsClient

This commit is contained in:
aedampir@gmail.com
2016-06-06 14:16:44 +07:00
parent 04d3a2da95
commit 0cc37f861d
4 changed files with 301 additions and 0 deletions
@@ -22,6 +22,16 @@ namespace Octokit.Reactive
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "base")]
IObservable<CompareResult> Compare(string owner, string name, string @base, string 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="IObservable{CompareResult}"/> of <see cref="CompareResult"/> for the specified references.</returns>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "base")]
IObservable<CompareResult> Compare(int repositoryId, string @base, string head);
/// <summary>
/// Gets all commits for a given repository
/// </summary>
@@ -33,6 +43,16 @@ namespace Octokit.Reactive
Justification = "Method makes a network request")]
IObservable<GitHubCommit> Get(string owner, string name, string reference);
/// <summary>
/// Gets all commits for a given repository
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The reference for the commit</param>
/// <returns>A <see cref="IObservable{CompareResult}"/> of <see cref="GitHubCommit"/> for the specified commit SHA.</returns>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
IObservable<GitHubCommit> Get(int repositoryId, string reference);
/// <summary>
/// Gets all commits for a given repository
/// </summary>
@@ -41,6 +61,13 @@ namespace Octokit.Reactive
/// <returns>A <see cref="IObservable{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
IObservable<GitHubCommit> GetAll(string owner, string name);
/// <summary>
/// Gets all commits for a given repository
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>A <see cref="IObservable{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
IObservable<GitHubCommit> GetAll(int repositoryId);
/// <summary>
/// Gets all commits for a given repository
/// </summary>
@@ -50,6 +77,14 @@ namespace Octokit.Reactive
/// <returns>A <see cref="IObservable{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
IObservable<GitHubCommit> GetAll(string owner, string name, ApiOptions 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="IObservable{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
IObservable<GitHubCommit> GetAll(int repositoryId, ApiOptions options);
/// <summary>
/// Gets all commits for a given repository
/// </summary>
@@ -59,6 +94,14 @@ namespace Octokit.Reactive
/// <returns>A <see cref="IObservable{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
IObservable<GitHubCommit> GetAll(string owner, string name, CommitRequest request);
/// <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="IObservable{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
IObservable<GitHubCommit> GetAll(int repositoryId, CommitRequest request);
/// <summary>
/// Gets all commits for a given repository
/// </summary>
@@ -69,6 +112,15 @@ namespace Octokit.Reactive
/// <returns>A <see cref="IObservable{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
IObservable<GitHubCommit> GetAll(string owner, string name, CommitRequest request, ApiOptions 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="IObservable{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
IObservable<GitHubCommit> GetAll(int repositoryId, CommitRequest request, ApiOptions options);
/// <summary>
/// Get the SHA-1 of a commit reference
/// </summary>
@@ -77,5 +129,13 @@ namespace Octokit.Reactive
/// <param name="reference">The repository reference</param>
/// <returns>A <see cref="IObservable{GitHubCommit}"/> of <see cref="string"/> for the specified repository reference.</returns>
IObservable<string> GetSha1(string owner, string name, string reference);
/// <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="IObservable{GitHubCommit}"/> of <see cref="string"/> for the specified repository reference.</returns>
IObservable<string> GetSha1(int repositoryId, string reference);
}
}
@@ -36,6 +36,18 @@ namespace Octokit.Reactive
return _commit.Compare(owner, name, @base, head).ToObservable();
}
/// <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="IObservable{CompareResult}"/> of <see cref="CompareResult"/> for the specified references.</returns>
public IObservable<CompareResult> Compare(int repositoryId, string @base, string head)
{
return _commit.Compare(repositoryId, @base, head).ToObservable();
}
/// <summary>
/// Gets all commits for a given repository
/// </summary>
@@ -52,6 +64,19 @@ namespace Octokit.Reactive
return _commit.Get(owner, name, reference).ToObservable();
}
/// <summary>
/// Gets all commits for a given repository
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The reference for the commit</param>
/// <returns>A <see cref="IObservable{CompareResult}"/> of <see cref="GitHubCommit"/> for the specified commit SHA.</returns>
public IObservable<GitHubCommit> Get(int repositoryId, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
return _commit.Get(repositoryId, reference).ToObservable();
}
/// <summary>
/// Gets all commits for a given repository
/// </summary>
@@ -66,6 +91,16 @@ namespace Octokit.Reactive
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="IObservable{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
public IObservable<GitHubCommit> GetAll(int repositoryId)
{
return GetAll(repositoryId, new CommitRequest(), ApiOptions.None);
}
/// <summary>
/// Gets all commits for a given repository
/// </summary>
@@ -82,6 +117,19 @@ namespace Octokit.Reactive
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="IObservable{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
public IObservable<GitHubCommit> GetAll(int repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
return GetAll(repositoryId, new CommitRequest(), options);
}
/// <summary>
/// Gets all commits for a given repository
/// </summary>
@@ -98,6 +146,19 @@ namespace Octokit.Reactive
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="IObservable{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
public IObservable<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>
@@ -111,10 +172,26 @@ namespace Octokit.Reactive
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(request, "request");
Ensure.ArgumentNotNull(options, "options");
return _connection.GetAndFlattenAllPages<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="IObservable{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
public IObservable<GitHubCommit> GetAll(int repositoryId, CommitRequest request, ApiOptions options)
{
Ensure.ArgumentNotNull(request, "request");
Ensure.ArgumentNotNull(options, "options");
return _connection.GetAndFlattenAllPages<GitHubCommit>(ApiUrls.RepositoryCommits(repositoryId), request.ToParametersDictionary(), options);
}
/// <summary>
/// Get the SHA-1 of a commit reference
/// </summary>
@@ -130,5 +207,18 @@ namespace Octokit.Reactive
return _commit.GetSha1(owner, name, reference).ToObservable();
}
/// <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="IObservable{GitHubCommit}"/> of <see cref="string"/> for the specified repository reference.</returns>
public IObservable<string> GetSha1(int repositoryId, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
return _commit.GetSha1(repositoryId, reference).ToObservable();
}
}
}
@@ -23,6 +23,16 @@ namespace Octokit
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "base")]
Task<CompareResult> Compare(string owner, string name, string @base, string 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>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "base")]
Task<CompareResult> Compare(int repositoryId, string @base, string head);
/// <summary>
/// Gets a single commit for a given repository
/// </summary>
@@ -34,6 +44,16 @@ namespace Octokit
Justification = "Makes a network request")]
Task<GitHubCommit> Get(string owner, string name, string 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>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Makes a network request")]
Task<GitHubCommit> Get(int repositoryId, string reference);
/// <summary>
/// Gets all commits for a given repository
/// </summary>
@@ -42,6 +62,13 @@ namespace Octokit
/// <returns>A <see cref="IReadOnlyList{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
Task<IReadOnlyList<GitHubCommit>> GetAll(string owner, string name);
/// <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>
Task<IReadOnlyList<GitHubCommit>> GetAll(int repositoryId);
/// <summary>
/// Gets all commits for a given repository
/// </summary>
@@ -51,6 +78,14 @@ namespace Octokit
/// <returns>A <see cref="IReadOnlyList{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
Task<IReadOnlyList<GitHubCommit>> GetAll(string owner, string name, ApiOptions 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>
Task<IReadOnlyList<GitHubCommit>> GetAll(int repositoryId, ApiOptions options);
/// <summary>
/// Gets all commits for a given repository
/// </summary>
@@ -60,6 +95,14 @@ namespace Octokit
/// <returns>A <see cref="IReadOnlyList{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
Task<IReadOnlyList<GitHubCommit>> GetAll(string owner, string name, CommitRequest request);
/// <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>
Task<IReadOnlyList<GitHubCommit>> GetAll(int repositoryId, CommitRequest request);
/// <summary>
/// Gets all commits for a given repository
/// </summary>
@@ -70,6 +113,15 @@ namespace Octokit
/// <returns>A <see cref="IReadOnlyList{GitHubCommit}"/> of <see cref="GitHubCommit"/>s for the specified repository.</returns>
Task<IReadOnlyList<GitHubCommit>> GetAll(string owner, string name, CommitRequest request, ApiOptions 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>
Task<IReadOnlyList<GitHubCommit>> GetAll(int repositoryId, CommitRequest request, ApiOptions options);
/// <summary>
/// Get the SHA-1 of a commit reference
/// </summary>
@@ -78,5 +130,13 @@ namespace Octokit
/// <param name="reference">The repository reference</param>
/// <returns>A <see cref="string"/> for the specified repository reference.</returns>
Task<string> GetSha1(string owner, string name, string reference);
/// <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>
Task<string> GetSha1(int repositoryId, string reference);
}
}
@@ -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);
}
}
}