The way i did that right now is by having an intermediate trait with
protected def authenticatedRequest[UrlP, BodyP, Out]( method: Method, url: Url[UrlP], entity: RequestEntity[BodyP] )(implicit tuplerUB: Tupler.Aux[UrlP, BodyP, Out] ): Request[ApiEndpoints.AuthenticatedMessage[Out]]
and that works fine for requests. but one of the issues of response logging is that the process of encoding a response is not effectful
implementedByEffectworks to accomodate this
authenticatedEndpoint[A, B]: Endpoint[A, Either[AuthError], B],
endpointWithError[A, B]: Endpoint[A, Either[ClientError, B]]and
versionedEndpoint[A, B](version: ApiVersion): Endpoint[A, B]. Because the Endpoint type is abstract, I cannot find a way to compose these like (pseudo-code):
Endpoints(request: A, response: B, url: String,...)and then "rewrite" these in the interpreters to the corresponding instances (e.g.
Routefor Akka HTTP server or
A => Future[B]for client). But I have a feeling this would involve a pretty fundamental change to the algebras so I'm certainly open to other ideas.
def uriin the Akka HTTP interpreter? It doesn't seem to be used in any code, except via-via in a single line in one test. Could it be possible that the function is not needed? https://github.com/endpoints4s/endpoints4s/blob/master/akka-http/server/src/main/scala/endpoints4s/akkahttp/server/Endpoints.scala#L50
ChunkedEntitiesis not supported by
endpoints.xhr. I don’t remember why I didn’t include it, to be honest. I also remember that I created #287 when I was working on it, so maybe I faced some limitations when trying to implement
ChunkedEntitiesin the xhr interpreter.
grpc-webshould eventually support this, but there is no clear timeline for client-side streaming support, and
protobufmodel does seem unnecessarily limiting for traditional web API, compared to JSON. It would be an interesting endeavor to implement endpoints4s/endpoints4s#287, maybe I could give it a shot.