Skip to content

Commit

Permalink
Pagination support to Reactions Clients (#1948)
Browse files Browse the repository at this point in the history
* Add pagination to *CommitCommentReactionsClient

* Add unit tests for *CommitCommentReactionsClient

* Add integration tests for *CommitCommentReactionsClient

* Add pagination to *IssueCommentReactionsClient

* Add unit tests for *IssueCommentReactionsClient

* Add integration tests for *IssueCommentReactionsClient

* Add pagination to *IssueReactionsClient

* Add unit tests for *IssueReactionsClient

* Add integration tests for *IssueReactionsClient

* Add pagination to *PullRequestReviewCommentReactionsClient

* Add unit tests for *PullRequestReviewCommentReactionsClient

* Add integration tests for *PullRequestReviewCommentReactionsClient

* Remove rogue using statement and whitespace

* Add null check tests for GetAll with repositoryid overload
  • Loading branch information
hnrkndrssn authored and ryangribble committed Feb 27, 2019
1 parent 33f75ed commit 43381c4
Show file tree
Hide file tree
Showing 28 changed files with 1,591 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ public interface IObservableCommitCommentReactionsClient
/// <returns></returns>
IObservable<Reaction> GetAll(string owner, string name, int number);

/// <summary>
/// List reactions for a specified Commit Comment
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The comment id</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
IObservable<Reaction> GetAll(string owner, string name, int number, ApiOptions options);

/// <summary>
/// List reactions for a specified Commit Comment
/// </summary>
Expand All @@ -49,5 +60,15 @@ public interface IObservableCommitCommentReactionsClient
/// <param name="number">The comment id</param>
/// <returns></returns>
IObservable<Reaction> GetAll(long repositoryId, int number);

/// <summary>
/// List reactions for a specified Commit Comment
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment</remarks>
/// <param name="repositoryId">The owner of the repository</param>
/// <param name="number">The comment id</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
IObservable<Reaction> GetAll(long repositoryId, int number, ApiOptions options);
}
}
19 changes: 19 additions & 0 deletions Octokit.Reactive/Clients/IObservableIssueCommentReactionsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,31 @@ public interface IObservableIssueCommentReactionsClient
/// <param name="number">The comment id</param>
IObservable<Reaction> GetAll(string owner, string name, int number);

/// <summary>
/// List reactions for a specified Issue Comment
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The comment id</param>
/// <param name="options">Options for changing the API response</param>
IObservable<Reaction> GetAll(string owner, string name, int number, ApiOptions options);

/// <summary>
/// List reactions for a specified Issue Comment
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment</remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="number">The comment id</param>
IObservable<Reaction> GetAll(long repositoryId, int number);

/// <summary>
/// List reactions for a specified Issue Comment
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment</remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="number">The comment id</param>
/// <param name="options">Options for changing the API response</param>
IObservable<Reaction> GetAll(long repositoryId, int number, ApiOptions options);
}
}
19 changes: 19 additions & 0 deletions Octokit.Reactive/Clients/IObservableIssueReactionsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ public interface IObservableIssueReactionsClient
/// <param name="number">The issue id</param>
IObservable<Reaction> GetAll(string owner, string name, int number);

/// <summary>
/// List reactions for a specified Issue.
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-an-issue</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue id</param>
/// <param name="options">Options for changing the API response</param>
IObservable<Reaction> GetAll(string owner, string name, int number, ApiOptions options);

/// <summary>
/// List reactions for a specified Issue.
/// </summary>
Expand All @@ -27,6 +37,15 @@ public interface IObservableIssueReactionsClient
/// <param name="number">The issue id</param>
IObservable<Reaction> GetAll(long repositoryId, int number);

/// <summary>
/// List reactions for a specified Issue.
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-an-issue</remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="number">The issue id</param>
/// <param name="options">Options for changing the API response</param>
IObservable<Reaction> GetAll(long repositoryId, int number, ApiOptions options);

/// <summary>
/// Creates a reaction for a specified Issue.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ public interface IObservablePullRequestReviewCommentReactionsClient
/// <param name="number">The comment id</param>
IObservable<Reaction> GetAll(string owner, string name, int number);

/// <summary>
/// Get all reactions for a specified Pull Request Review Comment.
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-a-pull-request-review-comment</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The comment id</param>
/// <param name="options">Options for changing the API response</param>
IObservable<Reaction> GetAll(string owner, string name, int number, ApiOptions options);

/// <summary>
/// Get all reactions for a specified Pull Request Review Comment.
/// </summary>
Expand All @@ -27,6 +37,15 @@ public interface IObservablePullRequestReviewCommentReactionsClient
/// <param name="number">The comment id</param>
IObservable<Reaction> GetAll(long repositoryId, int number);

/// <summary>
/// Get all reactions for a specified Pull Request Review Comment.
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-a-pull-request-review-comment</remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="number">The comment id</param>
/// <param name="options">Options for changing the API response</param>
IObservable<Reaction> GetAll(long repositoryId, int number, ApiOptions options);

/// <summary>
/// Creates a reaction for a specified Pull Request Review Comment.
/// </summary>
Expand Down
34 changes: 32 additions & 2 deletions Octokit.Reactive/Clients/ObservableCommitCommentReactionsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,26 @@ public IObservable<Reaction> Create(long repositoryId, int number, NewReaction r
/// <param name="number">The comment id</param>
/// <returns></returns>
public IObservable<Reaction> GetAll(string owner, string name, int number)
{
return GetAll(owner, name, number, ApiOptions.None);
}

/// <summary>
/// List reactions for a specified Commit Comment
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The comment id</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
public IObservable<Reaction> GetAll(string owner, string name, int number, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.CommitCommentReactions(owner, name, number), null, AcceptHeaders.ReactionsPreview);
return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.CommitCommentReactions(owner, name, number), null, AcceptHeaders.ReactionsPreview, options);
}

/// <summary>
Expand All @@ -81,7 +96,22 @@ public IObservable<Reaction> GetAll(string owner, string name, int number)
/// <returns></returns>
public IObservable<Reaction> GetAll(long repositoryId, int number)
{
return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.CommitCommentReactions(repositoryId, number), null, AcceptHeaders.ReactionsPreview);
return GetAll(repositoryId, number, ApiOptions.None);
}

/// <summary>
/// List reactions for a specified Commit Comment
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment</remarks>
/// <param name="repositoryId">The owner of the repository</param>
/// <param name="number">The comment id</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
public IObservable<Reaction> GetAll(long repositoryId, int number, ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.CommitCommentReactions(repositoryId, number), null, AcceptHeaders.ReactionsPreview, options);
}
}
}
35 changes: 33 additions & 2 deletions Octokit.Reactive/Clients/ObservableIssueCommentReactionsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,24 @@ public IObservable<Reaction> GetAll(string owner, string name, int number)
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));

return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.IssueCommentReactions(owner, name, number), null, AcceptHeaders.ReactionsPreview);
return GetAll(owner, name, number, ApiOptions.None);
}

/// <summary>
/// List reactions for a specified Issue Comment
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The comment id</param>
/// <param name="options">Options for changing the API response</param>
public IObservable<Reaction> GetAll(string owner, string name, int number, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.IssueCommentReactions(owner, name, number), null, AcceptHeaders.ReactionsPreview, options);
}

/// <summary>
Expand All @@ -77,7 +94,21 @@ public IObservable<Reaction> GetAll(string owner, string name, int number)
/// <param name="number">The comment id</param>
public IObservable<Reaction> GetAll(long repositoryId, int number)
{
return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.IssueCommentReactions(repositoryId, number), null, AcceptHeaders.ReactionsPreview);
return GetAll(repositoryId, number, ApiOptions.None);
}

/// <summary>
/// List reactions for a specified Issue Comment
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment</remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="number">The comment id</param>
/// <param name="options">Options for changing the API response</param>
public IObservable<Reaction> GetAll(long repositoryId, int number, ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.IssueCommentReactions(repositoryId, number), null, AcceptHeaders.ReactionsPreview, options);
}
}
}
32 changes: 30 additions & 2 deletions Octokit.Reactive/Clients/ObservableIssueReactionsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,25 @@ public ObservableIssueReactionsClient(IGitHubClient client)
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue id</param>
public IObservable<Reaction> GetAll(string owner, string name, int number)
{
return GetAll(owner, name, number, ApiOptions.None);
}

/// <summary>
/// List reactions for a specified Issue
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-an-issue</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue id</param>
/// <param name="options">Options for changing the API response</param>
public IObservable<Reaction> GetAll(string owner, string name, int number, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.IssueReactions(owner, name, number), null, AcceptHeaders.ReactionsPreview);
return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.IssueReactions(owner, name, number), null, AcceptHeaders.ReactionsPreview, options);
}

/// <summary>
Expand All @@ -46,7 +60,21 @@ public IObservable<Reaction> GetAll(string owner, string name, int number)
/// <param name="number">The issue id</param>
public IObservable<Reaction> GetAll(long repositoryId, int number)
{
return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.IssueReactions(repositoryId, number), null, AcceptHeaders.ReactionsPreview);
return GetAll(repositoryId, number, ApiOptions.None);
}

/// <summary>
/// List reactions for a specified Issue.
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-an-issue</remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="number">The issue id</param>
/// <param name="options">Options for changing the API response</param>
public IObservable<Reaction> GetAll(long repositoryId, int number, ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.IssueReactions(repositoryId, number), null, AcceptHeaders.ReactionsPreview, options);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ public ObservablePullRequestReviewCommentReactionsClient(IGitHubClient client)
/// <param name="name">The name of the repository</param>
/// <param name="number">The comment id</param>
public IObservable<Reaction> GetAll(string owner, string name, int number)
{
return GetAll(owner, name, number, ApiOptions.None);
}

public IObservable<Reaction> GetAll(string owner, string name, int number, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.PullRequestReviewCommentReaction(owner, name, number), null, AcceptHeaders.ReactionsPreview);
return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.PullRequestReviewCommentReaction(owner, name, number), null, AcceptHeaders.ReactionsPreview, options);
}

/// <summary>
Expand All @@ -46,7 +52,21 @@ public IObservable<Reaction> GetAll(string owner, string name, int number)
/// <param name="number">The comment id</param>
public IObservable<Reaction> GetAll(long repositoryId, int number)
{
return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.PullRequestReviewCommentReaction(repositoryId, number), null, AcceptHeaders.ReactionsPreview);
return GetAll(repositoryId, number, ApiOptions.None);
}

/// <summary>
/// Get all reactions for a specified Pull Request Review Comment.
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-a-pull-request-review-comment</remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="number">The comment id</param>
/// <param name="options">Options for changing the API response</param>
public IObservable<Reaction> GetAll(long repositoryId, int number, ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.PullRequestReviewCommentReaction(repositoryId, number), null, AcceptHeaders.ReactionsPreview, options);
}

/// <summary>
Expand Down
Loading

0 comments on commit 43381c4

Please sign in to comment.