slakah / uritemplate4s

Scala implementation of URI Template (RFC 6570)

Website GitHub

uritemplate4s

CircleCI Join the chat at https://gitter.im/slakah/uritemplate4s Latest version

Scala implementation of URI Template (RFC 6570).

Getting Started

uritemplate4s is currently available for Scala 2.13, 2.12 and Scala.js.

Add the following to your build.sbt:

libraryDependencies += "com.gubbns" %% "uritemplate4s" % "0.5.4"

Usage

import uritemplate4s._

val template = uritemplate"https://{host}/search{?q}{&params*}"
template.expand(
    "host" -> "search-engine.com",
    "q" -> "Esio Trot",
    "params" -> Map("lang" -> "en", "type" -> "book")
  ).value
// res0: String = https://search-engine.com/search?q=Esio%20Trot&lang=en&type=book

Further documentation is available here.