handlebars.kotlin-server.libraries.ktor.Paths.kt.mustache Maven / Gradle / Ivy
{{>licenseInfo}}
package {{packageName}}
import io.ktor.application.ApplicationCall
import io.ktor.http.HttpMethod
import io.ktor.locations.handle
import io.ktor.locations.location
import io.ktor.locations.Location
import io.ktor.util.pipeline.PipelineContext
import io.ktor.routing.Route
import io.ktor.routing.method
{{#hasModel}}import {{modelPackage}}.*;{{/hasModel}}
{{#imports}}
import {{import}}
{{/imports}}
// NOTE: [email protected] is missing extension for Route.delete. This includes it.
inline fun Route.delete(noinline body: suspend PipelineContext.(T) -> Unit): Route {
return location(T::class) {
method(HttpMethod.Delete) {
handle(body)
}
}
}
{{#apiInfo}}
object Paths {
{{#apis}}
{{#operations}}
{{#operation}}
{{#contents}}
{{#@first}}
/**
* {{summary}}
* {{#unescapedNotes}}{{.}}{{/unescapedNotes}}
{{#parameters}}* @param {{paramName}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/parameters}}*/
@Location("{{path}}") class {{operationId}}({{#parameters}}val {{paramName}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/parameters}})
{{/@first}}
{{/contents}}
{{/operation}}
{{/operations}}
{{/apis}}
}
{{/apiInfo}}