Skip to content

Commit

Permalink
Merge pull request #207 from davenverse/ce3
Browse files Browse the repository at this point in the history
Update for Cats-Effect 3
  • Loading branch information
ChristopherDavenport authored Aug 4, 2021
2 parents cd58df6 + 643d876 commit b1c682a
Show file tree
Hide file tree
Showing 19 changed files with 75 additions and 77 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.10, 2.13.6, 3.0.1]
scala: [2.12.10, 2.13.6]
java: [[email protected], [email protected]]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.0.1]
scala: [2.13.6]
java: [[email protected]]
runs-on: ${{ matrix.os }}
steps:
Expand Down
18 changes: 8 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}

ThisBuild / crossScalaVersions := Seq("2.12.10", "2.13.6", "3.0.1")
ThisBuild / crossScalaVersions := Seq("2.12.10", "2.13.6")

val catsV = "2.6.1"
val catsEffectV = "2.5.2"
val fs2V = "2.5.9"
val http4sV = "0.22.1"
val catsEffectV = "3.2.1"
val fs2V = "3.0.6"
val http4sV = "0.23.0"
val circeV = "0.14.1"
val catsEffectTestingV = "0.5.4"
val log4catsV = "1.3.1"
val catsEffectTestingV = "1.0.0-M1"
val log4catsV = "2.1.1"
val logbackClassicV = "1.2.3"

val specs2V = "4.9.2"
val specs2V = "4.12.3"

val kindProjectorV = "0.11.0"
val betterMonadicForV = "0.3.1"

lazy val `github` = project.in(file("."))
.disablePlugins(MimaPlugin)
Expand Down Expand Up @@ -48,7 +46,7 @@ lazy val core = project.in(file("core"))

("org.specs2" %% "specs2-core" % specs2V % Test).cross(CrossVersion.for3Use2_13),
("org.specs2" %% "specs2-scalacheck" % specs2V % Test).cross(CrossVersion.for3Use2_13),
"com.codecommit" %% "cats-effect-testing-specs2" % catsEffectTestingV % Test
("com.codecommit" %% "cats-effect-testing-specs2" % catsEffectTestingV % Test).cross(CrossVersion.for3Use2_13)
)
)

Expand Down
32 changes: 16 additions & 16 deletions core/src/main/scala/io/chrisdavenport/github/endpoints/Gists.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import java.time.ZonedDateTime

object Gists {

def list[F[_]: Sync](
def list[F[_]: Concurrent](
username: String,
since: Option[ZonedDateTime],
auth: Option[Auth]
Expand All @@ -35,7 +35,7 @@ object Gists {
* List all public gists sorted by most recently updated to least recently updated.
* https://developer.github.com/v3/gists/#list-all-public-gists
*/
def allPublic[F[_]: Sync](
def allPublic[F[_]: Concurrent](
since: Option[ZonedDateTime],
auth: Option[Auth]
): Kleisli[Stream[F, *], Client[F], List[Gist]] =
Expand All @@ -49,7 +49,7 @@ object Gists {
* List starred gists by the authenticated user
* https://developer.github.com/v3/gists/#list-starred-gists
*/
def starred[F[_]: Sync](
def starred[F[_]: Concurrent](
since: Option[ZonedDateTime],
auth: Auth
): Kleisli[Stream[F, *], Client[F], List[Gist]] =
Expand All @@ -63,7 +63,7 @@ object Gists {
* Get a single gist by its id
* https://developer.github.com/v3/gists/#get-a-single-gist
*/
def get[F[_]: Sync](
def get[F[_]: Concurrent](
gistId: String,
auth: Option[Auth]
): Kleisli[F, Client[F], Gist] =
Expand All @@ -77,7 +77,7 @@ object Gists {
* Get a specific revision of a gist
* https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist
*/
def getRevision[F[_]: Sync](
def getRevision[F[_]: Concurrent](
gistId: String,
sha: String,
auth: Option[Auth]
Expand All @@ -92,7 +92,7 @@ object Gists {
* Creates a new gist
* https://developer.github.com/v3/gists/#create-a-gist
*/
def create[F[_]: Sync](
def create[F[_]: Concurrent](
newGist: CreateGist,
auth: Auth
): Kleisli[F, Client[F], Gist] =
Expand All @@ -107,7 +107,7 @@ object Gists {
* Edit a gist
* https://developer.github.com/v3/gists/#edit-a-gist
*/
def editGist[F[_]: Sync](
def editGist[F[_]: Concurrent](
gistId: String,
editGist: EditGist,
auth: Auth
Expand All @@ -123,7 +123,7 @@ object Gists {
* List commits history for a gist
* https://developer.github.com/v3/gists/#list-gist-commits
*/
def listCommits[F[_]: Sync](
def listCommits[F[_]: Concurrent](
gistId: String,
auth: Auth
): Kleisli[F, Client[F], List[GistCommit]] =
Expand All @@ -137,21 +137,21 @@ object Gists {
* Star a gist
* https://developer.github.com/v3/gists/#star-a-gist
*/
def star[F[_]: Sync](
def star[F[_]: Concurrent](
gistId: String,
auth: Auth
): Kleisli[F, Client[F], Unit] =
RequestConstructor.runRequestWithNoBody[F, Unit](
auth.some,
Method.PUT,
uri"gists" / gistId / "star"
)(Sync[F], EntityDecoder.void[F])
)(Concurrent[F], EntityDecoder.void[F])

/**
* Check if a gist is starred
* https://developer.github.com/v3/gists/#check-if-a-gist-is-starred
*/
def checkStarred[F[_]: Sync](
def checkStarred[F[_]: Concurrent](
gistId: String,
auth: Auth
): Kleisli[F, Client[F], Boolean] =
Expand All @@ -160,7 +160,7 @@ object Gists {
auth.some,
Method.GET,
uri"gists" / gistId / "star"
)(Sync[F], EntityDecoder.void[F])
)(Concurrent[F], EntityDecoder.void[F])
.map(_ => true)
.recover {
case ghError: RequestConstructor.GithubError if ghError.status == Status.NotFound => false
Expand All @@ -170,7 +170,7 @@ object Gists {
* Fork a gist
* https://developer.github.com/v3/gists/#fork-a-gist
*/
def fork[F[_]: Sync](
def fork[F[_]: Concurrent](
gistId: String,
auth: Auth
): Kleisli[F, Client[F], Gist] =
Expand All @@ -184,7 +184,7 @@ object Gists {
* List all gist's forks
* https://developer.github.com/v3/gists/#list-gist-forks
*/
def listForks[F[_]: Sync](
def listForks[F[_]: Concurrent](
gistId: String,
auth: Auth
): Kleisli[F, Client[F], List[GistFork]] =
Expand All @@ -198,13 +198,13 @@ object Gists {
* Delete an existing gist
* https://developer.github.com/v3/gists/#delete-a-gist
*/
def delete[F[_]: Sync](
def delete[F[_]: Concurrent](
gistId: String,
auth: Auth
): Kleisli[F, Client[F], Unit] =
RequestConstructor.runRequestWithNoBody[F, Unit](
auth.some,
Method.DELETE,
uri"gists" / gistId
)(Sync[F], EntityDecoder.void[F])
)(Concurrent[F], EntityDecoder.void[F])
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import io.chrisdavenport.github.internals.RequestConstructor

object PullRequests {

def pullRequestsFor[F[_]: Sync](
def pullRequestsFor[F[_]: Concurrent](
owner: String,
name: String,
auth: Option[Auth]
Expand All @@ -22,7 +22,7 @@ object PullRequests {
uri"repos" / owner / name / "pulls"
)

def pullRequest[F[_]: Sync](
def pullRequest[F[_]: Concurrent](
owner: String,
name: String,
issueNumber: Issues.IssueNumber,
Expand All @@ -33,7 +33,7 @@ object PullRequests {
uri"repos" / owner / name / "pulls" / issueNumber.toInt.toString
)

def createPullRequest[F[_]: Sync](
def createPullRequest[F[_]: Concurrent](
owner: String,
name: String,
createPullRequest: CreatePullRequest,
Expand All @@ -45,7 +45,7 @@ object PullRequests {
createPullRequest
)

def updatePullRequest[F[_]: Sync](
def updatePullRequest[F[_]: Concurrent](
owner: String,
name: String,
issueNumber: Issues.IssueNumber,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import io.chrisdavenport.github.internals.RequestConstructor

object Repositories {

def repository[F[_]: Sync](
def repository[F[_]: Concurrent](
owner: String,
repo: String,
auth: Option[Auth]
Expand All @@ -27,7 +27,7 @@ object Repositories {
)
}

def createRepo[F[_]: Sync](
def createRepo[F[_]: Concurrent](
newRepo: NewRepo,
auth: Auth
): Kleisli[F, Client[F], Repo] = {
Expand All @@ -40,7 +40,7 @@ object Repositories {
)
}

def createOrganizationRepo[F[_]: Sync](
def createOrganizationRepo[F[_]: Concurrent](
org: String,
newRepo: NewRepo,
auth: Auth
Expand All @@ -54,7 +54,7 @@ object Repositories {
)
}

def edit[F[_]: Sync](
def edit[F[_]: Concurrent](
owner: String,
repo: String,
editRepo: EditRepo,
Expand All @@ -72,7 +72,7 @@ object Repositories {
/**
* Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required.
**/
def delete[F[_]: Sync](
def delete[F[_]: Concurrent](
owner: String,
repo: String,
auth: Auth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object Search {
* @param auth The authentication mechanism
* @tparam F The effect type
*/
def repository[F[_]: Sync](
def repository[F[_]: Concurrent](
q: String,
sort: Option[Sort.Repository],
order: Option[Order],
Expand All @@ -46,7 +46,7 @@ object Search {
* @param auth The authentication mechanism
* @tparam F The effect type
*/
def users[F[_]: Sync](
def users[F[_]: Concurrent](
q: String,
sort: Option[Sort.User],
order: Option[Order],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ import io.chrisdavenport.github.internals.RequestConstructor

object Users {

def userInfoFor[F[_]: Sync](username: String, auth: Option[Auth]): Kleisli[F, Client[F], User] =
def userInfoFor[F[_]: Concurrent](username: String, auth: Option[Auth]): Kleisli[F, Client[F], User] =
RequestConstructor.runRequestWithNoBody[F, User](
auth,
Method.GET,
uri"users" / username
)

def ownerInfoFor[F[_]: Sync](owner: String, auth: Option[Auth]): Kleisli[F, Client[F], Owner] =
def ownerInfoFor[F[_]: Concurrent](owner: String, auth: Option[Auth]): Kleisli[F, Client[F], Owner] =
RequestConstructor.runRequestWithNoBody[F, Owner](
auth,
Method.GET,
uri"users" / owner
)

def userInfoAuthenticatedUser[F[_]: Sync](auth: Auth): Kleisli[F, Client[F], User] =
def userInfoAuthenticatedUser[F[_]: Concurrent](auth: Auth): Kleisli[F, Client[F], User] =
RequestConstructor.runRequestWithNoBody[F, User](
auth.some,
Method.GET,
Expand All @@ -39,7 +39,7 @@ object Users {
// We expose this as the returned list for each request
// that way users can monitor how many requests they make
// and can know where they stand in regards to their cap.
def getAllUsers[F[_]: Sync](
def getAllUsers[F[_]: Concurrent](
since: Option[String],
auth: Option[Auth]
): Kleisli[({ type S[A] = Stream[F, A]})#S, Client[F], List[SimpleOwner]] =
Expand All @@ -52,7 +52,7 @@ object Users {
// if null values are removed entirely, so
// for the first draft dropNull values
// possibly in the future rework
def updateAuthenticatedUser[F[_]: Sync](
def updateAuthenticatedUser[F[_]: Concurrent](
auth: Auth,
name: Option[String],
email: Option[String],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object Blobs {
*
* Note: This API supports blobs up to 100 megabytes in size.
**/
def getBlob[F[_]: Sync](
def getBlob[F[_]: Concurrent](
owner: String,
repo: String,
sha: String,
Expand All @@ -43,7 +43,7 @@ object Blobs {
* content string Required. The new blob's content.
* encoding string The encoding used for content. Currently, "utf-8" and "base64" are supported. Default: "utf-8".
*/
def createBlob[F[_]: Sync](
def createBlob[F[_]: Concurrent](
owner: String,
repo: String,
createBlob: CreateBlob,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object Commits {
* GET /repos/:owner/:repo/git/commits/:commit_sha
*
**/
def getCommit[F[_]: Sync](
def getCommit[F[_]: Concurrent](
owner: String,
repo: String,
commitSha: String,
Expand All @@ -48,7 +48,7 @@ object Commits {
*
* POST /repos/:owner/:repo/git/commits
**/
def createCommit[F[_]: Sync](
def createCommit[F[_]: Concurrent](
owner: String,
repo: String,
createCommit: CreateCommit,
Expand Down
Loading

0 comments on commit b1c682a

Please sign in to comment.