diff --git a/build.sbt b/build.sbt index 6d4da2c9..dbacdf60 100644 --- a/build.sbt +++ b/build.sbt @@ -1,4 +1,7 @@ import ProjectPlugin.on +import com.typesafe.tools.mima.core._ + +Global / onChangedBuildSource := ReloadOnSourceChanges ThisBuild / organization := "com.47deg" @@ -10,7 +13,12 @@ val allScalaVersions = scala2Versions :+ scala3Version ThisBuild / scalaVersion := scala213 ThisBuild / crossScalaVersions := allScalaVersions -addCommandAlias("ci-test", "scalafmtCheckAll; scalafmtSbtCheck; mdoc; ++test") +disablePlugins(MimaPlugin) + +addCommandAlias( + "ci-test", + "scalafmtCheckAll; scalafmtSbtCheck; mimaReportBinaryIssues; mdoc; ++test" +) addCommandAlias("ci-docs", "github; mdoc; headerCreateAll; publishMicrosite") addCommandAlias("ci-publish", "github; ci-release") @@ -19,6 +27,7 @@ publish / skip := true lazy val github4s = (crossProject(JSPlatform, JVMPlatform)) .crossType(CrossType.Full) .withoutSuffixFor(JVMPlatform) + .enablePlugins(MimaPlugin) .settings(coreDeps: _*) .jsSettings( // See the README for why this is necessary @@ -30,7 +39,11 @@ lazy val github4s = (crossProject(JSPlatform, JVMPlatform)) // Increase number of inlines, needed for circe semiauto derivation scalacOptions ++= on(3)(Seq("-Xmax-inlines", "48")).value.flatten, // Disable nonunit warning on tests - Test / scalacOptions -= "-Wnonunit-statement" + Test / scalacOptions -= "-Wnonunit-statement", + mimaPreviousArtifacts := Set("com.47deg" %% "github4s" % "0.32.1"), + mimaBinaryIssueFilters ++= Seq( + ProblemFilters.exclude[IncompatibleMethTypeProblem]("github4s.http.HttpClient.this") + ) ) ////////// @@ -41,11 +54,13 @@ lazy val microsite: Project = project .dependsOn(github4s.jvm) .enablePlugins(MicrositesPlugin) .enablePlugins(ScalaUnidocPlugin) + .disablePlugins(MimaPlugin) .settings(micrositeSettings: _*) .settings(publish / skip := true) .settings(ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(github4s.jvm, microsite)) lazy val documentation = project .enablePlugins(MdocPlugin) + .disablePlugins(MimaPlugin) .settings(mdocOut := file(".")) .settings(publish / skip := true) diff --git a/github4s/shared/src/main/scala/github4s/Github.scala b/github4s/shared/src/main/scala/github4s/Github.scala index 8fe15871..6f921516 100644 --- a/github4s/shared/src/main/scala/github4s/Github.scala +++ b/github4s/shared/src/main/scala/github4s/Github.scala @@ -16,36 +16,21 @@ package github4s -import cats.effect.kernel.Concurrent +import cats.effect.Concurrent import github4s.algebras._ import github4s.interpreters.StaticAccessToken -import github4s.modules._ import org.http4s.client.Client +@deprecated("Use github4s.GithubClient instead", "0.33.0") class Github[F[_]: Concurrent]( client: Client[F], accessToken: AccessToken[F] )(implicit config: GithubConfig) - extends GithubAPIs[F] { - - private lazy val module: GithubAPIs[F] = new GithubAPIv3[F](client, config, accessToken) - - lazy val users: Users[F] = module.users - lazy val repos: Repositories[F] = module.repos - lazy val auth: Auth[F] = module.auth - lazy val gists: Gists[F] = module.gists - lazy val issues: Issues[F] = module.issues - lazy val activities: Activities[F] = module.activities - lazy val gitData: GitData[F] = module.gitData - lazy val pullRequests: PullRequests[F] = module.pullRequests - lazy val organizations: Organizations[F] = module.organizations - lazy val teams: Teams[F] = module.teams - lazy val projects: Projects[F] = module.projects - lazy val search: Search[F] = module.search -} + extends GithubClient[F](client, AccessHeader.from(accessToken)) object Github { + @deprecated("Use github4s.GithubClient instead", "0.33.0") def apply[F[_]: Concurrent]( client: Client[F], accessToken: Option[String] = None diff --git a/github4s/shared/src/main/scala/github4s/GithubClient.scala b/github4s/shared/src/main/scala/github4s/GithubClient.scala new file mode 100644 index 00000000..49b0c045 --- /dev/null +++ b/github4s/shared/src/main/scala/github4s/GithubClient.scala @@ -0,0 +1,60 @@ +/* + * Copyright 2016-2023 47 Degrees Open Source + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package github4s + +import cats.effect.Concurrent +import github4s.algebras._ +import github4s.interpreters.StaticAccessToken +import github4s.modules._ +import org.http4s.client.Client + +private[github4s] class GithubClient[F[_]: Concurrent]( + client: Client[F], + authHeader: AccessHeader[F] +)(implicit config: GithubConfig) + extends GithubAPIs[F] { + + private lazy val module: GithubAPIs[F] = new GithubAPIsV3[F](client, config, authHeader) + + lazy val users: Users[F] = module.users + lazy val repos: Repositories[F] = module.repos + lazy val auth: Auth[F] = module.auth + lazy val gists: Gists[F] = module.gists + lazy val issues: Issues[F] = module.issues + lazy val activities: Activities[F] = module.activities + lazy val gitData: GitData[F] = module.gitData + lazy val pullRequests: PullRequests[F] = module.pullRequests + lazy val organizations: Organizations[F] = module.organizations + lazy val teams: Teams[F] = module.teams + lazy val projects: Projects[F] = module.projects + lazy val search: Search[F] = module.search +} + +object GithubClient { + + def apply[F[_]: Concurrent]( + client: Client[F], + accessToken: Option[String] = None + )(implicit config: GithubConfig): GithubAPIs[F] = + new GithubClient[F](client, AccessHeader.from(new StaticAccessToken(accessToken))) + + def apply[F[_]: Concurrent]( + client: Client[F], + authHeader: AccessHeader[F] + )(implicit config: GithubConfig): GithubAPIs[F] = + new GithubClient[F](client, authHeader) +} diff --git a/github4s/shared/src/main/scala/github4s/algebras/AccessHeader.scala b/github4s/shared/src/main/scala/github4s/algebras/AccessHeader.scala new file mode 100644 index 00000000..7c648859 --- /dev/null +++ b/github4s/shared/src/main/scala/github4s/algebras/AccessHeader.scala @@ -0,0 +1,16 @@ +package github4s.algebras + +import github4s.GHResponse + +trait AccessHeader[F[_]] { + def withAccessHeader[T](f: Map[String, String] => F[GHResponse[T]]): F[GHResponse[T]] +} + +object AccessHeader { + def from[F[_]](accessToken: AccessToken[F]): AccessHeader[F] = new AccessHeader[F] { + override def withAccessHeader[T](f: Map[String, String] => F[GHResponse[T]]): F[GHResponse[T]] = + accessToken.withAccessToken { token => + f(token.fold(Map.empty[String, String])(t => Map("Authorization" -> s"token $t"))) + } + } +} diff --git a/github4s/shared/src/main/scala/github4s/algebras/AccessToken.scala b/github4s/shared/src/main/scala/github4s/algebras/AccessToken.scala index 7d387f22..e0fadd75 100644 --- a/github4s/shared/src/main/scala/github4s/algebras/AccessToken.scala +++ b/github4s/shared/src/main/scala/github4s/algebras/AccessToken.scala @@ -29,6 +29,5 @@ import github4s.GHResponse * https://docs.github.com/en/free-pro-team@latest/developers/apps/authenticating-with-github-apps */ trait AccessToken[F[_]] { - def withAccessToken[T](f: Option[String] => F[GHResponse[T]]): F[GHResponse[T]] } diff --git a/github4s/shared/src/main/scala/github4s/http/HttpClient.scala b/github4s/shared/src/main/scala/github4s/http/HttpClient.scala index 5681c507..32c9e19f 100644 --- a/github4s/shared/src/main/scala/github4s/http/HttpClient.scala +++ b/github4s/shared/src/main/scala/github4s/http/HttpClient.scala @@ -22,7 +22,7 @@ import cats.effect.kernel.Concurrent import cats.syntax.all._ import github4s.GHError._ import github4s._ -import github4s.algebras.AccessToken +import github4s.algebras.{AccessHeader, AccessToken} import github4s.domain.Pagination import github4s.http.Http4sSyntax._ import io.circe.{Decoder, Encoder} @@ -31,13 +31,13 @@ import org.http4s.circe.jsonOf import org.http4s.client.Client import org.http4s._ -class HttpClient[F[_]: Concurrent]( +class HttpClient[F[_]: Concurrent] private ( client: Client[F], val config: GithubConfig, - accessTokens: AccessToken[F] + accessHeader: AccessHeader[F] ) { import HttpClient._ - import accessTokens._ + import accessHeader._ def get[Res: Decoder]( method: String, @@ -45,10 +45,10 @@ class HttpClient[F[_]: Concurrent]( params: Map[String, String] = Map.empty, pagination: Option[Pagination] = None ): F[GHResponse[Res]] = - withAccessToken { accessToken => + withAccessHeader { authHeader => run[Unit, Res]( RequestBuilder(url = buildURL(method)) - .withAuth(accessToken) + .withAuthHeader(authHeader) .withHeaders(headers) .withParams( params ++ pagination.fold(Map.empty[String, String])(p => @@ -62,9 +62,9 @@ class HttpClient[F[_]: Concurrent]( url: String, headers: Map[String, String] = Map.empty ): F[GHResponse[Unit]] = - withAccessToken(accessToken => + withAccessHeader(authHeader => runWithoutResponse[Unit]( - RequestBuilder(buildURL(url)).withHeaders(headers).withAuth(accessToken) + RequestBuilder(buildURL(url)).withHeaders(headers).withAuthHeader(authHeader) ) ) @@ -73,10 +73,10 @@ class HttpClient[F[_]: Concurrent]( headers: Map[String, String] = Map.empty, data: Req ): F[GHResponse[Res]] = - withAccessToken(accessToken => + withAccessHeader(authHeader => run[Req, Res]( RequestBuilder(buildURL(method)).patchMethod - .withAuth(accessToken) + .withAuthHeader(authHeader) .withHeaders(headers) .withData(data) ) @@ -87,10 +87,10 @@ class HttpClient[F[_]: Concurrent]( headers: Map[String, String] = Map(), data: Req ): F[GHResponse[Res]] = - withAccessToken(accessToken => + withAccessHeader(authHeader => run[Req, Res]( RequestBuilder(buildURL(url)).putMethod - .withAuth(accessToken) + .withAuthHeader(authHeader) .withHeaders(headers) .withData(data) ) @@ -101,10 +101,10 @@ class HttpClient[F[_]: Concurrent]( headers: Map[String, String] = Map.empty, data: Req ): F[GHResponse[Res]] = - withAccessToken(accessToken => + withAccessHeader(authHeader => run[Req, Res]( RequestBuilder(buildURL(url)).postMethod - .withAuth(accessToken) + .withAuthHeader(authHeader) .withHeaders(headers) .withData(data) ) @@ -132,9 +132,9 @@ class HttpClient[F[_]: Concurrent]( url: String, headers: Map[String, String] = Map.empty ): F[GHResponse[Unit]] = - withAccessToken(accessToken => + withAccessHeader(authHeader => run[Unit, Unit]( - RequestBuilder(buildURL(url)).deleteMethod.withHeaders(headers).withAuth(accessToken) + RequestBuilder(buildURL(url)).deleteMethod.withHeaders(headers).withAuthHeader(authHeader) ) ) @@ -142,10 +142,10 @@ class HttpClient[F[_]: Concurrent]( url: String, headers: Map[String, String] = Map.empty ): F[GHResponse[Res]] = - withAccessToken(accessToken => + withAccessHeader(authHeader => run[Unit, Res]( RequestBuilder(buildURL(url)).deleteMethod - .withAuth(accessToken) + .withAuthHeader(authHeader) .withHeaders(headers) ) ) @@ -155,10 +155,10 @@ class HttpClient[F[_]: Concurrent]( headers: Map[String, String] = Map.empty, data: Req ): F[GHResponse[Res]] = - withAccessToken(accessToken => + withAccessHeader(authHeader => run[Req, Res]( RequestBuilder(buildURL(url)).deleteMethod - .withAuth(accessToken) + .withAuthHeader(authHeader) .withHeaders(headers) .withData(data) ) @@ -231,4 +231,18 @@ object HttpClient { private def responseBody[F[_]: Concurrent](response: Response[F]): F[String] = response.bodyText.compile.foldMonoid + + def apply[F[_]: Concurrent]( + client: Client[F], + config: GithubConfig, + accessToken: AccessToken[F] + ): HttpClient[F] = + new HttpClient[F](client, config, AccessHeader.from(accessToken)) + + def apply[F[_]: Concurrent]( + client: Client[F], + config: GithubConfig, + accessHeader: AccessHeader[F] + ): HttpClient[F] = + new HttpClient[F](client, config, accessHeader) } diff --git a/github4s/shared/src/main/scala/github4s/http/RequestBuilder.scala b/github4s/shared/src/main/scala/github4s/http/RequestBuilder.scala index 6da83918..1b8badc3 100644 --- a/github4s/shared/src/main/scala/github4s/http/RequestBuilder.scala +++ b/github4s/shared/src/main/scala/github4s/http/RequestBuilder.scala @@ -41,6 +41,9 @@ case class RequestBuilder[Res]( def withData(data: Res): RequestBuilder[Res] = this.copy(data = Some(data)) + def withAuthHeader(authHeader: Map[String, String]): RequestBuilder[Res] = + this.copy(authHeader = authHeader) + def withAuth(accessToken: Option[String] = None): RequestBuilder[Res] = this.copy(authHeader = accessToken match { case Some(token) => Map("Authorization" -> s"token $token") diff --git a/github4s/shared/src/main/scala/github4s/interpreters/StaticAccessHeader.scala b/github4s/shared/src/main/scala/github4s/interpreters/StaticAccessHeader.scala new file mode 100644 index 00000000..e4f11c72 --- /dev/null +++ b/github4s/shared/src/main/scala/github4s/interpreters/StaticAccessHeader.scala @@ -0,0 +1,13 @@ +package github4s.interpreters + +import github4s.GHResponse +import github4s.algebras.AccessHeader + +case class StaticAccessHeader[F[_]](accessHeader: Map[String, String]) extends AccessHeader[F] { + override def withAccessHeader[T](f: Map[String, String] => F[GHResponse[T]]): F[GHResponse[T]] = + f(accessHeader) +} + +object StaticAccessHeader { + def noHeader[F[_]] = new StaticAccessHeader[F](Map.empty) +} diff --git a/github4s/shared/src/main/scala/github4s/modules/GithubAPIs.scala b/github4s/shared/src/main/scala/github4s/modules/GithubAPIs.scala index 46cc551a..f453a280 100644 --- a/github4s/shared/src/main/scala/github4s/modules/GithubAPIs.scala +++ b/github4s/shared/src/main/scala/github4s/modules/GithubAPIs.scala @@ -19,35 +19,18 @@ package github4s.modules import cats.effect.kernel.Concurrent import github4s.GithubConfig import github4s.algebras._ -import github4s.http.HttpClient import github4s.interpreters._ import org.http4s.client.Client +@deprecated("Use github4s.modules.GithubAPIsV3 instead", "0.33.0") class GithubAPIv3[F[_]: Concurrent]( client: Client[F], config: GithubConfig, accessToken: AccessToken[F] -) extends GithubAPIs[F] { - - implicit val httpClient: HttpClient[F] = new HttpClient[F](client, config, accessToken) - - override val users: Users[F] = new UsersInterpreter[F] - override val repos: Repositories[F] = new RepositoriesInterpreter[F] - override val auth: Auth[F] = new AuthInterpreter[F] - override val gists: Gists[F] = new GistsInterpreter[F] - override val issues: Issues[F] = new IssuesInterpreter[F] - override val activities: Activities[F] = new ActivitiesInterpreter[F] - override val gitData: GitData[F] = new GitDataInterpreter[F] - override val pullRequests: PullRequests[F] = new PullRequestsInterpreter[F] - override val organizations: Organizations[F] = new OrganizationsInterpreter[F] - override val teams: Teams[F] = new TeamsInterpreter[F] - override val projects: Projects[F] = new ProjectsInterpreter[F] - override val search: Search[F] = new SearchInterpreter[F] - -} +) extends GithubAPIsV3[F](client, config, AccessHeader.from(accessToken)) object GithubAPIv3 { - + @deprecated("Use github4s.modules.GithubAPIsV3.noAuth instead", "0.33.0") def noAuth[F[_]: Concurrent](client: Client[F], config: GithubConfig): GithubAPIv3[F] = new GithubAPIv3[F](client, config, StaticAccessToken.noToken) } diff --git a/github4s/shared/src/main/scala/github4s/modules/GithubAPIsV3.scala b/github4s/shared/src/main/scala/github4s/modules/GithubAPIsV3.scala new file mode 100644 index 00000000..550eaf1e --- /dev/null +++ b/github4s/shared/src/main/scala/github4s/modules/GithubAPIsV3.scala @@ -0,0 +1,53 @@ +/* + * Copyright 2016-2023 47 Degrees Open Source + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package github4s.modules + +import cats.effect.Concurrent +import github4s.GithubConfig +import github4s.algebras._ +import github4s.http.HttpClient +import github4s.interpreters._ +import org.http4s.client.Client + +class GithubAPIsV3[F[_]: Concurrent]( + client: Client[F], + config: GithubConfig, + accessHeader: AccessHeader[F] +) extends GithubAPIs[F] { + + implicit val httpClient: HttpClient[F] = HttpClient[F](client, config, accessHeader) + + override val users: Users[F] = new UsersInterpreter[F] + override val repos: Repositories[F] = new RepositoriesInterpreter[F] + override val auth: Auth[F] = new AuthInterpreter[F] + override val gists: Gists[F] = new GistsInterpreter[F] + override val issues: Issues[F] = new IssuesInterpreter[F] + override val activities: Activities[F] = new ActivitiesInterpreter[F] + override val gitData: GitData[F] = new GitDataInterpreter[F] + override val pullRequests: PullRequests[F] = new PullRequestsInterpreter[F] + override val organizations: Organizations[F] = new OrganizationsInterpreter[F] + override val teams: Teams[F] = new TeamsInterpreter[F] + override val projects: Projects[F] = new ProjectsInterpreter[F] + override val search: Search[F] = new SearchInterpreter[F] + +} + +object GithubAPIsV3 { + + def noAuth[F[_]: Concurrent](client: Client[F], config: GithubConfig): GithubAPIsV3[F] = + new GithubAPIsV3[F](client, config, StaticAccessHeader.noHeader) +} diff --git a/github4s/shared/src/test/scala/github4s/integration/ActivitiesSpec.scala b/github4s/shared/src/test/scala/github4s/integration/ActivitiesSpec.scala index b4c8beac..3b8c9a67 100644 --- a/github4s/shared/src/test/scala/github4s/integration/ActivitiesSpec.scala +++ b/github4s/shared/src/test/scala/github4s/integration/ActivitiesSpec.scala @@ -18,7 +18,7 @@ package github4s.integration import cats.effect.IO import github4s.GHError.NotFoundError -import github4s.Github +import github4s.GithubClient import github4s.domain._ import github4s.utils.{BaseIntegrationSpec, Integration} @@ -27,7 +27,7 @@ trait ActivitiesSpec extends BaseIntegrationSpec { "Activity >> Set a thread subscription" should "return expected response when a valid thread id is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).activities + GithubClient[IO](client, accessToken).activities .setThreadSub(validThreadId, true, false, headerUserAgent) } .unsafeRunSync() @@ -39,7 +39,7 @@ trait ActivitiesSpec extends BaseIntegrationSpec { it should "return error when an invalid thread id is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).activities + GithubClient[IO](client, accessToken).activities .setThreadSub(invalidThreadId, true, false, headerUserAgent) } .unsafeRunSync() @@ -51,7 +51,7 @@ trait ActivitiesSpec extends BaseIntegrationSpec { "Activity >> ListStargazers" should "return the expected list of starrers for valid data" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).activities + GithubClient[IO](client, accessToken).activities .listStargazers(validRepoOwner, validRepoName, false, None, headerUserAgent) } .unsafeRunSync() @@ -69,7 +69,7 @@ trait ActivitiesSpec extends BaseIntegrationSpec { it should "return the expected list of starrers for valid data with dates if timeline" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).activities + GithubClient[IO](client, accessToken).activities .listStargazers(validRepoOwner, validRepoName, true, None, headerUserAgent) } .unsafeRunSync() @@ -87,7 +87,7 @@ trait ActivitiesSpec extends BaseIntegrationSpec { it should "return error for invalid repo name" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).activities + GithubClient[IO](client, accessToken).activities .listStargazers(invalidRepoName, validRepoName, false, None, headerUserAgent) } .unsafeRunSync() @@ -99,7 +99,7 @@ trait ActivitiesSpec extends BaseIntegrationSpec { "Activity >> ListStarredRepositories" should "return the expected list of starred repos" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).activities + GithubClient[IO](client, accessToken).activities .listStarredRepositories(validUsername, false, headers = headerUserAgent) } .unsafeRunSync() @@ -117,7 +117,7 @@ trait ActivitiesSpec extends BaseIntegrationSpec { it should "return the expected list of starred repos with dates if timeline" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).activities + GithubClient[IO](client, accessToken).activities .listStarredRepositories(validUsername, true, headers = headerUserAgent) } .unsafeRunSync() @@ -135,7 +135,7 @@ trait ActivitiesSpec extends BaseIntegrationSpec { it should "return error for invalid username" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).activities + GithubClient[IO](client, accessToken).activities .listStarredRepositories(invalidUsername, false, headers = headerUserAgent) } .unsafeRunSync() @@ -147,7 +147,7 @@ trait ActivitiesSpec extends BaseIntegrationSpec { "Activity >> PublicOrganizationEvents" should "return the expected list of events" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).activities + GithubClient[IO](client, accessToken).activities .listPublicOrganizationEvents(validOrganizationName, headers = headerUserAgent) } .unsafeRunSync() @@ -167,7 +167,7 @@ trait ActivitiesSpec extends BaseIntegrationSpec { it should "return error for invalid organization" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).activities + GithubClient[IO](client, accessToken).activities .listPublicOrganizationEvents(invalidOrganizationName, headers = headerUserAgent) } .unsafeRunSync() @@ -179,7 +179,7 @@ trait ActivitiesSpec extends BaseIntegrationSpec { "Activity >> PublicRepositoryEvents" should "return the expected list of events" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).activities + GithubClient[IO](client, accessToken).activities .listPublicRepositoryEvents(validRepoOwner, validRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -199,7 +199,7 @@ trait ActivitiesSpec extends BaseIntegrationSpec { it should "return error for invalid repository owner" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).activities + GithubClient[IO](client, accessToken).activities .listPublicRepositoryEvents(invalidRepoOwner, validRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -211,7 +211,7 @@ trait ActivitiesSpec extends BaseIntegrationSpec { it should "return error for invalid repository name" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).activities + GithubClient[IO](client, accessToken).activities .listPublicRepositoryEvents(validRepoOwner, invalidRepoName, headers = headerUserAgent) } .unsafeRunSync() diff --git a/github4s/shared/src/test/scala/github4s/integration/AuthSpec.scala b/github4s/shared/src/test/scala/github4s/integration/AuthSpec.scala index d33ad41b..8aceceb7 100644 --- a/github4s/shared/src/test/scala/github4s/integration/AuthSpec.scala +++ b/github4s/shared/src/test/scala/github4s/integration/AuthSpec.scala @@ -17,7 +17,7 @@ package github4s.integration import cats.effect.IO -import github4s.{GHError, Github} +import github4s.{GHError, GithubClient} import github4s.domain._ import github4s.utils.{BaseIntegrationSpec, Integration} @@ -26,7 +26,7 @@ trait AuthSpec extends BaseIntegrationSpec { "Auth >> AuthorizeUrl" should "return the expected URL for valid username" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client).auth + GithubClient[IO](client).auth .authorizeUrl(validClientId, validRedirectUri, validScopes) } .unsafeRunSync() @@ -38,7 +38,7 @@ trait AuthSpec extends BaseIntegrationSpec { "Auth >> GetAccessToken" should "return error on Left for invalid code value" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client).auth + GithubClient[IO](client).auth .getAccessToken( validClientId, invalidClientSecret, diff --git a/github4s/shared/src/test/scala/github4s/integration/GitDataSpec.scala b/github4s/shared/src/test/scala/github4s/integration/GitDataSpec.scala index 3f11f9c9..929bcb76 100644 --- a/github4s/shared/src/test/scala/github4s/integration/GitDataSpec.scala +++ b/github4s/shared/src/test/scala/github4s/integration/GitDataSpec.scala @@ -19,7 +19,7 @@ package github4s.integration import cats.data.NonEmptyList import cats.effect.IO import github4s.GHError.NotFoundError -import github4s.Github +import github4s.GithubClient import github4s.domain._ import github4s.utils.{BaseIntegrationSpec, Integration} @@ -28,7 +28,7 @@ trait GitDataSpec extends BaseIntegrationSpec { "GitData >> GetReference" should "return a list of references" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).gitData + GithubClient[IO](client, accessToken).gitData .getReference(validRepoOwner, validRepoName, "heads", None, headerUserAgent) } .unsafeRunSync() @@ -40,7 +40,7 @@ trait GitDataSpec extends BaseIntegrationSpec { it should "return at least one reference" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).gitData + GithubClient[IO](client, accessToken).gitData .getReference(validRepoOwner, validRepoName, validRefSingle, None, headerUserAgent) } .unsafeRunSync() @@ -52,7 +52,7 @@ trait GitDataSpec extends BaseIntegrationSpec { it should "return an error when an invalid repository name is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).gitData + GithubClient[IO](client, accessToken).gitData .getReference(validRepoOwner, invalidRepoName, validRefSingle, None, headerUserAgent) } .unsafeRunSync() @@ -64,7 +64,7 @@ trait GitDataSpec extends BaseIntegrationSpec { "GitData >> GetCommit" should "return one commit" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).gitData + GithubClient[IO](client, accessToken).gitData .getCommit(validRepoOwner, validRepoName, validCommitSha, headerUserAgent) } .unsafeRunSync() @@ -76,7 +76,7 @@ trait GitDataSpec extends BaseIntegrationSpec { it should "return an error when an invalid repository name is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).gitData + GithubClient[IO](client, accessToken).gitData .getCommit(validRepoOwner, invalidRepoName, validCommitSha, headerUserAgent) } .unsafeRunSync() @@ -88,7 +88,7 @@ trait GitDataSpec extends BaseIntegrationSpec { "GitData >> GetTree" should "return the file tree non-recursively" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).gitData + GithubClient[IO](client, accessToken).gitData .getTree( validRepoOwner, validRepoName, @@ -112,7 +112,7 @@ trait GitDataSpec extends BaseIntegrationSpec { it should "return the file tree recursively" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).gitData + GithubClient[IO](client, accessToken).gitData .getTree(validRepoOwner, validRepoName, validCommitSha, recursive = true, headerUserAgent) } .unsafeRunSync() @@ -135,7 +135,7 @@ trait GitDataSpec extends BaseIntegrationSpec { it should "return an error when an invalid repository name is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).gitData + GithubClient[IO](client, accessToken).gitData .getTree( validRepoOwner, invalidRepoName, diff --git a/github4s/shared/src/test/scala/github4s/integration/IssuesSpec.scala b/github4s/shared/src/test/scala/github4s/integration/IssuesSpec.scala index e5d4d293..cba13ee0 100644 --- a/github4s/shared/src/test/scala/github4s/integration/IssuesSpec.scala +++ b/github4s/shared/src/test/scala/github4s/integration/IssuesSpec.scala @@ -18,7 +18,7 @@ package github4s.integration import cats.effect.IO import github4s.GHError.NotFoundError -import github4s.Github +import github4s.GithubClient import github4s.domain._ import github4s.utils.{BaseIntegrationSpec, Integration} @@ -27,7 +27,7 @@ trait IssuesSpec extends BaseIntegrationSpec { "Issues >> List" should "return a list of issues" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .listIssues(validRepoOwner, validRepoName, None, headerUserAgent) } .unsafeRunSync() @@ -39,7 +39,7 @@ trait IssuesSpec extends BaseIntegrationSpec { "Issues >> Get" should "return an issue which is a PR" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .getIssue(validRepoOwner, validRepoName, validPullRequestNumber, headerUserAgent) } .unsafeRunSync() @@ -51,7 +51,7 @@ trait IssuesSpec extends BaseIntegrationSpec { "Issues >> Search" should "return at least one issue for a valid query" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .searchIssues(validSearchQuery, validSearchParams, None, headerUserAgent) } .unsafeRunSync() @@ -69,7 +69,7 @@ trait IssuesSpec extends BaseIntegrationSpec { it should "not regress github #569" taggedAs Integration in { clientResource .use { client => - Github[IO](client, accessToken).issues.searchIssues( + GithubClient[IO](client, accessToken).issues.searchIssues( "", List( OwnerParamInRepository("47degrees/github4s"), @@ -87,7 +87,7 @@ trait IssuesSpec extends BaseIntegrationSpec { it should "return an empty result for a non existent query string" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .searchIssues(nonExistentSearchQuery, validSearchParams, None, headerUserAgent) } .unsafeRunSync() @@ -105,7 +105,7 @@ trait IssuesSpec extends BaseIntegrationSpec { "Issues >> Edit" should "edit the specified issue" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .editIssue( validRepoOwner, validRepoName, @@ -134,7 +134,7 @@ trait IssuesSpec extends BaseIntegrationSpec { "Issues >> ListLabels" should "return a list of labels" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .listLabels(validRepoOwner, validRepoName, validIssueNumber, None, headerUserAgent) } .unsafeRunSync() @@ -146,7 +146,7 @@ trait IssuesSpec extends BaseIntegrationSpec { "Issues >> listLabelsRepository" should "return a list of labels" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .listLabelsRepository(validRepoOwner, validRepoName, None, headerUserAgent) } .unsafeRunSync() @@ -158,7 +158,7 @@ trait IssuesSpec extends BaseIntegrationSpec { it should "return error for an invalid repo owner" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .listLabelsRepository(invalidRepoOwner, validRepoName, None, headerUserAgent) } .unsafeRunSync() @@ -170,7 +170,7 @@ trait IssuesSpec extends BaseIntegrationSpec { it should "return error for an invalid repo name" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .listLabelsRepository(validRepoOwner, invalidRepoName, None, headerUserAgent) } .unsafeRunSync() @@ -182,7 +182,7 @@ trait IssuesSpec extends BaseIntegrationSpec { "Issues >> RemoveLabel" should "return a list of removed labels" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .removeLabel( validRepoOwner, validRepoName, @@ -200,7 +200,7 @@ trait IssuesSpec extends BaseIntegrationSpec { "Issues >> CreateLabel" should "return a created label" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .createLabel( validRepoOwner, validRepoName, @@ -217,7 +217,7 @@ trait IssuesSpec extends BaseIntegrationSpec { "Issues >> UpdateLabel" should "return a updated label" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .updateLabel( validRepoOwner, validRepoName, @@ -234,7 +234,7 @@ trait IssuesSpec extends BaseIntegrationSpec { "Issues >> DeleteLabel" should "return a valid status code" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .deleteLabel( validRepoOwner, validRepoName, @@ -250,7 +250,7 @@ trait IssuesSpec extends BaseIntegrationSpec { "Issues >> AddLabels" should "return a list of labels" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .addLabels( validRepoOwner, validRepoName, @@ -268,7 +268,7 @@ trait IssuesSpec extends BaseIntegrationSpec { "GHIssues >> ListAvailableAssignees" should "return a list of users" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .listAvailableAssignees(validRepoOwner, validRepoName, None, headerUserAgent) } .unsafeRunSync() @@ -280,7 +280,7 @@ trait IssuesSpec extends BaseIntegrationSpec { it should "return error for an invalid repo owner" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .listAvailableAssignees(invalidRepoOwner, validRepoName, None, headerUserAgent) } .unsafeRunSync() @@ -292,7 +292,7 @@ trait IssuesSpec extends BaseIntegrationSpec { it should "return error for an invalid repo name" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .listAvailableAssignees(validRepoOwner, invalidRepoName, None, headerUserAgent) } .unsafeRunSync() @@ -304,7 +304,7 @@ trait IssuesSpec extends BaseIntegrationSpec { "GHIssues >> ListMilestones" should "return a list of milestones" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .listMilestones( validRepoOwner, validRepoName, @@ -324,7 +324,7 @@ trait IssuesSpec extends BaseIntegrationSpec { it should "return error for an invalid repo owner" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .listMilestones( invalidRepoOwner, validRepoName, @@ -344,7 +344,7 @@ trait IssuesSpec extends BaseIntegrationSpec { it should "return error for an invalid repo name" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .listMilestones(validRepoOwner, invalidRepoName, None, None, None, None, headerUserAgent) } .unsafeRunSync() @@ -356,7 +356,7 @@ trait IssuesSpec extends BaseIntegrationSpec { "GHIssues >> GetMilestone" should "return a milestone for a valid number" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .getMilestone( validRepoOwner, validRepoName, @@ -373,7 +373,7 @@ trait IssuesSpec extends BaseIntegrationSpec { it should "return error for an invalid number" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).issues + GithubClient[IO](client, accessToken).issues .getMilestone( validRepoOwner, validRepoName, diff --git a/github4s/shared/src/test/scala/github4s/integration/OrganizationsSpec.scala b/github4s/shared/src/test/scala/github4s/integration/OrganizationsSpec.scala index 991b2e93..d850d1da 100644 --- a/github4s/shared/src/test/scala/github4s/integration/OrganizationsSpec.scala +++ b/github4s/shared/src/test/scala/github4s/integration/OrganizationsSpec.scala @@ -18,7 +18,7 @@ package github4s.integration import cats.effect.IO import github4s.GHError.NotFoundError -import github4s.Github +import github4s.GithubClient import github4s.domain._ import github4s.utils.{BaseIntegrationSpec, Integration} @@ -27,7 +27,7 @@ trait OrganizationsSpec extends BaseIntegrationSpec { "Organization >> ListMembers" should "return the expected list of users" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).organizations + GithubClient[IO](client, accessToken).organizations .listMembers(validRepoOwner, headers = headerUserAgent) } .unsafeRunSync() @@ -39,7 +39,7 @@ trait OrganizationsSpec extends BaseIntegrationSpec { it should "return error for an invalid org" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).organizations + GithubClient[IO](client, accessToken).organizations .listMembers(invalidUsername, headers = headerUserAgent) } .unsafeRunSync() @@ -51,7 +51,7 @@ trait OrganizationsSpec extends BaseIntegrationSpec { "Organization >> ListOutsideCollaborators" should "return expected list of users" ignore { val response = clientResource .use { client => - Github[IO](client, accessToken).organizations + GithubClient[IO](client, accessToken).organizations .listOutsideCollaborators(validOrganizationName, headers = headerUserAgent) } .unsafeRunSync() @@ -63,7 +63,7 @@ trait OrganizationsSpec extends BaseIntegrationSpec { it should "return error for an invalid org" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).organizations + GithubClient[IO](client, accessToken).organizations .listOutsideCollaborators(invalidOrganizationName, headers = headerUserAgent) } .unsafeRunSync() diff --git a/github4s/shared/src/test/scala/github4s/integration/ProjectsSpec.scala b/github4s/shared/src/test/scala/github4s/integration/ProjectsSpec.scala index f8ca44e0..e371fd62 100644 --- a/github4s/shared/src/test/scala/github4s/integration/ProjectsSpec.scala +++ b/github4s/shared/src/test/scala/github4s/integration/ProjectsSpec.scala @@ -18,7 +18,7 @@ package github4s.integration import cats.effect.IO import github4s.GHError.NotFoundError -import github4s.Github +import github4s.GithubClient import github4s.domain.{Card, Column, Project} import github4s.utils.{BaseIntegrationSpec, Integration} @@ -27,7 +27,7 @@ trait ProjectsSpec extends BaseIntegrationSpec { "Project >> ListProjects" should "return the expected projects when a valid org is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).projects + GithubClient[IO](client, accessToken).projects .listProjects(validRepoOwner, headers = headerUserAgent ++ headerAccept) } .unsafeRunSync() @@ -39,7 +39,7 @@ trait ProjectsSpec extends BaseIntegrationSpec { it should "return error when an invalid org is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).projects + GithubClient[IO](client, accessToken).projects .listProjects(invalidRepoName, headers = headerUserAgent ++ headerAccept) } .unsafeRunSync() @@ -51,7 +51,7 @@ trait ProjectsSpec extends BaseIntegrationSpec { "Project >> ListProjectsRepository" should "return the expected projects when a valid owner and repo are provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).projects + GithubClient[IO](client, accessToken).projects .listProjectsRepository( validRepoOwner, validRepoName, @@ -67,7 +67,7 @@ trait ProjectsSpec extends BaseIntegrationSpec { it should "return error when an invalid repo is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).projects + GithubClient[IO](client, accessToken).projects .listProjectsRepository( validRepoOwner, invalidRepoName, @@ -83,7 +83,7 @@ trait ProjectsSpec extends BaseIntegrationSpec { it should "return error when an invalid owner is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).projects + GithubClient[IO](client, accessToken).projects .listProjectsRepository( invalidRepoOwner, validRepoName, @@ -99,7 +99,7 @@ trait ProjectsSpec extends BaseIntegrationSpec { "Project >> ListColumns" should "return the expected column when a valid project id is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).projects + GithubClient[IO](client, accessToken).projects .listColumns(validProjectId, headers = headerUserAgent ++ headerAccept) } .unsafeRunSync() @@ -111,7 +111,7 @@ trait ProjectsSpec extends BaseIntegrationSpec { it should "return error when an invalid project id is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).projects + GithubClient[IO](client, accessToken).projects .listColumns(invalidProjectId, headers = headerUserAgent ++ headerAccept) } .unsafeRunSync() @@ -123,7 +123,7 @@ trait ProjectsSpec extends BaseIntegrationSpec { "Project >> ListCards" should "return the expected cards when a valid column id is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).projects + GithubClient[IO](client, accessToken).projects .listCards(validColumnId, headers = headerUserAgent ++ headerAccept) } .unsafeRunSync() @@ -135,7 +135,7 @@ trait ProjectsSpec extends BaseIntegrationSpec { it should "return error when an invalid column id is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).projects + GithubClient[IO](client, accessToken).projects .listCards(invalidColumnId, headers = headerUserAgent ++ headerAccept) } .unsafeRunSync() diff --git a/github4s/shared/src/test/scala/github4s/integration/PullRequestsSpec.scala b/github4s/shared/src/test/scala/github4s/integration/PullRequestsSpec.scala index 8f7033cf..bcbef5f9 100644 --- a/github4s/shared/src/test/scala/github4s/integration/PullRequestsSpec.scala +++ b/github4s/shared/src/test/scala/github4s/integration/PullRequestsSpec.scala @@ -18,7 +18,7 @@ package github4s.integration import cats.effect.IO import github4s.GHError.{JsonParsingError, NotFoundError} -import github4s.Github +import github4s.GithubClient import github4s.domain._ import github4s.utils.{BaseIntegrationSpec, Integration} @@ -27,7 +27,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { "PullRequests >> Get" should "return a right response when a valid pr number is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .getPullRequest( validRepoOwner, validRepoName, @@ -44,7 +44,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { it should "return an error when a valid issue number is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .getPullRequest( validRepoOwner, validRepoName, @@ -61,7 +61,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { it should "return an error when an invalid repo name is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .getPullRequest( validRepoOwner, invalidRepoName, @@ -78,7 +78,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { "PullRequests >> List" should "return a right response when valid repo is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .listPullRequests( validRepoOwner, validRepoName, @@ -95,7 +95,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { it should "return a right response when a valid repo is provided but not all pull requests have body" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .listPullRequests( "lloydmeta", "gh-test-repo", @@ -112,7 +112,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { it should "return a non empty list when valid repo and some filters are provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .listPullRequests( validRepoOwner, validRepoName, @@ -129,7 +129,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { it should "return error when an invalid repo name is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .listPullRequests(validRepoOwner, invalidRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -141,7 +141,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { "PullRequests >> ListFiles" should "return a right response when a valid repo is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .listFiles( validRepoOwner, validRepoName, @@ -158,7 +158,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { it should "return a right response when a valid repo is provided and not all files have 'patch'" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .listFiles("scala", "scala", 4877, headers = headerUserAgent) } .unsafeRunSync() @@ -170,7 +170,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { it should "return error when an invalid repo name is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .listFiles( validRepoOwner, invalidRepoName, @@ -187,7 +187,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { "PullRequests >> ListReviews" should "return a right response when a valid pr is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .listReviews( validRepoOwner, validRepoName, @@ -204,7 +204,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { it should "return error when an invalid repo name is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .listReviews( validRepoOwner, invalidRepoName, @@ -221,7 +221,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { "PullRequests >> GetReview" should "return a right response when a valid pr review is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .getReview( validRepoOwner, validRepoName, @@ -239,7 +239,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { it should "return error when an invalid repo name is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .getReview( validRepoOwner, invalidRepoName, @@ -257,7 +257,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { "PullRequests >> CreateReview" should "return a created review" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .createReview( validRepoOwner, validRepoName, @@ -281,7 +281,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { it should "return an error when invalid review data was passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .createReview( validRepoOwner, validRepoName, @@ -299,7 +299,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { "PullRequests >> Add/List/Remove Reviewers" should "return the proper reviewers" taggedAs Integration ignore { val addReviewersResponse = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .addReviewers( validRepoOwner, validRepoName, @@ -318,7 +318,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { val getReviewersResponse = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .listReviewers( validRepoOwner, validRepoName, @@ -339,7 +339,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { val removeReviewersResponse = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .removeReviewers( validRepoOwner, validRepoName, @@ -360,7 +360,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec { "PullRequests >> Update Branch" should "merge target branch's head into selected" taggedAs Integration ignore { val response = clientResource .use { client => - Github[IO](client, accessToken).pullRequests + GithubClient[IO](client, accessToken).pullRequests .updateBranch( validRepoOwner, validRepoName, diff --git a/github4s/shared/src/test/scala/github4s/integration/ReposSpec.scala b/github4s/shared/src/test/scala/github4s/integration/ReposSpec.scala index e01750c2..9790f67d 100644 --- a/github4s/shared/src/test/scala/github4s/integration/ReposSpec.scala +++ b/github4s/shared/src/test/scala/github4s/integration/ReposSpec.scala @@ -19,18 +19,19 @@ package github4s.integration import cats.data.NonEmptyList import cats.effect.{IO, Resource} import cats.implicits._ +import github4s.{GHResponse, GithubClient} import github4s.GHError.{NotFoundError, UnauthorizedError} +import github4s.algebras.GithubAPIs import github4s.domain.RepoUrlKeys.CommitComparisonResponse import github4s.domain._ import github4s.utils.{BaseIntegrationSpec, Integration} -import github4s.{GHResponse, Github} trait ReposSpec extends BaseIntegrationSpec { "Repos >> Get" should "return the expected name when a valid repo is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .get(validRepoOwner, validRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -42,7 +43,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "return error when an invalid repo name is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .get(validRepoOwner, invalidRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -54,7 +55,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> ListReleases" should "return the expected repos when a valid org is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listReleases(validRepoOwner, validRepoName, None, headers = headerUserAgent) } .unsafeRunSync() @@ -66,7 +67,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> getRelease" should "return the expected repos when a valid org is provided" taggedAs Integration in { val test = clientResource.use { client => - val gh: Github[IO] = Github[IO](client, accessToken) + val gh: GithubAPIs[IO] = GithubClient[IO](client, accessToken) for { @@ -97,7 +98,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> LatestRelease" should "return the expected repos when a valid org is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .latestRelease(validRepoOwner, validRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -109,7 +110,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> ListOrgRepos" should "return the expected repos when a valid org is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listOrgRepos(validRepoOwner, headers = headerUserAgent) } .unsafeRunSync() @@ -121,7 +122,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "return error when an invalid org is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listOrgRepos(invalidRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -133,7 +134,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> ListUserRepos" should "return the expected repos when a valid user is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listUserRepos(validUsername, headers = headerUserAgent) } .unsafeRunSync() @@ -145,7 +146,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "return error when an invalid user is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listUserRepos(invalidUsername, headers = headerUserAgent) } .unsafeRunSync() @@ -157,7 +158,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> GetContents" should "return the expected contents when valid path is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .getContents(validRepoOwner, validRepoName, validFilePath, headers = headerUserAgent) } .unsafeRunSync() @@ -170,7 +171,7 @@ trait ReposSpec extends BaseIntegrationSpec { val blobResponseFileContent = for { client <- clientResource - res = Github[IO](client, accessToken) + res = GithubClient[IO](client, accessToken) fileContentsIO = res.repos.getContents( owner = validRepoOwner, @@ -207,7 +208,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "return error when an invalid path is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .getContents(validRepoOwner, validRepoName, invalidFilePath, headers = headerUserAgent) } .unsafeRunSync() @@ -219,7 +220,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> ListCommits" should "return the expected list of commits for valid data" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listCommits(validRepoOwner, validRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -231,7 +232,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "return error for invalid repo name" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listCommits(invalidRepoName, validRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -243,7 +244,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> ListBranches" should "return the expected list of branches for valid data" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listBranches(validRepoOwner, validRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -255,7 +256,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "return error for invalid repo name" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listBranches(invalidRepoName, validRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -267,7 +268,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> ListContributors" should "return the expected list of contributors for valid data" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listContributors(validRepoOwner, validRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -279,7 +280,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "return error for invalid repo name" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listContributors(invalidRepoName, validRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -291,7 +292,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> ListCollaborators" should "return the expected list of collaborators for valid data" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listCollaborators(validRepoOwner, validRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -303,7 +304,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "return error for invalid repo name" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listCollaborators(invalidRepoName, validRepoName, headers = headerUserAgent) } .unsafeRunSync() @@ -315,7 +316,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> UserIsCollaborator" should "return true when the user is a collaborator" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .userIsCollaborator( validRepoOwner, validRepoName, @@ -332,7 +333,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "return false when the user is not a collaborator" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .userIsCollaborator( validRepoOwner, validRepoName, @@ -349,7 +350,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "return error when other errors occur" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, "invalid-access-token".some).repos + GithubClient[IO](client, "invalid-access-token".some).repos .userIsCollaborator( validRepoOwner, validRepoName, @@ -366,7 +367,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> GetRepoPermissionForUser" should "return user repo permission" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .getRepoPermissionForUser( validRepoOwner, validRepoName, @@ -383,7 +384,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "return error when invalid username is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .getRepoPermissionForUser( validRepoOwner, validRepoName, @@ -400,7 +401,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> GetStatus" should "return a combined status" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .getCombinedStatus( validRepoOwner, validRepoName, @@ -420,7 +421,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "return an error when an invalid ref is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .getCombinedStatus(validRepoOwner, validRepoName, invalidRef, headers = headerUserAgent) } .unsafeRunSync() @@ -436,7 +437,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> ListStatus" should "return a non empty list when a valid ref is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listStatuses(validRepoOwner, validRepoName, validCommitSha, headers = headerUserAgent) } .unsafeRunSync() @@ -448,7 +449,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "return an error when an invalid ref is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .listStatuses(validRepoOwner, validRepoName, invalidRef, headers = headerUserAgent) } .unsafeRunSync() @@ -461,7 +462,7 @@ trait ReposSpec extends BaseIntegrationSpec { val params = List(LanguageParam("scss"), TopicParam("jekyll")) val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .searchRepos("sbt-microsites", params, None, headerUserAgent) } .unsafeRunSync() @@ -479,7 +480,7 @@ trait ReposSpec extends BaseIntegrationSpec { "Repos >> Compare" should "compare against the base" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .compareCommits(validRepoOwner, validRepoName, validCommitSha, validBase) } .unsafeRunSync() @@ -497,7 +498,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "successfully return results when a valid repo is provided using / syntax" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .searchRepos(s"$validRepoOwner/$validRepoName", Nil) } .unsafeRunSync() @@ -514,7 +515,7 @@ trait ReposSpec extends BaseIntegrationSpec { it should "return an empty result for a non existent query string" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).repos + GithubClient[IO](client, accessToken).repos .searchRepos(nonExistentSearchQuery, validSearchParams, None, headerUserAgent) } .unsafeRunSync() diff --git a/github4s/shared/src/test/scala/github4s/integration/SearchSpec.scala b/github4s/shared/src/test/scala/github4s/integration/SearchSpec.scala index 07d33ca1..8ff07278 100644 --- a/github4s/shared/src/test/scala/github4s/integration/SearchSpec.scala +++ b/github4s/shared/src/test/scala/github4s/integration/SearchSpec.scala @@ -17,7 +17,7 @@ package github4s.integration import cats.effect.IO -import github4s.Github +import github4s.GithubClient import github4s.domain._ import github4s.utils.{BaseIntegrationSpec, Integration} @@ -28,7 +28,7 @@ trait SearchSpec extends BaseIntegrationSpec { it should "return zero match for a non existent search query" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).search + GithubClient[IO](client, accessToken).search .searchCode( query = nonExistentSearchQuery, searchParams = List( @@ -53,7 +53,7 @@ trait SearchSpec extends BaseIntegrationSpec { it should "return at least one match for a valid query" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).search + GithubClient[IO](client, accessToken).search .searchCode( query = "github", searchParams = List( @@ -78,7 +78,7 @@ trait SearchSpec extends BaseIntegrationSpec { it should "return at least one match for a valid query with text matches enabled" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).search + GithubClient[IO](client, accessToken).search .searchCode( query = "github", searchParams = List( diff --git a/github4s/shared/src/test/scala/github4s/integration/TeamsSpec.scala b/github4s/shared/src/test/scala/github4s/integration/TeamsSpec.scala index ea6ad139..dff22d58 100644 --- a/github4s/shared/src/test/scala/github4s/integration/TeamsSpec.scala +++ b/github4s/shared/src/test/scala/github4s/integration/TeamsSpec.scala @@ -18,7 +18,7 @@ package github4s.integration import cats.effect.IO import github4s.GHError.NotFoundError -import github4s.Github +import github4s.GithubClient import github4s.domain._ import github4s.utils.{BaseIntegrationSpec, Integration} @@ -26,7 +26,7 @@ trait TeamsSpec extends BaseIntegrationSpec { "Team >> ListTeams" should "return the expected teams when a valid org is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).teams + GithubClient[IO](client, accessToken).teams .listTeams(validRepoOwner, headers = headerUserAgent) } .unsafeRunSync() @@ -38,7 +38,7 @@ trait TeamsSpec extends BaseIntegrationSpec { it should "return error when an invalid org is passed" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).teams + GithubClient[IO](client, accessToken).teams .listTeams(invalidRepoName, headers = headerUserAgent) } .unsafeRunSync() diff --git a/github4s/shared/src/test/scala/github4s/integration/UsersSpec.scala b/github4s/shared/src/test/scala/github4s/integration/UsersSpec.scala index 397735df..b2f35a15 100644 --- a/github4s/shared/src/test/scala/github4s/integration/UsersSpec.scala +++ b/github4s/shared/src/test/scala/github4s/integration/UsersSpec.scala @@ -18,7 +18,7 @@ package github4s.integration import cats.effect.IO import github4s.GHError -import github4s.Github +import github4s.GithubClient import github4s.domain._ import github4s.utils.{BaseIntegrationSpec, Integration} @@ -27,7 +27,7 @@ trait UsersSpec extends BaseIntegrationSpec { "Users >> Get" should "return the expected login for a valid username" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).users + GithubClient[IO](client, accessToken).users .get(validUsername, headerUserAgent) } .unsafeRunSync() @@ -39,7 +39,7 @@ trait UsersSpec extends BaseIntegrationSpec { it should "return error on Left for invalid username" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).users + GithubClient[IO](client, accessToken).users .get(invalidUsername, headerUserAgent) } .unsafeRunSync() @@ -51,7 +51,7 @@ trait UsersSpec extends BaseIntegrationSpec { "Users >> GetAuth" should "return error on Left when no accessToken is provided" taggedAs Integration in { val response = clientResource - .use(client => Github[IO](client).users.getAuth(headerUserAgent)) + .use(client => GithubClient[IO](client).users.getAuth(headerUserAgent)) .unsafeRunSync() testIsLeft[GHError.UnauthorizedError, User](response) @@ -61,7 +61,7 @@ trait UsersSpec extends BaseIntegrationSpec { "Users >> GetUsers" should "return users for a valid since value" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).users + GithubClient[IO](client, accessToken).users .getUsers(validSinceInt, None, headerUserAgent) } .unsafeRunSync() @@ -73,7 +73,7 @@ trait UsersSpec extends BaseIntegrationSpec { it should "return an empty list when a invalid since value is provided" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).users + GithubClient[IO](client, accessToken).users .getUsers(invalidSinceInt, None, headerUserAgent) } .unsafeRunSync() @@ -85,7 +85,7 @@ trait UsersSpec extends BaseIntegrationSpec { "Users >> GetFollowing" should "return the expected following list for a valid username" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).users + GithubClient[IO](client, accessToken).users .getFollowing(validUsername, None, headerUserAgent) } .unsafeRunSync() @@ -97,7 +97,7 @@ trait UsersSpec extends BaseIntegrationSpec { it should "return error on Left for invalid username" taggedAs Integration in { val response = clientResource .use { client => - Github[IO](client, accessToken).users + GithubClient[IO](client, accessToken).users .getFollowing(invalidUsername, None, headerUserAgent) } .unsafeRunSync() diff --git a/github4s/shared/src/test/scala/github4s/utils/BaseSpec.scala b/github4s/shared/src/test/scala/github4s/utils/BaseSpec.scala index 167c87cb..dbd16f08 100644 --- a/github4s/shared/src/test/scala/github4s/utils/BaseSpec.scala +++ b/github4s/shared/src/test/scala/github4s/utils/BaseSpec.scala @@ -61,7 +61,7 @@ trait BaseSpec extends AsyncFlatSpec with Matchers with TestData with IOAssertio req.params == params => response.map(body => Response[IO](responseStatus).withEntity(body).putHeaders(respHeaders)) } - new HttpClient(httpClientMock, dummyConfig, new StaticAccessToken(sampleToken)) + HttpClient(httpClientMock, dummyConfig, new StaticAccessToken[IO](sampleToken)) } protected def httpClientMockGetWithoutResponse( @@ -76,7 +76,7 @@ trait BaseSpec extends AsyncFlatSpec with Matchers with TestData with IOAssertio req.headers == Headers(userAgent) => response.map(_ => Response[IO](responseStatus).putHeaders(respHeaders)) } - new HttpClient(httpClientMock, dummyConfig, new StaticAccessToken(sampleToken)) + HttpClient(httpClientMock, dummyConfig, new StaticAccessToken[IO](sampleToken)) } protected def httpClientMockPost[In: Decoder, Out: Encoder]( @@ -101,7 +101,7 @@ trait BaseSpec extends AsyncFlatSpec with Matchers with TestData with IOAssertio response.map(body => Response[IO](responseStatus).withEntity(body).putHeaders(respHeaders)) } - new HttpClient(httpClientMock, dummyConfig, new StaticAccessToken(sampleToken)) + HttpClient(httpClientMock, dummyConfig, new StaticAccessToken[IO](sampleToken)) } protected def httpClientMockPatch[In: Decoder, Out: Encoder]( @@ -135,7 +135,7 @@ trait BaseSpec extends AsyncFlatSpec with Matchers with TestData with IOAssertio req.headers == Headers(userAgent) => response.as(Response[IO](responseStatus).putHeaders(respHeaders)) } - new HttpClient(httpClientMock, dummyConfig, new StaticAccessToken(sampleToken)) + HttpClient(httpClientMock, dummyConfig, new StaticAccessToken[IO](sampleToken)) } protected def httpClientMockDeleteWithResponse[Out: Encoder]( @@ -150,7 +150,7 @@ trait BaseSpec extends AsyncFlatSpec with Matchers with TestData with IOAssertio req.headers == Headers(userAgent) => response.map(body => Response[IO](responseStatus).withEntity(body).putHeaders(respHeaders)) } - new HttpClient(httpClientMock, dummyConfig, new StaticAccessToken(sampleToken)) + HttpClient(httpClientMock, dummyConfig, new StaticAccessToken[IO](sampleToken)) } protected def httpClientMockDeleteWithBody[In: Decoder, Out: Encoder]( @@ -187,7 +187,7 @@ trait BaseSpec extends AsyncFlatSpec with Matchers with TestData with IOAssertio Response[IO](responseStatus).withEntity(body).putHeaders(respHeaders) ) } - new HttpClient(httpClientMock, dummyConfig, new StaticAccessToken(sampleToken)) + HttpClient(httpClientMock, dummyConfig, new StaticAccessToken[IO](sampleToken)) } private def httpMock(pf: PartialFunction[Request[IO], IO[Response[IO]]]) = diff --git a/project/plugins.sbt b/project/plugins.sbt index 5b30e905..8157ab0e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -16,3 +16,4 @@ addSbtPlugin("com.alejandrohdezma" % "sbt-remove-test-from-pom" % "0.1.0") addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0") +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.2")