package client

Provides extension methods for using a http4s org.http4s.client.Client

import cats.effect.IO
import org.http4s._
import org.http4s.client._
import org.http4s.Http4s._
import org.http4s.Status._
import org.http4s.Method._
import org.http4s.EntityDecoder

def client: Client[IO] = ???

val r: IO[String] = client(GET(uri(""))).as[String]
val r2: DecodeResult[String] = client(GET(uri(""))).attemptAs[String] // implicitly resolve the decoder
val req1 = r.unsafeRunSync
val req2 = r.unsafeRunSync // Each invocation fetches a new Result based on the behavior of the Client
Linear Supertypes
  1. Alphabetic
  2. By Inheritance
  1. client
  2. ClientTypes
  3. Http4sClientDsl
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
  1. Public
  2. All

Type Members

  1. final case class Client [F[_]](open: Service[F, Request[F], DisposableResponse[F]], shutdown: F[Unit])(implicit F: MonadError[F, Throwable]) extends Product with Serializable

    A Client submits Requests to a server and processes the Response.

    A Client submits Requests to a server and processes the Response.


    a service to asynchronously return a DisposableResponse from a Request. This is a low-level operation intended for client implementations and middleware.


    an effect to shut down this Shutdown this client, closing any open connections and freeing resources

  2. trait Connection [F[_]] extends AnyRef
  3. type ConnectionBuilder[F[_], A <: Connection[F]] = (RequestKey) ⇒ F[A]
    Definition Classes
  4. trait ConnectionManager [F[_], A <: Connection[F]] extends AnyRef

    Type that is responsible for the client lifecycle

    Type that is responsible for the client lifecycle

    The ConnectionManager is a general wrapper around a ConnectionBuilder that can pool resources in order to conserve resources such as socket connections, CPU time, SSL handshakes, etc. Because it can contain significant resources it must have a mechanism to free resources associated with it.

  5. final case class DisposableResponse [F[_]](response: Response[F], dispose: F[Unit]) extends Product with Serializable

    Contains a Response that needs to be disposed of to free the underlying HTTP connection.

  6. type Middleware[F[_]] = (Client[F]) ⇒ Client[F]
    Definition Classes
  7. final case class RequestKey (scheme: Scheme, authority: Authority) extends Product with Serializable

    Represents a key for requests that can conceivably share a Connection.

  8. final case class UnexpectedStatus (status: Status) extends RuntimeException with NoStackTrace with Product with Serializable

Value Members

  1. implicit def http4sHeadersDecoder[T](implicit F: Applicative[IO], decoder: EntityDecoder[IO, T]): EntityDecoder[IO, (Headers, T)]
    Definition Classes
  2. implicit def http4sNoBodyOps(method: Method with NoBody): NoBodyOps[IO]
    Definition Classes
  3. implicit def http4sWithBodySyntax(method: Method with PermitsBody): WithBodyOps[IO]
    Definition Classes
  4. object Client extends Serializable
  5. object ConnectionManager
  6. object RequestKey extends Serializable

Inherited from ClientTypes

Inherited from Http4sClientDsl[IO]

Inherited from AnyRef

Inherited from Any