Using as an sttp clientΒΆ

Add the dependency:

"com.softwaremill.sttp.tapir" %% "tapir-sttp-client" % "0.12.11"

To make requests using an endpoint definition using the sttp client, import:

import sttp.tapir.client.sttp._

This adds the two extension methods to any Endpoint:

  • toSttpRequestUnsafe(Uri): given the base URI returns a function, which might throw an exception if decoding of the result fails

    I => Request[Either[E, O], Nothing]
  • toSttpRequest(Uri): given the base URI returns a function, which represents decoding errors as the DecodeResult class

    I => Request[DecodeResult[Either[E, O]], Nothing]

Note that these are a one-argument functions, where the single argument is the input of end endpoint. This might be a single type, a tuple, or a case class, depending on the endpoint description.

After providing the input parameters, a description of the request to be made is returned. This can be further customised and sent using any sttp backend.

See the runnable example for example usage.