sealed trait HttpCodec[-AtomTypes, Value] extends AnyRef
A zio.http.codec.HttpCodec represents a codec for a part of an HTTP request. HttpCodec the HTTP protocol, these parts may be the unconsumed portion of the HTTP path (a route codec), the query string parameters (a query codec), the request headers (a header codec), or the request body (a body codec).
A HttpCodec is a purely declarative description of an input, and therefore, it can be used to generate documentation, clients, and client libraries.
HttpCodecs are a bit like invertible multi-channel parsers.
- Self Type
- HttpCodec[AtomTypes, Value]
- Alphabetic
- By Inheritance
- HttpCodec
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def &[Value2](that: QueryCodec[Value2])(implicit combiner: Combiner[Value, Value2], ev: <:<[Query, AtomTypes]): HttpCodec[Query, Out]
Append more query parameters to either a query codec, or to a pathQuery codec which is a combination of path and query
- final def ++[AtomTypes1 <: AtomTypes, Value2](that: HttpCodec[AtomTypes1, Value2])(implicit combiner: Combiner[Value, Value2]): HttpCodec[AtomTypes1, Out]
Returns a new codec that is the composition of this codec and the specified codec.
Returns a new codec that is the composition of this codec and the specified codec. For codecs that include route codecs, the routes will be decoded sequentially from left to right.
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ??(doc: Doc): HttpCodec[AtomTypes, Value]
Returns a new codec that is the same as this one, but has attached docs, which will render whenever docs are generated from the codec.
- final def ^?[Value2](that: QueryCodec[Value2])(implicit combiner: Combiner[Value, Value2], ev: <:<[HttpCodecType.Path, AtomTypes]): HttpCodec[PathQuery, Out]
To end the route codec and begin with query codec, and re-interprets as PathQueryCodec
To end the route codec and begin with query codec, and re-interprets as PathQueryCodec
GET /ab/c :? paramStr("") &
- final def alternatives: Chunk[(HttpCodec[AtomTypes, Value], Condition)]
Produces a flattened collection of alternatives.
Produces a flattened collection of alternatives. Once flattened, each codec inside the returned collection is guaranteed to contain no nested alternatives.
- def annotate(metadata: Metadata[Value]): HttpCodec[AtomTypes, Value]
Returns a new codec that is the same as this one, but has attached metadata, such as docs.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def asQuery(implicit ev: <:<[Query, AtomTypes]): QueryCodec[Value]
Reinterprets this codec as a query codec assuming evidence that this interpretation is sound.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- final def const[Value2](value2: => Value2)(implicit ev: <:<[Unit, Value]): HttpCodec[AtomTypes, Value2]
- final def const(canonical: => Value): HttpCodec[AtomTypes, Unit]
Transforms the type parameter to
Unitby specifying that all possible values that can be decoded from thisHttpCodecare in fact equivalent to the provided canonical value.Transforms the type parameter to
Unitby specifying that all possible values that can be decoded from thisHttpCodecare in fact equivalent to the provided canonical value.Note: You should NOT use this method on any codec which can decode semantically distinct values.
- final def decodeRequest(request: Request)(implicit trace: Trace): Task[Value]
Uses this codec to decode the Scala value from a request.
- final def decodeResponse(response: Response)(implicit trace: Trace): Task[Value]
Uses this codec to decode the Scala value from a response.
- def doc: Option[Doc]
- final def encodeRequest(value: Value): Request
Uses this codec to encode the Scala value into a request.
- final def encodeRequestPatch(value: Value): Patch
Uses this codec to encode the Scala value as a patch to a request.
- final def encodeResponse[Z](value: Value, outputTypes: Chunk[MediaTypeWithQFactor]): Response
Uses this codec to encode the Scala value as a response.
- final def encodeResponsePatch[Z](value: Value, outputTypes: Chunk[MediaTypeWithQFactor]): Patch
Uses this codec to encode the Scala value as a response patch.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def examples: Map[String, Value]
- def examples(example1: (String, Value), examples: (String, Value)*): HttpCodec[AtomTypes, Value]
- def examples(examples: Iterable[(String, Value)]): HttpCodec[AtomTypes, Value]
- def expect(expected: Value): HttpCodec[AtomTypes, Unit]
Returns a new codec that will expect the value to be equal to the specified value.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def named(named: Named[Value]): HttpCodec[AtomTypes, Value]
Returns a new codec that is the same as this one, but has attached a name.
Returns a new codec that is the same as this one, but has attached a name. This name is used for documentation generation.
- def named(name: String): HttpCodec[AtomTypes, Value]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def optional: HttpCodec[AtomTypes, Option[Value]]
Returns a new codec, where the value produced by this one is optional.
- final def orElseEither[AtomTypes1 <: AtomTypes, Value2](that: HttpCodec[AtomTypes1, Value2])(implicit alternator: Alternator[Value, Value2]): HttpCodec[AtomTypes1, Out]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def toLeft[R]: HttpCodec[AtomTypes, Either[Value, R]]
- final def toRight[L]: HttpCodec[AtomTypes, Either[L, Value]]
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def transform[Value2](f: (Value) => Value2)(g: (Value2) => Value): HttpCodec[AtomTypes, Value2]
Transforms the type parameter of this HttpCodec from
ValuetoValue2.Transforms the type parameter of this HttpCodec from
ValuetoValue2. Due to the fact that HttpCodec is invariant in its type parameter, the transformation requires not just a function fromValuetoValue2, but also, a function fromValue2toValue.One of these functions will be used in decoding, for example, when the endpoint is invoked on the server. The other of these functions will be used in encoding, for example, when a client calls the endpoint on the server.
- final def transformOrFail[Value2](f: (Value) => Either[String, Value2])(g: (Value2) => Either[String, Value]): HttpCodec[AtomTypes, Value2]
- final def transformOrFailLeft[Value2](f: (Value) => Either[String, Value2])(g: (Value2) => Value): HttpCodec[AtomTypes, Value2]
- final def transformOrFailRight[Value2](f: (Value) => Value2)(g: (Value2) => Either[String, Value]): HttpCodec[AtomTypes, Value2]
- 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()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def |[AtomTypes1 <: AtomTypes, Value2](that: HttpCodec[AtomTypes1, Value2])(implicit alternator: Alternator[Value, Value2]): HttpCodec[AtomTypes1, Out]