PathCodec

zio.http.codec.PathCodec
See thePathCodec companion object
sealed trait PathCodec[A]

A codec for paths, which consists of segments, where each segment may be a literal, an integer, a long, a string, a UUID, or the trailing path.

import zio.http.endpoint.PathCodec._

val pathCodec = empty / "users" / int("user-id") / "posts" / string("post-id")

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Annotated[A]
Self type

Members list

Value members

Concrete methods

final def ++[B](that: PathCodec[B])(implicit combiner: Combiner[A, B]): PathCodec[Out]
final def /[B](that: PathCodec[B])(implicit combiner: Combiner[A, B]): PathCodec[Out]
final def /[Env](routes: Routes[Env, Response])(implicit ev: PathCodec[A] <:< PathCodec[Unit]): Routes[Env, Response]
def ??(doc: Doc): PathCodec[A]

Attaches documentation to the path codec, which may be used when generating developer docs for a route.

Attaches documentation to the path codec, which may be used when generating developer docs for a route.

Attributes

final def annotate(metaData: MetaData[A]): PathCodec[A]
final def asType[B](implicit ev: A =:= B): PathCodec[B]
final def decode(path: Path): Either[String, A]

Decodes a method and path into a value of type A.

Decodes a method and path into a value of type A.

Attributes

def doc: Doc

Returns the documentation for the path codec, if any.

Returns the documentation for the path codec, if any.

Attributes

final def encode(value: A): Either[String, Path]

Encodes a value of type A into the method and path that this route pattern would successfully match against.

Encodes a value of type A into the method and path that this route pattern would successfully match against.

Attributes

final def example(name: String, example: A): PathCodec[A]
final def examples(examples: (String, A)*): PathCodec[A]
final def format(value: A): Either[String, Path]

Formats a value of type A into a path. This is useful for embedding paths into HTML that is rendered by the server.

Formats a value of type A into a path. This is useful for embedding paths into HTML that is rendered by the server.

Attributes

final def matches(path: Path): Boolean

Determines if this pattern matches the specified method and path. Rather than use this method, you should just try to decode it directly, for higher performance, otherwise the same information will be decoded twice.

Determines if this pattern matches the specified method and path. Rather than use this method, you should just try to decode it directly, for higher performance, otherwise the same information will be decoded twice.

Attributes

def render: String

Renders the path codec as a string.

Renders the path codec as a string.

Attributes

Returns the segments of the path codec.

Returns the segments of the path codec.

Attributes

override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
final def transform[A2](f: A => A2)(g: A2 => A): PathCodec[A2]
final def transformOrFail[A2](f: A => Either[String, A2])(g: A2 => Either[String, A]): PathCodec[A2]
final def transformOrFailLeft[A2](f: A => Either[String, A2])(g: A2 => A): PathCodec[A2]
final def transformOrFailRight[A2](f: A => A2)(g: A2 => Either[String, A]): PathCodec[A2]