Skip to content

Instantly share code, notes, and snippets.

@s1monw1
Created October 7, 2022 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s1monw1/496972a4a37e227333ed14c981b1e819 to your computer and use it in GitHub Desktop.
Save s1monw1/496972a4a37e227333ed14c981b1e819 to your computer and use it in GitHub Desktop.
// lens focusing on the path variable name
val nameLens = Path.string().of("name")
// lens focusing on a required query parameter city
val requiredQuery = Query.required("city")
// lens focusing on a required and non-empty string city
val nonEmptyQuery = Query.nonEmptyString().required("city")
// lens focusing on an optional header Content-Length with type int
val optionalHeader = Header.int().optional("Content-Length")
// lens focusing on text body
val responseBody = Body.string(ContentType.TEXT_PLAIN).toLens()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment