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 get tree api implementation #217

Merged
merged 1 commit into from Aug 20, 2018
Merged

Conversation

aberey
Copy link

@aberey aberey commented Aug 14, 2018

Implemented missing parts of the Git Tree API:

https://developer.github.com/v3/git/trees/#get-a-tree

@fedefernandez
Copy link
Contributor

fedefernandez commented Aug 14, 2018

Hi @aberey, thanks for your contribution. Do you mind to add a new integration test here. There isn't a spec for trees because we avoid the write operations in the integration tests, but you could add the one for getting the tree.

See the one for pull request as an example:

https://github.com/47deg/github4s/blob/3c9b0985276d504230ab031c05917593f38069df/github4s/shared/src/test/scala/github4s/integration/GHPullRequestsSpec.scala#L27-L54

Thanks

@aberey
Copy link
Author

aberey commented Aug 14, 2018

Hi @fedefernandez - as requested, I have added some integration tests. Best regards!

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.

Thanks 👍

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.

Left some minor comments, the code looks great. Thanks!

owner: String,
repo: String,
sha: String,
recursive: Boolean=false): M[GHResponse[TreeResult]] =
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 recursive param to the scaladoc?
Also, please, add spaces after and before of the = sign (recursive: Boolean = false)

@@ -57,7 +57,8 @@ case class TreeDataBlob(path: String, mode: String, `type`: String, content: Str
case class TreeResult(
override val sha: String,
override val url: String,
tree: List[TreeDataResult])
tree: List[TreeDataResult],
truncated: Option[Boolean]=None)
Copy link
Contributor

Choose a reason for hiding this comment

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

-- truncated: Option[Boolean]=None
++ truncated: Option[Boolean] = None

@aberey
Copy link
Author

aberey commented Aug 14, 2018

Thanks for the feedback - fixed the spacing/documentation issues. Cheers!

@fedefernandez fedefernandez mentioned this pull request Aug 17, 2018
@BenFradet
Copy link
Contributor

hey @aberey ,

The tests are failing:

[info] - should return the file tree recursively *** FAILED ***
[info]   List(".gitignore", "build.sbt", "project") was not equal to List(".gitignore", "build.sbt", "project", "project/build.properties", "project/plugins.sbt") (GHGitDataSpec.scala:98)

[info] GitData.getTree
[info] - should call to httpClient.get with the right parameters *** FAILED ***
[info]   Unexpected call: <mock-7> HttpClientTest.get[A](Some(token), repos/47deg/github4s/git/trees/d3b048c1f500ee5450e5d7b3d1921ed3e7645891, Map(user-agent -> github4s), Map(), None, io.circe.generic.decoding.DerivedDecoder$$anon$1@1f)
[info]   
[info]   Expected:
[info]   inAnyOrder {
[info]     <mock-7> HttpClientTest.get[A](Some(token), repos/47deg/github4s/git/trees/d3b048c1f500ee5450e5d7b3d1921ed3e7645891?recursive=1, Map(user-agent -> github4s), Map(), *, *) once (never called - UNSATISFIED)
[info]   }
[info]   
[info]   Actual:
[info]     <mock-7> HttpClientTest.get[A](Some(token), repos/47deg/github4s/git/trees/d3b048c1f500ee5450e5d7b3d1921ed3e7645891, Map(user-agent -> github4s), Map(), None, io.circe.generic.decoding.DerivedDecoder$$anon$1@1f) (github4s-test-fastopt.js:40344)

@aberey
Copy link
Author

aberey commented Aug 20, 2018

@BenFradet I'm sorry, apparently I had some sbt cache issues, which I resolved now. Actually it turned out I was not setting the url parameter via the appropriate API, which I fixed now as well. I double-checked the tests are passing successfully in my local environment.

@BenFradet
Copy link
Contributor

Thanks, merging 👍

@BenFradet BenFradet merged commit c2ea9dd into 47degrees:master Aug 20, 2018
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