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.
- Alphabetic
- By Inheritance
- Client
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Client(open: Kleisli[F, HttpRequest[F], DisposableResponse[F]], dispose: F[Unit])(implicit F: MonadError[F, Throwable])
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
- val dispose: F[Unit]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
expect[A](req: F[HttpRequest[F]])(implicit d: EntityDecoder[F, A]): F[A]
Same as
expect
but request is in an effect. -
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. -
def
fetch[A](request: F[HttpRequest[F]])(f: (HttpResponse[F]) ⇒ F[A]): F[A]
Same as
fetch
but request is in an effect. -
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.
-
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 yourd
needs to be very general. Throws any exception found ind
's returned value, DecodeResult. -
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val open: Kleisli[F, HttpRequest[F], DisposableResponse[F]]
- def shutdown(): F[Unit]
-
def
status(req: F[HttpRequest[F]]): F[Status]
Conveience.
-
def
status(req: HttpRequest[F]): F[Status]
Return only the status.
-
def
streaming[A](req: HttpRequest[F])(f: (HttpResponse[F]) ⇒ Stream[F, A]): Stream[F, A]
Stream the response contents.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
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
. -
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )