All Downloads are FREE. Search and download functionalities are using the official Maven repository.

algoliasearch.config.AgentSegment.scala Maven / Gradle / Ivy

There is a newer version: 2.9.2
Show newest version
package algoliasearch.config

/** Represents a segment of algolia agent header.
  * @param value
  *   segment string value
  * @param version
  *   optional version
  */
case class AgentSegment(value: String, version: Option[String] = None) {
  override def toString: String = version match {
    case Some(ver) => s"$value ($ver)"
    case None      => s"$value"
  }
}

object AgentSegment {

  /** Creates a new AgentSegment instance with the given value and version. */
  def apply(value: String, version: String): AgentSegment = new AgentSegment(value, Some(version))

  /** Creates a new AgentSegment instance with the given value. */
  def apply(value: String): AgentSegment = new AgentSegment(value)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy