I want to be able to have this:
POST /items controllers.Application.update()
POST /items/:itemType controllers.Application.update(itemType: String)
POST /items/:itemType/:id controllers.Application.update(itemType: String, id: Int)
but that doesn't compile due to the error of method update is defined twice
. Then I changed it and it didn't compiler either:
POST /items controllers.Application.update(itemType: Option[String] = None, id: Option[Int] = None)
POST /items/:itemType controllers.Application.update(itemType: String, id: Option[Int] = None)
POST /items/:itemType/:id controllers.Application.update(itemType: String, id: Int)
the errors are:
- the previouse one
- and
type mismatch; found: Option[String]; required: String
What do I do about that? I wouldn't like to do something like this:
POST /items controllers.Application.updateAll()
POST /items/:itemType controllers.Application.updateByType(itemType: String)
POST /items/:itemType/:id controllers.Application.updateByTypeAndId(itemType: String, id: Int)
and this doesn't look good either since I'd like to use Option
instead of the empty string:
POST /items controllers.Application.update(itemType: String = "", id: Int = "")
POST /items/:itemType/:id controllers.Application.update(itemType: String, id: Int = "")
POST /items/:itemType/:id controllers.Application.update(itemType: String, id: Int)