kotlin-spring.apiDelegate.mustache Maven / Gradle / Ivy
package {{package}}
{{#imports}}import {{import}}
{{/imports}}
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.web.context.request.NativeWebRequest
import org.springframework.core.io.Resource
{{#reactive}}
import org.springframework.web.server.ServerWebExchange
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
{{/reactive}}
import java.util.Optional
{{#async}}
import java.util.concurrent.CompletableFuture
{{/async}}
{{#operations}}
/**
* A delegate to be called by the {@link {{classname}}Controller}}.
* Implement this interface with a {@link org.springframework.stereotype.Service} annotated class.
*/
{{>generatedAnnotation}}
interface {{classname}}Delegate {
fun getRequest(): Optional = Optional.empty()
{{#operation}}
/**
* @see {{classname}}#{{operationId}}
*/
fun {{operationId}}({{#allParams}}{{paramName}}: {{^isFile}}{{>optionalDataType}}{{/isFile}}{{#isFile}}Resource?{{/isFile}}{{^-last}},
{{/-last}}{{/allParams}}): {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {
{{>methodBody}}
}
{{/operation}}
}
{{/operations}}