/** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.0.1 * User agent: apibuilder app.apibuilder.io/bml/test-locale/0.0.1/http4s_0_17 */ package org.bml.test.locale.v0.models { /** * An enumeration of allowed locales */ sealed trait Locale extends _root_.scala.Product with _root_.scala.Serializable object Locale { /** * English language United States dialect */ case object EnUS extends Locale { override def toString = "en-US" } /** * English language Great Britain dialect */ case object EnGB extends Locale { override def toString = "en-GB" } /** * UNDEFINED captures values that are sent either in error or * that were added by the server after this library was * generated. We want to make it easy and obvious to users of * this library to handle this case gracefully. * * We use all CAPS for the variable name to avoid collisions * with the camel cased values above. */ final case class UNDEFINED(override val toString: String) extends Locale /** * all returns a list of all the valid, known values. We use * lower case to avoid collisions with the camel cased values * above. */ val all: scala.List[Locale] = scala.List(EnUS, EnGB) private val byName: Map[String, Locale] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): Locale = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[Locale] = byName.get(value.toLowerCase) } }