ZClient

zio.http.ZClient
See theZClient companion object
final case class ZClient[-Env, ReqEnv, -In, +Err, +Out](version: Version, url: URL, headers: Headers, sslConfig: Option[ClientSSLConfig], proxy: Option[Proxy], bodyEncoder: BodyEncoder[Env, Err, In], bodyDecoder: BodyDecoder[Env, Err, Out], driver: Driver[Env, ReqEnv, Err])

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait HeaderChecks[ZClient[Env, ReqEnv, In, Err, Out]]
trait HeaderModifier[ZClient[Env, ReqEnv, In, Err, Out]]
class Object
trait Matchable
class Any
Show all
Self type
ZClient[Env, ReqEnv, In, Err, Out]

Members list

Value members

Concrete methods

def @@[LowerEnv <: UpperEnv, UpperEnv <: Env, LowerIn <: UpperIn, UpperIn <: In, LowerErr >: Err, UpperErr >: LowerErr, LowerOut >: Out, UpperOut >: LowerOut](aspect: ZClientAspect[LowerEnv, UpperEnv, LowerIn, UpperIn, LowerErr, UpperErr, LowerOut, UpperOut]): ZClient[UpperEnv, ReqEnv, UpperIn, LowerErr, LowerOut]

Applies the specified client aspect, which can modify the execution of this client.

Applies the specified client aspect, which can modify the execution of this client.

Attributes

def addLeadingSlash: ZClient[Env, ReqEnv, In, Err, Out]
def addPath(path: String): ZClient[Env, ReqEnv, In, Err, Out]
def addPath(path: Path): ZClient[Env, ReqEnv, In, Err, Out]
def addQueryParam(key: String, value: String): ZClient[Env, ReqEnv, In, Err, Out]
def addQueryParams(params: QueryParams): ZClient[Env, ReqEnv, In, Err, Out]
def addTrailingSlash: ZClient[Env, ReqEnv, In, Err, Out]
def addUrl(url: URL): ZClient[Env, ReqEnv, In, Err, Out]
def apply(request: Request)(implicit ev: Body <:< In, trace: Trace): ZIO[Env & ReqEnv, Err, Out]
def batched(request: Request)(implicit trace: Trace, ev1: ReqEnv =:= Scope, ev3: Body <:< In): ZIO[Env, Err, Out]
def batched(implicit ev1: ReqEnv =:= Scope): ZClient[Env, Any, In, Err, Out]

Converts this streaming client into a batched client.

Converts this streaming client into a batched client.

'''NOTE''': This client will materialize the responses into memory. If the response is streaming, it will await for it to be fully collected before resuming.

Attributes

def contramap[In2](f: In2 => In)(implicit trace: Trace): ZClient[Env, ReqEnv, In2, Err, Out]
def contramapZIO[Err1 >: Err, In2](f: In2 => IO[Err1, In]): ZClient[Env, ReqEnv, In2, Err1, Out]
def delete(suffix: String)(implicit ev: Body <:< In, trace: Trace): ZIO[Env & ReqEnv, Err, Out]
def dieOn(f: Err => Boolean)(implicit ev1: IsSubtypeOfError[Err, Throwable], ev2: CanFail[Err], trace: Trace): ZClient[Env, ReqEnv, In, Err, Out]
def get(suffix: String)(implicit ev: Body <:< In, trace: Trace): ZIO[Env & ReqEnv, Err, Out]
def head(suffix: String)(implicit ev: Body <:< In, trace: Trace): ZIO[Env & ReqEnv, Err, Out]
def host(host: String): ZClient[Env, ReqEnv, In, Err, Out]
def map[Out2](f: Out => Out2)(implicit trace: Trace): ZClient[Env, ReqEnv, In, Err, Out2]
def mapError[Err2](f: Err => Err2): ZClient[Env, ReqEnv, In, Err2, Out]
def mapZIO[Env1 <: Env, Err1 >: Err, Out2](f: Out => ZIO[Env1, Err1, Out2]): ZClient[Env1, ReqEnv, In, Err1, Out2]
def patch(suffix: String)(implicit ev: Body <:< In, trace: Trace): ZIO[Env & ReqEnv, Err, Out]
def path(path: String): ZClient[Env, ReqEnv, In, Err, Out]
def path(path: Path): ZClient[Env, ReqEnv, In, Err, Out]
def port(port: Int): ZClient[Env, ReqEnv, In, Err, Out]
def post(suffix: String)(body: In)(implicit trace: Trace): ZIO[Env & ReqEnv, Err, Out]
def proxy(proxy: Proxy): ZClient[Env, ReqEnv, In, Err, Out]
def put(suffix: String)(body: In)(implicit trace: Trace): ZIO[Env & ReqEnv, Err, Out]
def refineOrDie[Err2](pf: PartialFunction[Err, Err2])(implicit ev1: IsSubtypeOfError[Err, Throwable], ev2: CanFail[Err], trace: Trace): ZClient[Env, ReqEnv, In, Err2, Out]
def request(request: Request)(implicit ev: Body <:< In, trace: Trace): ZIO[Env & ReqEnv, Err, Out]
def request(method: Method, suffix: String)(body: In)(implicit trace: Trace): ZIO[Env & ReqEnv, Err, Out]
def retry[Env1 <: Env](policy: Schedule[Env1, Err, Any]): ZClient[Env1, ReqEnv, In, Err, Out]
def scheme(scheme: Scheme): ZClient[Env, ReqEnv, In, Err, Out]
def socket[Env1 <: Env](app: WebSocketApp[Env1])(implicit trace: Trace, ev: ReqEnv =:= Scope): ZIO[Env1 & ReqEnv, Err, Out]
def ssl(ssl: ClientSSLConfig): ZClient[Env, ReqEnv, In, Err, Out]
def stream[R, E0 >: Err, A](request: Request)(f: Out => ZStream[R, E0, A])(implicit trace: Trace, ev1: Body <:< In, ev2: ReqEnv =:= Scope): ZStream[R & Env, E0, A]

Executes an HTTP request and transforms the response into a ZStream using the provided function

Executes an HTTP request and transforms the response into a ZStream using the provided function

Attributes

def transform[Env2, S2, In2, Err2, Out2](bodyEncoder: BodyEncoder[Env2, Err2, In2], bodyDecoder: BodyDecoder[Env2, Err2, Out2], driver: Driver[Env2, S2, Err2]): ZClient[Env2, S2, In2, Err2, Out2]
override def updateHeaders(update: Headers => Headers)(implicit trace: Trace): ZClient[Env, ReqEnv, In, Err, Out]

Updates the current Headers with new one, using the provided update function passed.

Updates the current Headers with new one, using the provided update function passed.

Attributes

Definition Classes
def updatePath(f: Path => Path): ZClient[Env, ReqEnv, In, Err, Out]
def updateURL(f: URL => URL): ZClient[Env, ReqEnv, In, Err, Out]
def uri(uri: URI): ZClient[Env, ReqEnv, In, Err, Out]
def url(url: URL): ZClient[Env, ReqEnv, In, Err, Out]

Deprecated methods

def disableStreaming(implicit ev1: ReqEnv =:= Scope): ZClient[Env, Any, In, Err, Out]

Attributes

Deprecated
[Since version 3.0.0]

Inherited methods

final def addHeader[T](value: T)(implicit schema: Schema[T]): ZClient[Env, ReqEnv, In, Err, Out]

Adds headers based on the given value. The type of the value must have a schema and be a case class and all fields will be added as headers. So fields must be of primitive types (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these. The header names are the field names.

Adds headers based on the given value. The type of the value must have a schema and be a case class and all fields will be added as headers. So fields must be of primitive types (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these. The header names are the field names.

Attributes

Inherited from:
HeaderModifier
final def addHeader[T](name: String, value: T)(implicit schema: Schema[T]): ZClient[Env, ReqEnv, In, Err, Out]

Adds a header / headers with the specified name and based on the given value. The value type must have a schema and can be a primitive type (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these.

Adds a header / headers with the specified name and based on the given value. The value type must have a schema and can be a primitive type (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these.

Attributes

Inherited from:
HeaderModifier
protected def addHeader(name: CharSequence, value: CharSequence): ZClient[Env, ReqEnv, In, Err, Out]

Attributes

Inherited from:
HeaderModifier
final def addHeader(header: Header): ZClient[Env, ReqEnv, In, Err, Out]

Attributes

Inherited from:
HeaderModifier
final def addHeaders(headers: Iterable[(CharSequence, CharSequence)]): ZClient[Env, ReqEnv, In, Err, Out]

Attributes

Inherited from:
HeaderModifier
final def addHeaders(headers: Headers): ZClient[Env, ReqEnv, In, Err, Out]

Attributes

Inherited from:
HeaderModifier
final def hasContentType(mediaType: MediaType): Boolean

Attributes

Inherited from:
HeaderChecks
final def hasContentType(value: CharSequence): Boolean

Attributes

Inherited from:
HeaderChecks

Attributes

Inherited from:
HeaderChecks

Attributes

Inherited from:
HeaderChecks
final def hasHeader(header: Header): Boolean

Attributes

Inherited from:
HeaderChecks
final def hasHeader(headerType: HeaderType): Boolean

Attributes

Inherited from:
HeaderChecks
final def hasHeader(name: CharSequence): Boolean

Attributes

Inherited from:
HeaderChecks

Attributes

Inherited from:
HeaderChecks

Attributes

Inherited from:
HeaderChecks

Attributes

Inherited from:
HeaderChecks

Attributes

Inherited from:
HeaderChecks
final def header[T](implicit schema: Schema[T]): Either[HeaderError, T]

Retrieves headers as a value of the specified type. The type must have a schema and be a case class and all fields must be headers. So fields must be of primitive types (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these. Headers are selected by field names.

Retrieves headers as a value of the specified type. The type must have a schema and be a case class and all fields must be headers. So fields must be of primitive types (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these. Headers are selected by field names.

Attributes

Inherited from:
HeaderGetters
final def header[T](name: String)(implicit schema: Schema[T]): Either[HeaderError, T]

Retrieves the header with the specified name as a value of the specified type. The type must have a schema and can be a primitive type (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these.

Retrieves the header with the specified name as a value of the specified type. The type must have a schema and can be a primitive type (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these.

Attributes

Inherited from:
HeaderGetters
final def header(headerType: HeaderType): Option[headerType.HeaderValue]

Gets a header or returns None if the header was not present or it could not be parsed

Gets a header or returns None if the header was not present or it could not be parsed

Attributes

Inherited from:
HeaderGetters
final def headerOrElse[T](default: => T)(implicit schema: Schema[T]): T

Retrieves headers as a value of the specified type T, or returns a default value if the headers are not present or could not be parsed. The type T must have a schema and be a case class and all fields must be headers. So fields must be of primitive types (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these. Headers are selected by field names.

Retrieves headers as a value of the specified type T, or returns a default value if the headers are not present or could not be parsed. The type T must have a schema and be a case class and all fields must be headers. So fields must be of primitive types (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these. Headers are selected by field names.

Attributes

Inherited from:
HeaderGetters
final def headerOrElse[T](name: String, default: => T)(implicit schema: Schema[T]): T

Retrieves the header with the specified name as a value of the specified type T, or returns a default value if the header is not present or could not be parsed. The type T must have a schema and can be a primitive type (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these.

Retrieves the header with the specified name as a value of the specified type T, or returns a default value if the header is not present or could not be parsed. The type T must have a schema and can be a primitive type (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these.

Attributes

Inherited from:
HeaderGetters
final def headerOrFail(headerType: HeaderType): Option[Either[String, headerType.HeaderValue]]

Gets a header. If the header is not present, returns None. If the header could not be parsed it returns the parsing error

Gets a header. If the header is not present, returns None. If the header could not be parsed it returns the parsing error

Attributes

Inherited from:
HeaderGetters
final def headerZIO[T](name: String)(implicit schema: Schema[T]): IO[HeaderError, T]

Attributes

Inherited from:
HeaderGetters
final def headers(headerType: HeaderType): Chunk[headerType.HeaderValue]

Attributes

Inherited from:
HeaderGetters

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product
final def rawHeader(headerType: HeaderType): Option[String]

Gets the raw unparsed header value

Gets the raw unparsed header value

Attributes

Inherited from:
HeaderGetters
final def rawHeader(name: CharSequence): Option[String]

Gets the raw unparsed header value

Gets the raw unparsed header value

Attributes

Inherited from:
HeaderGetters
def rawHeaders(name: CharSequence): Chunk[String]

Attributes

Inherited from:
HeaderGetters
final def removeHeader(name: String): ZClient[Env, ReqEnv, In, Err, Out]

Attributes

Inherited from:
HeaderModifier
final def removeHeader(headerType: HeaderType): ZClient[Env, ReqEnv, In, Err, Out]

Attributes

Inherited from:
HeaderModifier
final def removeHeaders(headers: Set[String]): ZClient[Env, ReqEnv, In, Err, Out]

Attributes

Inherited from:
HeaderModifier
final def setHeaders(headers: Headers): ZClient[Env, ReqEnv, In, Err, Out]

Attributes

Inherited from:
HeaderModifier