final case class Client[F[_]](open: Kleisli[F, HttpRequest[F], DisposableResponse[F]], dispose: F[Unit])(implicit F: MonadError[F, Throwable]) extends Product with Serializable

A thin layer over a HTTP service that adds implcit convenience for finding response decoders and handling unsuccessful (non 200 range) responses. Based on http4s design. The methods in this class do not deal with exceptions/errors but does, when expecting a successful result, translate a non-200 saus to an UnexpectedStatus exception and hence uses MonadError.raiseError to signal the error.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Client
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Client(open: Kleisli[F, HttpRequest[F], DisposableResponse[F]], dispose: F[Unit])(implicit F: MonadError[F, Throwable])

Value Members

  1. val dispose: F[Unit]
  2. def expect[A](req: F[HttpRequest[F]])(implicit d: EntityDecoder[F, A]): F[A]

    Same as expect but request is in an effect.

  3. def expect[A](req: HttpRequest[F])(implicit d: EntityDecoder[F, A]): F[A]

    Fetch response, process response with d but only if successful status.

    Fetch response, process response with d but only if successful status. Throw UnexpectedStatus otherwise since you cannot use the decoder, which assumes a successful response, if the response is not valid.

  4. def fetch[A](request: F[HttpRequest[F]])(f: (HttpResponse[F]) ⇒ F[A]): F[A]

    Same as fetch but request is in an effect.

  5. def fetch[A](request: HttpRequest[F])(f: (HttpResponse[F]) ⇒ F[A]): F[A]

    Fetch response, process regardless of status.

    Fetch response, process regardless of status. Very low-level.

  6. def fetchAs[A](req: HttpRequest[F])(implicit d: EntityDecoder[F, A]): F[A]

    Fetch response, process response with d regardless of status.

    Fetch response, process response with d regardless of status. Hence your d needs to be very general. Throws any exception found in d's returned value, DecodeResult.

  7. val open: Kleisli[F, HttpRequest[F], DisposableResponse[F]]
  8. def shutdown(): F[Unit]
  9. def status(req: F[HttpRequest[F]]): F[Status]

    Conveience.

  10. def status(req: HttpRequest[F]): F[Status]

    Return only the status.

  11. def streaming[A](req: HttpRequest[F])(f: (HttpResponse[F]) ⇒ Stream[F, A]): Stream[F, A]

    Stream the response contents.

  12. def toService[A](f: (HttpResponse[F]) ⇒ F[A]): Kleisli[F, HttpRequest[F], A]

    Creates a funcion that acts like "client.fetch" but without need to call .fetch.