diff --git a/smithy4play/src/main/scala/de/innfactory/smithy4play/client/GenericAPIClient.scala b/smithy4play/src/main/scala/de/innfactory/smithy4play/client/GenericAPIClient.scala index ec8dfe25..783d76ce 100644 --- a/smithy4play/src/main/scala/de/innfactory/smithy4play/client/GenericAPIClient.scala +++ b/smithy4play/src/main/scala/de/innfactory/smithy4play/client/GenericAPIClient.scala @@ -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) diff --git a/smithy4playTest/test/TestControllerTest.scala b/smithy4playTest/test/TestControllerTest.scala index 1876ec17..bd857297 100644 --- a/smithy4playTest/test/TestControllerTest.scala +++ b/smithy4playTest/test/TestControllerTest.scala @@ -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()