PathCodec

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

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
Source
PathCodec.scala
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[combiner.Out]

Attributes

Source
PathCodec.scala
final def /[B](that: PathCodec[B])(implicit combiner: Combiner[A, B]): PathCodec[combiner.Out]

Attributes

Source
PathCodec.scala
final def /[Env, Err](routes: Routes[Env, Err])(implicit ev: PathCodec[A] <:< PathCodec[Unit]): Routes[Env, Err]

Attributes

Source
PathCodec.scala
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

Source
PathCodec.scala
final def alternatives: List[PathCodec[A]]

Attributes

Source
PathCodec.scala
final def annotate(metaData: MetaData[A]): PathCodec[A]

Attributes

Source
PathCodec.scala
final def asType[B](implicit ev: A =:= B): PathCodec[B]

Attributes

Source
PathCodec.scala
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

Source
PathCodec.scala
def doc: Doc

Returns the documentation for the path codec, if any.

Returns the documentation for the path codec, if any.

Attributes

Source
PathCodec.scala
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

Source
PathCodec.scala
final def example(name: String, example: A): PathCodec[A]

Attributes

Source
PathCodec.scala
final def examples(examples: (String, A)*): PathCodec[A]

Attributes

Source
PathCodec.scala
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

Source
PathCodec.scala
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

Source
PathCodec.scala
def render: String

Renders the path codec as a string.

Renders the path codec as a string.

Attributes

Source
PathCodec.scala
def render(prefix: String, suffix: String): String

Renders the path codec as a string. Surrounds the path variables with the specified prefix and suffix.

Renders the path codec as a string. Surrounds the path variables with the specified prefix and suffix.

Attributes

Source
PathCodec.scala

Returns the segments of the path codec.

Returns the segments of the path codec.

Attributes

Source
PathCodec.scala
def toPath(implicit ev: A =:= Unit): Path

Converts this PathCodec[Unit] to a Path using the encode method. Useful for round-trip conversion.

Converts this PathCodec[Unit] to a Path using the encode method. Useful for round-trip conversion.

Value parameters

ev

evidence that A =:= Unit

Attributes

Returns

the encoded Path, or Path.root if encoding fails

Source
PathCodec.scala
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
Source
PathCodec.scala
final def transform[A2](f: A => A2)(g: A2 => A): PathCodec[A2]

Attributes

Source
PathCodec.scala
final def transformOrFail[A2](f: A => Either[String, A2])(g: A2 => Either[String, A]): PathCodec[A2]

Attributes

Source
PathCodec.scala
final def transformOrFailLeft[A2](f: A => Either[String, A2])(g: A2 => A): PathCodec[A2]

Attributes

Source
PathCodec.scala
final def transformOrFailRight[A2](f: A => A2)(g: A2 => Either[String, A]): PathCodec[A2]

Attributes

Source
PathCodec.scala

Inherited methods

def parseInt(s: CharSequence, beginIndex: Int, endIndex: Int, radix: Int): Int
def parseLong(s: CharSequence, beginIndex: Int, endIndex: Int, radix: Int): Long