Skip to content

Commit

Permalink
Update http4s and cats-effect to CE3 era
Browse files Browse the repository at this point in the history
  • Loading branch information
Daenyth committed Jul 6, 2021
1 parent 9e8c7bb commit 56e2675
Show file tree
Hide file tree
Showing 37 changed files with 561 additions and 852 deletions.
6 changes: 4 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version = 2.7.5
version = 3.0.0-RC5

style = defaultWithAlign
maxColumn = 100

Expand All @@ -15,7 +16,8 @@ align {
openParenDefnSite = false
}

docstrings = JavaDoc
docstrings.style = Asterisk
docstrings.wrap = no

rewrite {
rules = [SortImports, RedundantBraces]
Expand Down
6 changes: 3 additions & 3 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

The maintainers of the project are:

- [![bond15](https://avatars.githubusercontent.com/u/9124653?v=4&s=20) **bond15**](https://github.com/bond15)
- [![47erbot](https://avatars.githubusercontent.com/u/24799081?v=4&s=20) **47erbot**](https://github.com/47erbot)
- [![AdrianRaFo](https://avatars.githubusercontent.com/u/15971742?v=4&s=20) **Adrian Ramirez Fornell (AdrianRaFo)**](https://github.com/AdrianRaFo)
- [![alejandrohdezma](https://avatars.githubusercontent.com/u/9027541?v=4&s=20) **Alejandro Hernández (alejandrohdezma)**](https://github.com/alejandrohdezma)
Expand All @@ -30,15 +29,15 @@ The maintainers of the project are:

These are the people that have contributed to the _github4s_ project:

- [![47erbot](https://avatars.githubusercontent.com/u/24799081?v=4&s=20) **47erbot**](https://github.com/47erbot)
- [![BenFradet](https://avatars.githubusercontent.com/u/1737211?v=4&s=20) **BenFradet**](https://github.com/BenFradet)
- [![juanpedromoreno](https://avatars.githubusercontent.com/u/4879373?v=4&s=20) **juanpedromoreno**](https://github.com/juanpedromoreno)
- [![47erbot](https://avatars.githubusercontent.com/u/24799081?v=4&s=20) **47erbot**](https://github.com/47erbot)
- [![rafaparadela](https://avatars.githubusercontent.com/u/315070?v=4&s=20) **rafaparadela**](https://github.com/rafaparadela)
- [![47degdev](https://avatars.githubusercontent.com/u/5580770?v=4&s=20) **47degdev**](https://github.com/47degdev)
- [![fedefernandez](https://avatars.githubusercontent.com/u/720923?v=4&s=20) **fedefernandez**](https://github.com/fedefernandez)
- [![sloshy](https://avatars.githubusercontent.com/u/427237?v=4&s=20) **sloshy**](https://github.com/sloshy)
- [![jdesiloniz](https://avatars.githubusercontent.com/u/2835739?v=4&s=20) **jdesiloniz**](https://github.com/jdesiloniz)
- [![anamariamv](https://avatars.githubusercontent.com/u/2183589?v=4&s=20) **anamariamv**](https://github.com/anamariamv)
- [![sloshy](https://avatars.githubusercontent.com/u/427237?v=4&s=20) **sloshy**](https://github.com/sloshy)
- [![calvellido](https://avatars.githubusercontent.com/u/7753447?v=4&s=20) **calvellido**](https://github.com/calvellido)
- [![AdrianRaFo](https://avatars.githubusercontent.com/u/15971742?v=4&s=20) **AdrianRaFo**](https://github.com/AdrianRaFo)
- [![alejandrohdezma](https://avatars.githubusercontent.com/u/9027541?v=4&s=20) **alejandrohdezma**](https://github.com/alejandrohdezma)
Expand Down Expand Up @@ -69,6 +68,7 @@ These are the people that have contributed to the _github4s_ project:
- [![MaureenElsberry](https://avatars.githubusercontent.com/u/17556002?v=4&s=20) **MaureenElsberry**](https://github.com/MaureenElsberry)
- [![mikegirkin](https://avatars.githubusercontent.com/u/4907402?v=4&s=20) **mikegirkin**](https://github.com/mikegirkin)
- [![peterneyens](https://avatars.githubusercontent.com/u/6407606?v=4&s=20) **peterneyens**](https://github.com/peterneyens)
- [![PeterPerhac](https://avatars.githubusercontent.com/u/1763911?v=4&s=20) **PeterPerhac**](https://github.com/PeterPerhac)
- [![raulraja](https://avatars.githubusercontent.com/u/456796?v=4&s=20) **raulraja**](https://github.com/raulraja)
- [![satorg](https://avatars.githubusercontent.com/u/3954178?v=4&s=20) **satorg**](https://github.com/satorg)
- [![suhasgaddam](https://avatars.githubusercontent.com/u/7282584?v=4&s=20) **suhasgaddam**](https://github.com/suhasgaddam)
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

[![Join the chat at https://gitter.im/47degrees/github4s](https://badges.gitter.im/47degrees/github4s.svg)](https://gitter.im/47degrees/github4s?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![codecov.io](http://codecov.io/gh/47degrees/github4s/branch/master/graph/badge.svg)](http://codecov.io/gh/47degrees/github4s) [![Maven Central](https://img.shields.io/badge/maven%20central-0.28.1-green.svg)](https://oss.sonatype.org/#nexus-search;gav~com.47deg~github4s*) [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/47degrees/github4s/master/LICENSE) [![Latest version](https://img.shields.io/badge/github4s-0.28.1-green.svg)](https://index.scala-lang.org/47degrees/github4s) [![GitHub Issues](https://img.shields.io/github/issues/47degrees/github4s.svg)](https://github.com/47degrees/github4s/issues)
[![Join the chat at https://gitter.im/47degrees/github4s](https://badges.gitter.im/47degrees/github4s.svg)](https://gitter.im/47degrees/github4s?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![codecov.io](http://codecov.io/gh/47degrees/github4s/branch/master/graph/badge.svg)](http://codecov.io/gh/47degrees/github4s) [![Maven Central](https://img.shields.io/badge/maven%20central-0.28.5-green.svg)](https://oss.sonatype.org/#nexus-search;gav~com.47deg~github4s*) [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/47degrees/github4s/master/LICENSE) [![Latest version](https://img.shields.io/badge/github4s-0.28.5-green.svg)](https://index.scala-lang.org/47degrees/github4s) [![GitHub Issues](https://img.shields.io/github/issues/47degrees/github4s.svg)](https://github.com/47degrees/github4s/issues)

Github4s
=============
Expand All @@ -11,7 +11,7 @@ Github4s
To get started with SBT, simply add the following to your build.sbt file.

```scala
libraryDependencies += "com.47deg" %% "github4s" % "0.28.1"
libraryDependencies += "com.47deg" %% "github4s" % "0.28.5"
```

## Github4s in the wild
Expand All @@ -21,6 +21,7 @@ If you wish to add your library here please consider a PR to include it in the l
★ | ★ | ★
--- | --- | ---
![scala-exercises](https://www.scala-exercises.org/assets/images/navbar_brand.svg) | [**scala-exercises**](https://www.scala-exercises.org/) | Scala Exercises is an Open Source project for learning different technologies based in the Scala Programming Language.
| | [**dashing**](https://github.com/benfradet/dashing) | Dashing is a collection of dashboards to monitor the health of an open source organization.
| | [**cla-bot**](https://github.com/snowplow-incubator/cla-bot) | Bot making sure external contributors sign a CLA.

# Copyright
Expand Down
29 changes: 21 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
import ProjectPlugin.on

ThisBuild / organization := "com.47deg"
ThisBuild / scalaVersion := "2.13.2"
ThisBuild / crossScalaVersions := Seq("2.12.12", "2.13.4")

addCommandAlias("ci-test", "scalafmtCheckAll; scalafmtSbtCheck; mdoc; testCovered")
val scala212 = "2.12.14"
val scala213 = "2.13.6"
val scala3Version = "3.0.0"
val scala2Versions = Seq(scala212, scala213)
val allScalaVersions = scala2Versions :+ scala3Version
ThisBuild / scalaVersion := scala213
ThisBuild / crossScalaVersions := allScalaVersions

addCommandAlias("ci-test", "scalafmtCheckAll; scalafmtSbtCheck; mdoc; ++test")
addCommandAlias("ci-docs", "github; mdoc; headerCreateAll; publishMicrosite")
addCommandAlias("ci-publish", "github; ci-release")

skip in publish := true
publish / skip := true

lazy val github4s = project.settings(coreDeps: _*)
lazy val github4s = project
.settings(coreDeps: _*)
.settings(
// Increase number of inlines, needed for circe semiauto derivation
scalacOptions ++= on(3, 9)(Seq("-Xmax-inlines", "20")).value.flatten
)

//////////
// DOCS //
Expand All @@ -19,10 +32,10 @@ lazy val microsite: Project = project
.enablePlugins(MicrositesPlugin)
.enablePlugins(ScalaUnidocPlugin)
.settings(micrositeSettings: _*)
.settings(skip in publish := true)
.settings(unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(github4s, microsite))
.settings(publish / skip := true)
.settings(ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(github4s, microsite))

lazy val documentation = project
.enablePlugins(MdocPlugin)
.settings(mdocOut := file("."))
.settings(skip in publish := true)
.settings(publish / skip := true)
10 changes: 5 additions & 5 deletions github4s/src/main/scala/github4s/GHError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ object GHError {

sealed trait ErrorCode
object ErrorCode {
final case object MissingResource extends ErrorCode
final case object MissingField extends ErrorCode
final case object InvalidFormatting extends ErrorCode
final case object ResourceAlreadyExists extends ErrorCode
final case object Custom extends ErrorCode
case object MissingResource extends ErrorCode
case object MissingField extends ErrorCode
case object InvalidFormatting extends ErrorCode
case object ResourceAlreadyExists extends ErrorCode
case object Custom extends ErrorCode
private[github4s] implicit val errorCodeDecoder: Decoder[ErrorCode] =
Decoder.decodeString.map {
case "missing" => MissingResource
Expand Down
6 changes: 3 additions & 3 deletions github4s/src/main/scala/github4s/Github.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

package github4s

import cats.effect.Sync
import cats.effect.kernel.Concurrent
import github4s.algebras._
import github4s.interpreters.StaticAccessToken
import github4s.modules._
import org.http4s.client.Client

class Github[F[_]: Sync](
class Github[F[_]: Concurrent](
client: Client[F],
accessToken: AccessToken[F]
)(implicit config: GithubConfig)
Expand All @@ -45,7 +45,7 @@ class Github[F[_]: Sync](

object Github {

def apply[F[_]: Sync](
def apply[F[_]: Concurrent](
client: Client[F],
accessToken: Option[String] = None
)(implicit config: GithubConfig): Github[F] =
Expand Down
5 changes: 4 additions & 1 deletion github4s/src/main/scala/github4s/GithubConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package github4s

import org.http4s.Header
import org.typelevel.ci.CIString

/**
* Configuration for github4s
Expand All @@ -31,7 +32,9 @@ final case class GithubConfig(
accessTokenUrl: String,
headers: Map[String, String]
) {
def toHeaderList: List[Header] = headers.map { case (k, v) => Header(k, v) }.toList
def toHeaderList: List[Header.Raw] = headers.map { case (k, v) =>
Header.Raw(CIString(k), v)
}.toList
}

object GithubConfig {
Expand Down
42 changes: 0 additions & 42 deletions github4s/src/main/scala/github4s/GithubIOSyntax.scala

This file was deleted.

9 changes: 5 additions & 4 deletions github4s/src/main/scala/github4s/algebras/AccessToken.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ import github4s.GHResponse
/**
* Source of static or expiring github tokens
*
* For github app authentication you'd want to create a token source
* which calls github's installation authentication api with a jwt token, generated from a private key
* These tokens have a 1h lifetime, so it's a good idea to handle expired tokens here as well
* For github app authentication you'd want to create a token source which calls github's
* installation authentication api with a jwt token, generated from a private key These tokens have
* a 1h lifetime, so it's a good idea to handle expired tokens here as well
*
* @see https://docs.github.com/en/free-pro-team@latest/developers/apps/authenticating-with-github-apps
* @see
* https://docs.github.com/en/free-pro-team@latest/developers/apps/authenticating-with-github-apps
*/
trait AccessToken[F[_]] {

Expand Down
19 changes: 10 additions & 9 deletions github4s/src/main/scala/github4s/algebras/GitData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ trait GitData[F[_]] {
* @param ref ref formatted as heads/branch
* @param sha the SHA1 value to set this reference to
* @param force Indicates whether to force the update or to make sure the update is a fast-forward update.
* Leaving this out or setting it to `false` will make sure you're not overwriting work. Default: `false`
* Leaving this out or setting it to `false` will make sure you're not overwriting work.
* Default: `false`
* @param headers optional user headers to include in the request
* @return a GHResponse with the Ref
*/
Expand Down Expand Up @@ -196,14 +197,14 @@ trait GitData[F[_]] {
* @param repo name of the repo
* @param baseTree the SHA1 of the tree you want to update with new data.
* @param treeDataList list (of path, mode, type, and sha/blob) specifying a tree structure:
* - path: The file referenced in the tree
* - mode: The file mode; one of 100644 for file (blob), 100755 for executable (blob),
* 040000 for subdirectory (tree), 160000 for submodule (commit),
* or 120000 for a blob that specifies the path of a symlink
* - type string Either blob, tree, or commit
* - sha string The SHA1 checksum ID of the object in the tree
* - content string The content you want this file to have.
* GitHub will write this blob out and use that SHA for this entry. Use either this, or tree.sha.
* - path: The file referenced in the tree
* - mode: The file mode; one of 100644 for file (blob), 100755 for executable (blob),
* 040000 for subdirectory (tree), 160000 for submodule (commit),
* or 120000 for a blob that specifies the path of a symlink
* - type string Either blob, tree, or commit
* - sha string The SHA1 checksum ID of the object in the tree
* - content string The content you want this file to have.
* GitHub will write this blob out and use that SHA for this entry. Use either this, or tree.sha.
* @param headers optional user headers to include in the request
* @return a GHResponse with TreeResult
*/
Expand Down
13 changes: 5 additions & 8 deletions github4s/src/main/scala/github4s/algebras/Issues.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ trait Issues[F[_]] {
* List issues for a repository
*
* Note: In the past, pull requests and issues were more closely aligned than they are now.
* As far as the API is concerned, every pull request is an issue, but not every issue is a
* pull request.
* As far as the API is concerned, every pull request is an issue, but not every issue is a pull request.
*
* This endpoint may also return pull requests in the response. If an issue is a pull request,
* the object will include a `pull_request` key.
Expand All @@ -50,8 +49,7 @@ trait Issues[F[_]] {
* Get a single issue of a repository
*
* Note: In the past, pull requests and issues were more closely aligned than they are now.
* As far as the API is concerned, every pull request is an issue, but not every issue is a
* pull request.
* As far as the API is concerned, every pull request is an issue, but not every issue is a pull request.
*
* This endpoint may also return pull requests in the response. If an issue is a pull request,
* the object will include a `pull_request` key.
Expand All @@ -73,8 +71,7 @@ trait Issues[F[_]] {
* Search for issues
*
* Note: In the past, pull requests and issues were more closely aligned than they are now.
* As far as the API is concerned, every pull request is an issue, but not every issue is a
* pull request.
* As far as the API is concerned, every pull request is an issue, but not every issue is a pull request.
*
* This endpoint may also return pull requests in the response. If an issue is a pull request,
* the object will include a `pull_request` key.
Expand Down Expand Up @@ -380,7 +377,7 @@ trait Issues[F[_]] {
* @param title The title of the milestone.
* @param state The state of the milestone. Either open or closed. Default: open
* @param description A description of the milestone.
* @param due_on The milestone due date. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
* @param due_on The milestone due date. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
* @param headers optional user headers to include in the request
* @return a GHResponse with the created Milestone
*/
Expand Down Expand Up @@ -419,7 +416,7 @@ trait Issues[F[_]] {
* @param title The title of the milestone.
* @param state The state of the milestone. Either open or closed. Default: open
* @param description A description of the milestone.
* @param due_on The milestone due date. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
* @param due_on The milestone due date. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
* @param headers optional user headers to include in the request
* @return a GHResponse with the updated Milestone
*/
Expand Down
16 changes: 8 additions & 8 deletions github4s/src/main/scala/github4s/algebras/Projects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ trait Projects[F[_]] {
/**
* List the projects belonging to a specific organization
*
* @param org Organization for which we want to retrieve the projects
* @param state Filter projects returned by their state. Can be either `open`, `closed`, `all`.
* Default: `open`
* @param org Organization for which we want to retrieve the projects
* @param state Filter projects returned by their state. Can be either `open`, `closed`, `all`.
* Default: `open`
* @param pagination Limit and Offset for pagination
* @param headers Optional user headers to include in the request
* @return GHResponse with the list of projects belonging to this organization
Expand All @@ -41,12 +41,12 @@ trait Projects[F[_]] {
/**
* List the projects belonging to a specific repository
*
* @param owner of the repo
* @param repo name of the repo
* @param state Filter projects returned by their state. Can be either `open`, `closed`, `all`.
* Default: `open`
* @param owner of the repo
* @param repo name of the repo
* @param state Filter projects returned by their state. Can be either `open`, `closed`, `all`.
* Default: `open`
* @param pagination Limit and Offset for pagination
* @param headers Optional user headers to include in the request
* @param headers Optional user headers to include in the request
* @return GHResponse with lists the projects in a repository.
*/
def listProjectsRepository(
Expand Down
Loading

0 comments on commit 56e2675

Please sign in to comment.