Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination support to Reactions Clients #1948

Merged
merged 14 commits into from
Feb 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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