Open
Description
Given a tapir endpoint we could easily generate functions that consumers could import and call.
val booksListingEndpoint: Endpoint[(BooksFromYear, Limit, AuthToken), String, List[Book], Nothing] = endpoint
.get
.in(("books" / path[String]("genre") / path[Int]("year")).mapTo(BooksFromYear))
.in(query[Int]("limit").description("Maximum number of books to retrieve"))
.in(header[String]("X-Auth-Token"))
.errorOut(stringBody)
.out(jsonBody[List[Book]])
def bookListing(booksFromYear, limit, authToken)(implicit host: String, port: Int) =
bookListingEndpoint.toSttpRequest(s"http://{host}:{port}")
Clients could call bookListing(...)
triggering a call against the endpoint.
As I understand this, this is an important piece of RPC that's currently missing from tapiro. gRPC for example generates libraries out of the protobuf's.
To my understanding this is very easy to implement and adds a crazy amount of value.