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

Add support for passing sort options to IssueCommentsClient.GetAllForRepository() #1501

Merged
merged 13 commits into from
Jan 7, 2017

Conversation

pjc0247
Copy link
Contributor

@pjc0247 pjc0247 commented Nov 11, 2016

Original Issue : #1500

Hi,
I added 4 methods to IssueCommentsClient.cs.

But there are two duplicated options which named IssueCommentSort and PullRequestReviewCommentSort. I think these types can be merged like a SortDirection option.

Thanks.

@ryangribble
Copy link
Contributor

Hi @pjc0247 sorry for the delay in responding.

The builds are currently failing unit test let me know if you need help with it

new Uri("repos/fake/repo/issues/comments", UriKind.Relative),
Arg.Any<Dictionary<string, string>>(),
"application/vnd.github.squirrel-girl-preview");
gitHubClient.Received().Issue.Comment.GetAllForRepository("fake", "repo", request, options);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Id say this is the one failing, if you have a look at what the previous code was

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests aren't right. They arent failing but they also aren't correct. It may be something to do with the multiple nested subclients on the end of the .Received() call

but this observable method doesnt actually call into the IGitHubClient method, it calls the _connection.GetAndFlattenPages() method and thus this test should be checking for gitHubClient.Connection.Received(1).Get....

@@ -87,7 +87,7 @@ public IObservable<IssueComment> GetAllForRepository(string owner, string name,
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(options, "options");

return _connection.GetAndFlattenAllPages<IssueComment>(ApiUrls.IssueComments(owner, name), null, AcceptHeaders.ReactionsPreview, options);
return GetAllForRepository(owner, name, new IssueCommentRequest(), ApiOptions.None);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be passing through the options variable rather than ApiOptions.None

@@ -100,7 +100,69 @@ public IObservable<IssueComment> GetAllForRepository(long repositoryId, ApiOptio
{
Ensure.ArgumentNotNull(options, "options");

return _connection.GetAndFlattenAllPages<IssueComment>(ApiUrls.IssueComments(repositoryId), options);
return GetAllForRepository(repositoryId, new IssueCommentRequest(), ApiOptions.None);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be passing through the options variable rather than ApiOptions.None

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah... thanks.

new Uri("repos/fake/repo/issues/comments", UriKind.Relative),
Arg.Any<Dictionary<string, string>>(),
"application/vnd.github.squirrel-girl-preview");
gitHubClient.Received().Issue.Comment.GetAllForRepository("fake", "repo", request, options);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests aren't right. They arent failing but they also aren't correct. It may be something to do with the multiple nested subclients on the end of the .Received() call

but this observable method doesnt actually call into the IGitHubClient method, it calls the _connection.GetAndFlattenPages() method and thus this test should be checking for gitHubClient.Connection.Received(1).Get....


gitHubClient.Connection.Received(1).Get<List<IssueComment>>(
new Uri("repositories/1/issues/comments", UriKind.Relative), Arg.Is<IDictionary<string, string>>(d => d.Count == 2), null);
gitHubClient.Received().Issue.Comment.GetAllForRepository(1, request, options);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this one too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryangribble sry, I'm not famillar with unit testing. I'll make a fix.

@pjc0247
Copy link
Contributor Author

pjc0247 commented Nov 23, 2016

@ryangribble finally understood. they already have 2 parameters which contain pagenation data....
sorry for messy commits.

@ryangribble
Copy link
Contributor

Sorry for the delay, this looks good to merge now!

Many thanks for the contribution, and for your patience :)

LGTM

@ryangribble ryangribble merged commit cf0eddd into octokit:master Jan 7, 2017
@ryangribble ryangribble changed the title Fix IssueCommentClient #1500 Add GetAllForRepository method to IssueCommentsClient Jan 15, 2017
@ryangribble ryangribble changed the title Add GetAllForRepository method to IssueCommentsClient Add support for passing sort options to IssueCommentsClient.GetAllForRepository() Jan 15, 2017
@nickfloyd nickfloyd added Type: Feature New feature or request and removed category: feature labels Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants