sealed trait Http[-R, +E, -A, +B] extends (A) ⇒ ZIO[R, Option[E], B]
A functional domain to model Http apps using ZIO and that can work over any kind of request and response types.
- Self Type
- Http[R, E, A, B]
- Alphabetic
- By Inheritance
- Http
- Function1
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
*>[R1 <: R, E1 >: E, A1 <: A, C1](other: Http[R1, E1, A1, C1]): Http[R1, E1, A1, C1]
Alias for zipRight
-
final
def
++[R1 <: R, E1 >: E, A1 <: A, B1 >: B](other: Http[R1, E1, A1, B1]): Http[R1, E1, A1, B1]
Combines two Http into one.
-
final
def
<<<[R1 <: R, E1 >: E, A1 <: A, X](other: Http[R1, E1, X, A1]): Http[R1, E1, X, B]
Composes one Http app with another.
-
final
def
<>[R1 <: R, E1, A1 <: A, B1 >: B](other: Http[R1, E1, A1, B1]): Http[R1, E1, A1, B1]
Runs self but if it fails, runs other, ignoring the result from self.
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
>>=[R1 <: R, E1 >: E, A1 <: A, C1](f: (B) ⇒ Http[R1, E1, A1, C1]): Http[R1, E1, A1, C1]
Alias for flatmap
-
final
def
>>>[R1 <: R, E1 >: E, B1 >: B, C](other: Http[R1, E1, B1, C]): Http[R1, E1, A, C]
Pipes the output of one app into the other
-
final
def
@@[R1 <: R, E1 >: E, A1 <: A, B1 >: B, A2, B2](mid: Middleware[R1, E1, A1, B1, A2, B2]): Http[R1, E1, A2, B2]
Attaches the provided middleware to the Http app
-
final
def
\/[R1 <: R, E1 >: E, C, D](other: Http[R1, E1, C, D]): Middleware[R1, E1, B, C, A, D]
Combines two Http instances into a middleware that works a codec for incoming and outgoing messages.
-
final
def
absolve[E1 >: E, C](implicit ev: <:<[B, Either[E1, C]]): Http[R, E1, A, C]
Returns an http app that submerges the error case of an
Eitherinto theHttp.Returns an http app that submerges the error case of an
Eitherinto theHttp. The inverse operation ofHttp.either. -
final
def
andThen[R1 <: R, E1 >: E, B1 >: B, C](other: Http[R1, E1, B1, C]): Http[R1, E1, A, C]
Named alias for
>>> -
def
andThen[A](g: (ZIO[R, Option[E], B]) ⇒ A): (A) ⇒ A
- Definition Classes
- Function1
- Annotations
- @unspecialized()
-
final
def
apply(a: A): ZIO[R, Option[E], B]
Consumes the input and executes the Http.
Consumes the input and executes the Http.
- Definition Classes
- Http → Function1
-
final
def
as[C](c: C): Http[R, E, A, C]
Makes the app resolve with a constant value
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
final
def
body(implicit eb: <:<[B, Response], ee: <:<[E, Throwable]): Http[R, Throwable, A, Chunk[Byte]]
Extracts body
-
final
def
bodyAsString(implicit eb: <:<[B, Response], ee: <:<[E, Throwable]): Http[R, Throwable, A, String]
Extracts body as a string
-
final
def
catchAll[R1 <: R, E1, A1 <: A, B1 >: B](f: (E) ⇒ Http[R1, E1, A1, B1])(implicit ev: CanFail[E]): Http[R1, E1, A1, B1]
Catches all the exceptions that the http app can fail with
-
final
def
catchAllDefect[R2 <: R, E2 >: E, A2 <: A, B2 >: B](h: (Throwable) ⇒ Http[R2, E2, A2, B2]): Http[R2, E2, A2, B2]
Recovers from all defects with provided function.
Recovers from all defects with provided function.
WARNING: There is no sensible way to recover from defects. This method should be used only at the boundary between
Httpand an external system, to transmit information on a defect for diagnostic or explanatory purposes. -
final
def
catchNonFatalOrDie[R2 <: R, E2 >: E, A2 <: A, B2 >: B](h: (E) ⇒ Http[R2, E2, A2, B2])(implicit ev1: CanFail[E], ev2: <:<[E, Throwable]): Http[R2, E2, A2, B2]
Recovers from all NonFatal Throwables.
-
final
def
catchSome[R1 <: R, E1 >: E, A1 <: A, B1 >: B](f: PartialFunction[E, Http[R1, E1, A1, B1]])(implicit ev: CanFail[E]): Http[R1, E1, A1, B1]
Recovers from some or all of the error cases.
-
final
def
catchSomeDefect[R1 <: R, E1 >: E, A1 <: A, B1 >: B](pf: PartialFunction[Throwable, Http[R1, E1, A1, B1]]): Http[R1, E1, A1, B1]
Recovers from some or all of the defects with provided partial function.
Recovers from some or all of the defects with provided partial function.
WARNING: There is no sensible way to recover from defects. This method should be used only at the boundary between
Httpand an external system, to transmit information on a defect for diagnostic or explanatory purposes. -
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
final
def
codecMiddleware[R1 <: R, E1 >: E, C, D](other: Http[R1, E1, C, D]): Middleware[R1, E1, B, C, A, D]
Combines two Http instances into a middleware that works a codec for incoming and outgoing messages.
-
final
def
collect[B1 >: B, C](pf: PartialFunction[B1, C]): Http[R, E, A, C]
Collects some of the results of the http and converts it to another type.
-
final
def
collectZIO[R1 <: R, E1 >: E, A1 <: A, B1 >: B, C](pf: PartialFunction[B1, ZIO[R1, E1, C]]): Http[R1, E1, A1, C]
Collects some of the results of the http and effectfully converts it to another type.
-
final
def
compose[R1 <: R, E1 >: E, A1 <: A, C1](other: Http[R1, E1, C1, A1]): Http[R1, E1, C1, B]
Named alias for
<<< -
def
compose[A](g: (A) ⇒ A): (A) ⇒ ZIO[R, Option[E], B]
- Definition Classes
- Function1
- Annotations
- @unspecialized()
-
final
def
contentLength(implicit eb: <:<[B, Response]): Http[R, E, A, Option[Long]]
Extracts content-length from the response if available
-
final
def
contentType(implicit eb: <:<[B, Response]): Http[R, E, A, Option[CharSequence]]
Extracts the value of ContentType header
-
final
def
contraCollect[X](pf: PartialFunction[X, A]): Http[R, E, X, B]
Like
collectbut is applied on the incoming typeA. -
final
def
contraFlatMap[X]: PartialContraFlatMap[R, E, A, B, X]
Transforms the input of the http before passing it on to the current Http
-
final
def
contramap[X](xa: (X) ⇒ A): Http[R, E, X, B]
Transforms the input of the http before passing it on to the current Http
-
final
def
contramapZIO[R1 <: R, E1 >: E, X](xa: (X) ⇒ ZIO[R1, E1, A]): Http[R1, E1, X, B]
Transforms the input of the http before giving it effectfully
-
final
def
defaultWith[R1 <: R, E1 >: E, A1 <: A, B1 >: B](other: Http[R1, E1, A1, B1]): Http[R1, E1, A1, B1]
Named alias for
++ -
final
def
delay(duration: zio.Duration): Http[R, E, A, B]
Delays production of output B for the specified duration of time
-
final
def
delayAfter(duration: zio.Duration): Http[R, E, A, B]
Delays production of output B for the specified duration of time
-
final
def
delayBefore(duration: zio.Duration): Http[R, E, A, B]
Delays consumption of input A for the specified duration of time
-
final
def
either(implicit ev: CanFail[E]): Http[R, Nothing, A, Either[E, B]]
Returns an http app whose failure and success have been lifted into an
Either.Returns an http app whose failure and success have been lifted into an
Either. The resulting app cannot fail, because the failure case has been exposed as part of theEithersuccess case. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
flatMap[R1 <: R, E1 >: E, A1 <: A, C1](f: (B) ⇒ Http[R1, E1, A1, C1]): Http[R1, E1, A1, C1]
Creates a new Http app from another
-
final
def
flatten[R1 <: R, E1 >: E, A1 <: A, B1](implicit ev: <:<[B, Http[R1, E1, A1, B1]]): Http[R1, E1, A1, B1]
Flattens an Http app of an Http app
-
final
def
foldHttp[R1 <: R, A1 <: A, E1, B1](failure: (E) ⇒ Http[R1, E1, A1, B1], defect: (Throwable) ⇒ Http[R1, E1, A1, B1], success: (B) ⇒ Http[R1, E1, A1, B1], empty: Http[R1, E1, A1, B1]): Http[R1, E1, A1, B1]
Folds over the http app by taking in two functions one for success and one for failure respectively.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
headerValue(name: CharSequence)(implicit eb: <:<[B, Response]): Http[R, E, A, Option[CharSequence]]
Extracts the value of the provided header name.
-
final
def
headers(implicit eb: <:<[B, Response]): Http[R, E, A, Headers]
Extracts the
Headersfrom the typeBif possible -
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
map[C](bc: (B) ⇒ C): Http[R, E, A, C]
Transforms the output of the http app
-
final
def
mapError[E1](ee: (E) ⇒ E1): Http[R, E1, A, B]
Transforms the failure of the http app
-
final
def
mapZIO[R1 <: R, E1 >: E, C](bFc: (B) ⇒ ZIO[R1, E1, C]): Http[R1, E1, A, C]
Transforms the output of the http effectfully
-
final
def
merge[E1 >: E, B1 >: B](implicit ev: =:=[E1, B1]): Http[R, Nothing, A, B1]
Returns a new Http where the error channel has been merged into the success channel to their common combined type.
-
final
def
middleware[R1 <: R, E1 >: E, A1 <: A, B1 >: B, A2, B2](mid: Middleware[R1, E1, A1, B1, A2, B2]): Http[R1, E1, A2, B2]
Named alias for @@
-
final
def
narrow[A1](implicit a: <:<[A1, A]): Http[R, E, A1, B]
Narrows the type of the input
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
option(implicit ev: CanFail[E]): Http[R, Nothing, A, Option[B]]
Executes this app, skipping the error but returning optionally the success.
-
final
def
optional[E1](implicit ev: <:<[E, Option[E1]]): Http[R, E1, A, Option[B]]
Converts an option on errors into an option on values.
-
final
def
orDie(implicit ev1: <:<[E, Throwable], ev2: CanFail[E]): Http[R, Nothing, A, B]
Translates app failure into death of the app, making all failures unchecked and not a part of the type of the app.
-
final
def
orDieWith(f: (E) ⇒ Throwable)(implicit ev: CanFail[E]): Http[R, Nothing, A, B]
Keeps none of the errors, and terminates the http app with them, using the specified function to convert the
Einto aThrowable. -
final
def
orElse[R1 <: R, E1, A1 <: A, B1 >: B](other: Http[R1, E1, A1, B1]): Http[R1, E1, A1, B1]
Named alias for
<> -
final
def
provideEnvironment(r: ZEnvironment[R]): Http[Any, E, A, B]
Provides the environment to Http.
-
final
def
provideLayer[E1 >: E, R0](layer: ZLayer[R0, E1, R]): Http[R0, E1, A, B]
Provides layer to Http.
-
final
def
provideSomeEnvironment[R1](r: (ZEnvironment[R1]) ⇒ ZEnvironment[R]): Http[R1, E, A, B]
Provides some of the environment to Http.
-
final
def
provideSomeLayer[R0, R1, E1 >: E](layer: ZLayer[R0, E1, R1])(implicit ev: <:<[R0 with R1, R], tagged: Tag[R1]): Http[R0, E1, A, B]
Provides some of the environment to Http leaving the remainder
R0. -
final
def
race[R1 <: R, E1 >: E, A1 <: A, B1 >: B](other: Http[R1, E1, A1, B1]): Http[R1, E1, A1, B1]
Performs a race between two apps
-
final
def
refineOrDie[E1](pf: PartialFunction[E, E1])(implicit ev1: <:<[E, Throwable], ev2: CanFail[E]): Http[R, E1, A, B]
Keeps some of the errors, and terminates the http app with the rest.
-
final
def
refineOrDieWith[E1](pf: PartialFunction[E, E1])(f: (E) ⇒ Throwable)(implicit ev: CanFail[E]): Http[R, E1, A, B]
Keeps some of the errors, and terminates the http app with the rest, using the specified function to convert the
Einto aThrowable. -
final
def
status(implicit ev: <:<[B, Response]): Http[R, E, A, Status]
Extracts
Statusfrom the typeBis possible. -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
tap[R1 <: R, E1 >: E, A1 <: A](f: (B) ⇒ Http[R1, E1, Any, Any]): Http[R1, E1, A, B]
Returns an Http that peeks at the success of this Http.
-
final
def
tapAll[R1 <: R, E1 >: E](failure: (E) ⇒ Http[R1, E1, Any, Any], defect: (Throwable) ⇒ Http[R1, E1, Any, Any], success: (B) ⇒ Http[R1, E1, Any, Any], empty: Http[R1, E1, Any, Any]): Http[R1, E1, A, B]
Returns an Http that peeks at the success, failed, defective or empty value of this Http.
-
final
def
tapAllZIO[R1 <: R, E1 >: E](failure: (E) ⇒ ZIO[R1, E1, Any], defect: (Throwable) ⇒ ZIO[R1, E1, Any], success: (B) ⇒ ZIO[R1, E1, Any], empty: ZIO[R1, E1, Any]): Http[R1, E1, A, B]
Returns an Http that effectfully peeks at the success, failed, defective or empty value of this Http.
-
final
def
tapError[R1 <: R, E1 >: E](f: (E) ⇒ Http[R1, E1, Any, Any]): Http[R1, E1, A, B]
Returns an Http that peeks at the failure of this Http.
-
final
def
tapErrorZIO[R1 <: R, E1 >: E](f: (E) ⇒ ZIO[R1, E1, Any]): Http[R1, E1, A, B]
Returns an Http that effectfully peeks at the failure of this Http.
-
final
def
tapZIO[R1 <: R, E1 >: E](f: (B) ⇒ ZIO[R1, E1, Any]): Http[R1, E1, A, B]
Returns an Http that effectfully peeks at the success of this Http.
-
final
def
toSocketApp(implicit a: <:<[WebSocketChannelEvent, A], e: <:<[E, Throwable]): SocketApp[R]
Converts an Http into a websocket application
-
def
toString(): String
- Definition Classes
- Function1 → AnyRef → Any
-
final
def
unrefine[E1 >: E](pf: PartialFunction[Throwable, E1]): Http[R, E1, A, B]
Takes some defects and converts them into failures.
-
final
def
unrefineTo[E1 >: E](implicit arg0: ClassTag[E1]): Http[R, E1, A, B]
Takes some defects and converts them into failures.
-
final
def
unrefineWith[E1](pf: PartialFunction[Throwable, E1])(f: (E) ⇒ E1): Http[R, E1, A, B]
Takes some defects and converts them into failures, using the specified function to convert the
Einto anE1. -
final
def
unwrap[R1 <: R, E1 >: E, C](implicit ev: <:<[B, ZIO[R1, E1, C]]): Http[R1, E1, A, C]
Unwraps an Http that returns a ZIO of Http
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
when[A2 <: A](f: (A2) ⇒ Boolean): Http[R, E, A2, B]
Applies Http based only if the condition function evaluates to true
-
final
def
widen[E1, B1](implicit e: <:<[E, E1], b: <:<[B, B1]): Http[R, E1, A, B1]
Widens the type of the output
-
final
def
zipRight[R1 <: R, E1 >: E, A1 <: A, C1](other: Http[R1, E1, A1, C1]): Http[R1, E1, A1, C1]
Combines the two apps and returns the result of the one on the right