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

Get Blob support #494

Merged
merged 10 commits into from
May 27, 2020
Merged

Get Blob support #494

merged 10 commits into from
May 27, 2020

Conversation

georgeorfanidi
Copy link
Contributor

No description provided.

docs/docs/git_data.md Show resolved Hide resolved
docs/docs/git_data.md Outdated Show resolved Hide resolved
github4s/src/main/scala/github4s/algebras/GitData.scala Outdated Show resolved Hide resolved
Comment on lines 125 to 153
val gh = clientResource.map { client =>
Github[IO](client, accessToken)
}

val response: GHResponse[NonEmptyList[Content]] = gh
.use(
_.repos.getContents(validRepoOwner, validRepoName, validFilePath, headers = headerUserAgent)
)
.unsafeRunSync()

val fileContentO = for {
res <- response.result.toOption
content <- res.head.content
} yield content

fileContentO.isDefined shouldBe true

val blobResponse = for {
res <- response.result.toOption
} yield gh.use(
_.gitData.getBlob(validRepoOwner, validRepoName, res.head.sha, headers = headerUserAgent)
)

blobResponse.isDefined shouldBe true

val responseBlob = blobResponse.get.unsafeRunSync()

testIsRight[BlobContent](responseBlob, r => r.content shouldBe fileContentO)
response.statusCode shouldBe okStatusCode
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about this approach?

Copy link
Contributor

Choose a reason for hiding this comment

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

yup that's cool too 👍

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 👍

@BenFradet BenFradet merged commit 0b01fb7 into 47degrees:master May 27, 2020
@juanpedromoreno juanpedromoreno added the enhancement New feature or request label Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants