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 pagination support for PullRequest ops #198

Conversation

lloydmeta
Copy link
Contributor

Closes #197

Something funky going on with Scalafmt here...

@lloydmeta
Copy link
Contributor Author

The test failures don't look related to the changes (all related to Activity >> StarredRepositories

https://travis-ci.org/47deg/github4s/jobs/349562816#L1343-L1417

@fedefernandez
Copy link
Contributor

@lloydmeta thanks for your contribution. Forked PRs will always fail because there are some integration tests that use a test token, only available from the original repository. Please, try to execute your tests locally. I'll execute all the tests locally to verify that everything is ok.

Copy link
Contributor

@fedefernandez fedefernandez left a comment

Choose a reason for hiding this comment

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

@lloydmeta I've executed the tests locally and it works flawlessly. Could you please add a new test in GHPullRequestsSpec passing a pagination? Thanks!

Left some comments also

@@ -27,7 +27,7 @@ trait GHPullRequestsSpec[T] extends BaseIntegrationSpec[T] {
"PullRequests >> List" should "return a right response when valid repo is provided" in {
val response =
Github(accessToken).pullRequests
.list(validRepoOwner, validRepoName)
.list(validRepoOwner, validRepoName, pagination = None)
Copy link
Contributor

Choose a reason for hiding this comment

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

None is the default value, right? Can we let this as it was before?

-- .list(validRepoOwner, validRepoName, pagination = None)
++ .list(validRepoOwner, validRepoName)

@@ -41,7 +41,8 @@ trait GHPullRequestsSpec[T] extends BaseIntegrationSpec[T] {
.list(
validRepoOwner,
validRepoName,
List(PRFilterAll, PRFilterSortCreated, PRFilterOrderAsc))
List(PRFilterAll, PRFilterSortCreated, PRFilterOrderAsc),
None)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

@@ -53,7 +54,7 @@ trait GHPullRequestsSpec[T] extends BaseIntegrationSpec[T] {
it should "return error when an invalid repo name is passed" in {
val response =
Github(accessToken).pullRequests
.list(validRepoOwner, invalidRepoName)
.list(validRepoOwner, invalidRepoName, pagination = None)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

@@ -62,7 +63,7 @@ trait GHPullRequestsSpec[T] extends BaseIntegrationSpec[T] {
"PullRequests >> ListFiles" should "return a right response when a valid repo is provided" in {
val response =
Github(accessToken).pullRequests
.listFiles(validRepoOwner, validRepoName, validPullRequestNumber)
.listFiles(validRepoOwner, validRepoName, validPullRequestNumber, None)
Copy link
Contributor

Choose a reason for hiding this comment

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

, None

@@ -74,7 +75,7 @@ trait GHPullRequestsSpec[T] extends BaseIntegrationSpec[T] {
"PullRequests >> ListFiles" should "return a right response when a valid repo is provided and not all files have 'patch'" in {
val response =
Github(None).pullRequests
.listFiles("scala", "scala", 4877)
.listFiles("scala", "scala", 4877, None)
Copy link
Contributor

Choose a reason for hiding this comment

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

, None

@@ -86,7 +87,7 @@ trait GHPullRequestsSpec[T] extends BaseIntegrationSpec[T] {
it should "return error when an invalid repo name is passed" in {
val response =
Github(accessToken).pullRequests
.listFiles(validRepoOwner, invalidRepoName, validPullRequestNumber)
.listFiles(validRepoOwner, invalidRepoName, validPullRequestNumber, None)
Copy link
Contributor

Choose a reason for hiding this comment

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

, None

@@ -95,7 +96,7 @@ trait GHPullRequestsSpec[T] extends BaseIntegrationSpec[T] {
"PullRequests >> ListReviews" should "return a right response when a valid pr is provided" in {
val response =
Github(accessToken).pullRequests
.listReviews(validRepoOwner, validRepoName, validPullRequestNumber)
.listReviews(validRepoOwner, validRepoName, validPullRequestNumber, None)
Copy link
Contributor

Choose a reason for hiding this comment

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

, None

@@ -107,7 +108,7 @@ trait GHPullRequestsSpec[T] extends BaseIntegrationSpec[T] {
it should "return error when an invalid repo name is passed" in {
val response =
Github(accessToken).pullRequests
.listReviews(validRepoOwner, invalidRepoName, validPullRequestNumber)
.listReviews(validRepoOwner, invalidRepoName, validPullRequestNumber, None)
Copy link
Contributor

Choose a reason for hiding this comment

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

, None

Copy link
Contributor

@BenFradet BenFradet left a comment

Choose a reason for hiding this comment

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

Looks great! 👍

accessToken,
s"repos/$owner/$repo/pulls/$number/files",
headers,
pagination = pagination)
Copy link
Contributor

@BenFradet BenFradet Mar 6, 2018

Choose a reason for hiding this comment

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

was this scalafmt? the indent seems weird

Copy link
Contributor Author

@lloydmeta lloydmeta Mar 6, 2018

Choose a reason for hiding this comment

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

Yes.

I stopped running Scalafmt because the repo was overall not well formatted; fixed this manually.

@lloydmeta
Copy link
Contributor Author

@BenFradet @fedefernandez I've addressed all comments; please take another look.

Copy link
Contributor

@fedefernandez fedefernandez left a comment

Choose a reason for hiding this comment

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

Just some minor comments, once addressed this is ready to go. Thanks for your contribution!

* - sort: What to sort results by. Can be either `created`, `updated`, `popularity` (comment count)
* or `long-running` (age, filtering by pulls updated in the last month). Default: `created`
* - direction: The direction of the sort. Can be either `asc` or `desc`.
* Default: `desc` when sort is created or sort is not specified, otherwise `asc`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add the parameter description here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

* @param headers optional user headers to include in the request
* @param owner of the repo
* @param repo name of the repo
* @param number of the pull request for which we want to list the files
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add the parameter description here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

* @param headers Optional user header to include in the request
* @param owner Owner of the repo
* @param repo Name of the repo
* @param pullRequest ID number of the PR to get reviews for.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add the parameter description here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@fedefernandez fedefernandez merged commit 60a1dc2 into 47degrees:master Mar 7, 2018
@fedefernandez
Copy link
Contributor

Thanks @lloydmeta!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants