StatusCodes
andMediaTypes
are in distinctobject
s, thus, have to be imported explicitly- improved Ammonite integration
- internal: separated decoded and raw requests with
RawApiRequest
andApiRequest
- fixed
implicitNotFound
message forApiRequest
- implemented #31 #35 #36
- server endpoints have to define a response code:
derive[IO](Api) { input =>
success(/*...*/)
^
}
-
internal cleanups and refactorings
-
extended example project and added ScalaJS client
-
centralized http-support specs
-
added akka-http support on server and client-side
-
added scalaj-http support on the client-side
-
added ScalaJS compilation support for shared and client code
-
implemented basic ScalaJS client
-
added body encoding types and made them mandatory (several hundred Mediatypes supported)
:= :> ReqBody[Json, User] :> Get[Json, User] _______________^__________________^
-
RawHeaders
was removed -
fixed headers were added; a fixed header is a statically known key-value pair, therefore, no input is required
// dsl := :> Header("Access-Control-Allow-Origin", "*") :> Get[Json, User] // function api(Get[Json, User], headers = Headers add("Access-Control-Allow-Origin", "*"))
-
changes to the server API:
NoReqBodyExecutor
andReqBodyExecutor
now expect aMethodType
:
new NoReqBodyExecutor[El, KIn, VIn, M, F, FOut] { ____________________________________^ new ReqBodyExecutor[El, KIn, VIn, Bd, M, ROut, POut, F, FOut] { ______________________________________^
- fixed header only sent by the server
:= :> Server.Send("Access-Control-Allow-Origin", "*") :> Get[Json, User] api(Get[Json, User], Headers.serverSend("Access-Control-Allow-Origin", "*"))
- extract headers which have keys that match a
String
:= :> Server.Match[String]("Control") :> Get[Json, User] api(Get[Json, User], Headers.serverMatch[String]("Control"))
-
changes to the client API:
- new encoding types add
Content-Type
andAccept
headers - fixed header only sent by the client
:= :> Client.Header("Access-Control-Allow-Origin", "*") :> Get[Json, User] api(Get[Json, User], Headers.client("Access-Control-Allow-Origin", "*"))
- send dynamic header ignore it on the server-side
:= :> Client.Header[String]("Foo") :> Get[Json, User] api(Get[Json, User], Headers.client[String]("Foo"))
- new encoding types add
- changes to the client API:
val ApiList =
(:= :> Get[Foo]) :|:
(:= :> RequestBody[Foo] :> Put[Foo])
// `:|:` removed for API compositions
val (get, put) = deriveAll(ApiList)
- changes to the server API:
// same for endpoint compositions
val e = deriveAll[IO](ApiList).from(get, put)
- changes to the client API:
val Api = := :> Get[Foo]
val ApiList =
(:= :> Get[Foo]) :|:
(:= :> RequestBody[Foo] :> Put[Foo])
// not `compile`, but
val foo = derive(Api)
val (foo2 :|: bar :|: =:) = deriveAll(ApiList)
...
// explicitly pass ClientManager
foo().run[IO](cm)
_______________^
- changes to the server API
// not `link.to`, but
val endpoint = derive[IO](Api).from(...)
val endpoints = deriveAll[IO](ApiList).from(...)
- major changes were applied to the internal code to reach a stable state (see this PR)