trait Client[F[_]] extends AnyRef
A Client submits Requests to a server and processes the Response.
- Source
- Client.scala
- Alphabetic
- By Inheritance
- Client
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def expect[A](s: String)(implicit d: EntityDecoder[F, A]): F[A]
Submits a GET request to the URI specified by the String and decodes the response on success.
Submits a GET request to the URI specified by the String and decodes the response on success. On failure, the status code is returned. The underlying HTTP connection is closed at the completion of the decoding.
- abstract def expect[A](uri: Uri)(implicit d: EntityDecoder[F, A]): F[A]
Submits a GET request to the specified URI and decodes the response on success.
Submits a GET request to the specified URI and decodes the response on success. On failure, the status code is returned. The underlying HTTP connection is closed at the completion of the decoding.
- abstract def expect[A](req: F[Request[F]])(implicit d: EntityDecoder[F, A]): F[A]
- abstract def expect[A](req: Request[F])(implicit d: EntityDecoder[F, A]): F[A]
Submits a request and decodes the response on success.
Submits a request and decodes the response on success. On failure, the status code is returned. The underlying HTTP connection is closed at the completion of the decoding.
- abstract def expectOption[A](req: Request[F])(implicit d: EntityDecoder[F, A]): F[Option[A]]
- abstract def expectOptionOr[A](req: Request[F])(onError: (Response[F]) => F[Throwable])(implicit d: EntityDecoder[F, A]): F[Option[A]]
- abstract def expectOr[A](s: String)(onError: (Response[F]) => F[Throwable])(implicit d: EntityDecoder[F, A]): F[A]
- abstract def expectOr[A](uri: Uri)(onError: (Response[F]) => F[Throwable])(implicit d: EntityDecoder[F, A]): F[A]
- abstract def expectOr[A](req: F[Request[F]])(onError: (Response[F]) => F[Throwable])(implicit d: EntityDecoder[F, A]): F[A]
- abstract def expectOr[A](req: Request[F])(onError: (Response[F]) => F[Throwable])(implicit d: EntityDecoder[F, A]): F[A]
- abstract def fetchAs[A](req: F[Request[F]])(implicit d: EntityDecoder[F, A]): F[A]
Submits a request and decodes the response, regardless of the status code.
Submits a request and decodes the response, regardless of the status code. The underlying HTTP connection is closed at the completion of the decoding.
- abstract def fetchAs[A](req: Request[F])(implicit d: EntityDecoder[F, A]): F[A]
Submits a request and decodes the response, regardless of the status code.
Submits a request and decodes the response, regardless of the status code. The underlying HTTP connection is closed at the completion of the decoding.
- abstract def get[A](s: String)(f: (Response[F]) => F[A]): F[A]
Submits a request and decodes the response on success.
Submits a request and decodes the response on success. On failure, the status code is returned. The underlying HTTP connection is closed at the completion of the decoding.
- abstract def get[A](uri: Uri)(f: (Response[F]) => F[A]): F[A]
Submits a GET request, and provides a callback to process the response.
Submits a GET request, and provides a callback to process the response.
- uri
The URI to GET
- f
A callback for the response to a GET on uri. The underlying HTTP connection is disposed when the returned task completes. Attempts to read the response body afterward will result in an error.
- returns
The result of applying f to the response to req
- abstract def run(req: Request[F]): Resource[F, Response[F]]
- abstract def status(req: F[Request[F]]): F[Status]
Submits a request and returns the response status
- abstract def status(req: Request[F]): F[Status]
Submits a request and returns the response status
- abstract def statusFromString(s: String): F[Status]
Submits a GET request to the URI and returns the response status
- abstract def statusFromUri(uri: Uri): F[Status]
Submits a GET request to the URI and returns the response status
- abstract def stream(req: Request[F]): Stream[F, Response[F]]
Run the request as a stream.
Run the request as a stream. The response lifecycle is equivalent to the returned Stream's.
- abstract def successful(req: F[Request[F]]): F[Boolean]
Submits a request and returns true if and only if the response status is successful
- abstract def successful(req: Request[F]): F[Boolean]
Submits a request and returns true if and only if the response status is successful
- abstract def toHttpApp: HttpApp[F]
Returns this client as an HttpApp.
Returns this client as an HttpApp. It is the responsibility of callers of this service to run the response body to dispose of the underlying HTTP connection.
This is intended for use in proxy servers.
run,fetchAs, toKleisli, and streaming are safer alternatives, as their signatures guarantee disposal of the HTTP connection. - abstract def toKleisli[A](f: (Response[F]) => F[A]): Kleisli[F, Request[F], A]
Returns this client as a cats.data.Kleisli.
Returns this client as a cats.data.Kleisli. All connections created by this service are disposed on completion of callback task f.
This method effectively reverses the arguments to
runfollowed byuse, and is preferred when an HTTP client is composed into a larger Kleisli function, or when a common response callback is used by many call sites. - abstract def fetch[A](req: F[Request[F]])(f: (Response[F]) => F[A]): F[A]
Submits a request, and provides a callback to process the response.
Submits a request, and provides a callback to process the response.
- req
An effect of the request to submit
- f
A callback for the response to req. The underlying HTTP connection is disposed when the returned task completes. Attempts to read the response body afterward will result in an error.
- returns
The result of applying f to the response to req
- Annotations
- @deprecated
- Deprecated
(Since version 0.21.5) Use req.flatMap(run(_).use(f))
- abstract def fetch[A](req: Request[F])(f: (Response[F]) => F[A]): F[A]
Submits a request, and provides a callback to process the response.
Submits a request, and provides a callback to process the response.
- req
The request to submit
- f
A callback for the response to req. The underlying HTTP connection is disposed when the returned task completes. Attempts to read the response body afterward will result in an error.
- returns
The result of applying f to the response to req
- Annotations
- @deprecated
- Deprecated
(Since version 0.21.5) Use run(req).use(f)
- abstract def getAs[A](s: String)(implicit d: EntityDecoder[F, A]): F[A]
- Annotations
- @deprecated
- Deprecated
(Since version 0.14) Use expect
- abstract def getAs[A](uri: Uri)(implicit d: EntityDecoder[F, A]): F[A]
Submits a GET request and decodes the response.
Submits a GET request and decodes the response. The underlying HTTP connection is closed at the completion of the decoding.
- Annotations
- @deprecated
- Deprecated
(Since version 0.14) Use expect
- abstract def prepAs[T](req: F[Request[F]])(implicit d: EntityDecoder[F, T]): F[T]
- Annotations
- @deprecated
- Deprecated
(Since version 0.14) Use expect
- abstract def prepAs[A](req: Request[F])(implicit d: EntityDecoder[F, A]): F[A]
- Annotations
- @deprecated
- Deprecated
(Since version 0.14) Use expect
- abstract def streaming[A](req: F[Request[F]])(f: (Response[F]) => Stream[F, A]): Stream[F, A]
- Annotations
- @deprecated
- Deprecated
(Since version 0.19.0-M4) Use
Stream.eval(req).flatMap(client.stream).flatMap(f)
- abstract def streaming[A](req: Request[F])(f: (Response[F]) => Stream[F, A]): Stream[F, A]
- Annotations
- @deprecated
- Deprecated
(Since version 0.19.0-M4) Use
client.stream(req).flatMap(f)
- abstract def toHttpService: HttpService[F]
Returns this client as an HttpService.
Returns this client as an HttpService. It is the responsibility of callers of this service to run the response body to dispose of the underlying HTTP connection.
This is intended for use in proxy servers.
run,fetchAs, toKleisli and streaming are safer alternatives, as their signatures guarantee disposal of the HTTP connection.- Annotations
- @deprecated
- Deprecated
(Since version 0.19) Use toHttpApp. Call
.mapF(OptionT.liftF)if OptionT is really desired.
- abstract def toService[A](f: (Response[F]) => F[A]): Service[F, Request[F], A]
- Annotations
- @deprecated
- Deprecated
(Since version 0.18) Use toKleisli
Concrete 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[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- 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()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def translate[G[_]](fk: ~>[F, G])(gK: ~>[G, F])(implicit arg0: Sync[G], b: BracketThrow[F]): Client[G]
Translates the effect type of this client from F to G
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()