Skip to content

Instantly share code, notes, and snippets.

@calippo
Last active January 14, 2020 09:15
Show Gist options
  • Save calippo/15cd4f0204b0e8cc3e947c87315b44aa to your computer and use it in GitHub Desktop.
Save calippo/15cd4f0204b0e8cc3e947c87315b44aa to your computer and use it in GitHub Desktop.
tapiro endpoints
object ControllerEndpoints {
def create(statusCodes: String => Int = _ => 422)(
implicit stringJsonCodec: JsonCodec[String],
listJsonCodec: JsonCodec[Result],
) = new DockerMonitorControllerFEndpoints {
override val getSomething
: Endpoint[String, GenericError, Result, Nothing] =
endpoint.get
.in("getContainers")
.in(query[String]("arg"))
.errorOut(jsonBody[GenericError])
.out(jsonBody[Result])
override val doSomething: Endpoint[
Content,
GenericError,
Result,
Nothing
] = endpoint.get
.in("doSomething")
.in(jsonBody[Content]("arg"))
.errorOut(jsonBody[GenericError])
.out(jsonBody[Result])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment