Skip to content

Commit

Permalink
Merge pull request #213 from innFactory/fix/undoRemovingSecondApplyMe…
Browse files Browse the repository at this point in the history
…thod

fix: undo removing second apply method
  • Loading branch information
MoeQuadrat authored Oct 25, 2023
2 parents 49e88a9 + d79a849 commit c88fd37
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 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
additionalSuccessCodes: List[Int]
)(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]]],
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 c88fd37

Please sign in to comment.