Skip to content

Commit

Permalink
fix: undo removing second apply method
Browse files Browse the repository at this point in the history
  • Loading branch information
MoeQuadrat committed Oct 25, 2023
1 parent 7651ddb commit 5f1d0f3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,31 @@ object GenericAPIClient {

def withClientAndHeaders(
client: RequestClient,
additionalHeaders: Option[Map[String, Seq[String]]]
)(implicit ec: ExecutionContext): Alg[Kind1[ClientResponse]#toKind5] = apply(service, client, additionalHeaders)
additionalHeaders: Option[Map[String, Seq[String]]],
additionalSuccessCodes: List[Int] = List.empty
)(implicit ec: ExecutionContext): Alg[Kind1[ClientResponse]#toKind5] =
apply(service, additionalHeaders, additionalSuccessCodes, client)

def withClient(
client: RequestClient
)(implicit ec: ExecutionContext): Alg[Kind1[ClientResponse]#toKind5] = apply(service, client)

def toGenericClient(
client: RequestClient,
additionalHeaders: Option[Map[String, Seq[String]]] = None,
additionalSuccessCodes: List[Int] = List.empty
)(implicit ec: ExecutionContext): Alg[Kind1[ClientResponse]#toKind5] =
apply(service, client, additionalHeaders, additionalSuccessCodes)
)(implicit ec: ExecutionContext): Alg[Kind1[RunnableClientRequest]#toKind5] =
apply(service, client, additionalSuccessCodes)

}

def apply[Alg[_[_, _, _, _, _]]](
serviceI: Service[Alg],
client: RequestClient,
additionalHeaders: Option[Map[String, Seq[String]]] = None,
additionalSuccessCodes: List[Int] = List.empty
)(implicit ec: ExecutionContext): Alg[Kind1[RunnableClientRequest]#toKind5] =
new GenericAPIClient(serviceI, client, additionalSuccessCodes).transformer()

def apply[Alg[_[_, _, _, _, _]]](
serviceI: Service[Alg],
additionalHeaders: Option[Map[String, Seq[String]]] = None,
additionalSuccessCodes: List[Int],
client: RequestClient
)(implicit ec: ExecutionContext): Alg[Kind1[ClientResponse]#toKind5] =
new GenericAPIClient(serviceI, client, additionalSuccessCodes).transformer(additionalHeaders)

Expand Down
2 changes: 1 addition & 1 deletion smithy4playTest/test/TestControllerTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class TestControllerTest extends PlaySpec with BaseOneAppPerSuite with FakeAppli
}
}

val genericClient = TestControllerServiceGen.toGenericClient(FakeRequestClient, None, List(269))
val genericClient = TestControllerServiceGen.withClientAndHeaders(FakeRequestClient, None, List(269))

override def fakeApplication(): Application =
new GuiceApplicationBuilder().build()
Expand Down

0 comments on commit 5f1d0f3

Please sign in to comment.