All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.kotlin-micronaut.client.api.mustache Maven / Gradle / Ivy

{{>common/licenseInfo}}
package {{package}}

import io.micronaut.http.annotation.*
import io.micronaut.core.annotation.*
import io.micronaut.http.client.annotation.Client
{{#configureAuth}}
import {{invokerPackage}}.auth.Authorization
{{/configureAuth}}
import io.micronaut.core.convert.format.Format
{{#wrapInHttpResponse}}
import io.micronaut.http.HttpResponse
{{/wrapInHttpResponse}}
{{#imports}}
import {{import}}
{{/imports}}
{{#generatedAnnotation}}
import {{javaxPackage}}.annotation.Generated
{{/generatedAnnotation}}
{{#useBeanValidation}}
import {{javaxPackage}}.validation.Valid
import {{javaxPackage}}.validation.constraints.*
{{/useBeanValidation}}
{{#generateSwagger2Annotations}}
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.Parameter
import io.swagger.v3.oas.annotations.Parameters
import io.swagger.v3.oas.annotations.media.ArraySchema
import io.swagger.v3.oas.annotations.media.Content
import io.swagger.v3.oas.annotations.media.Schema
import io.swagger.v3.oas.annotations.responses.ApiResponse
import io.swagger.v3.oas.annotations.enums.ParameterIn
import io.swagger.v3.oas.annotations.tags.Tag
import io.swagger.v3.oas.annotations.security.SecurityRequirement
{{/generateSwagger2Annotations}}

{{#formatOneEmptyLine}}
{{#additionalClientTypeAnnotations}}
{{{.}}}
{{/additionalClientTypeAnnotations}}
{{#generatedAnnotation}}
{{>common/generatedAnnotation}}
{{/generatedAnnotation}}
@Client({{#configureClientId}}{{#clientPath}}id = {{/clientPath}}{{/configureClientId}}"{{#configureClientId}}{{clientId}}{{/configureClientId}}{{^configureClientId}}\${{openbrace}}{{{applicationName}}}{{basePathSeparator}}base-path{{closebrace}}{{/configureClientId}}"{{#configureClientId}}{{#clientPath}}, path = "\${{openbrace}}{{#configureClientId}}{{{clientId}}}{{/configureClientId}}{{^configureClientId}}{{{applicationName}}}{{/configureClientId}}{{basePathSeparator}}base-path{{closebrace}}"{{/clientPath}}{{/configureClientId}})
interface {{classname}} {
{{#operations}}

    {{#operation}}
    {{#formatNoEmptyLines}}
{{>common/operationAnnotations}}{{!
}}    @{{#lambda.pascalcase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.pascalcase}}("{{{path}}}")
    {{^vendorExtensions.onlyDefaultProduceOrEmpty}}
    {{#produces}}{{#-first}}@Consumes({{/-first}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{#-last}}){{/-last}}{{/produces}}
    {{/vendorExtensions.onlyDefaultProduceOrEmpty}}
    {{^vendorExtensions.onlyDefaultConsumeOrEmpty}}
    {{#consumes}}{{#-first}}@Produces({{/-first}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{#-last}}){{/-last}}{{/consumes}}
    {{/vendorExtensions.onlyDefaultConsumeOrEmpty}}
    {{!auth methods}}
        {{#configureAuth}}
            {{#authMethods}}
    @Authorization(value = "{{{name}}}"{{!scopes}}{{#isOAuth}}, scopes = [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]{{/isOAuth}})
            {{/authMethods}}
        {{/configureAuth}}
    {{!the method definition}}
    {{#vendorExtensions.x-operation-extra-annotation}}
    {{{.}}}
    {{/vendorExtensions.x-operation-extra-annotation}}
    fun {{nickname}}({{#allParams}}
        {{#formatSingleLine}}{{>client/params/queryParams}}{{>client/params/pathParams}}{{>client/params/headerParams}}{{>client/params/bodyParams}}{{>client/params/formParams}}{{>client/params/cookieParams}}{{^-last}},{{/-last}}{{/formatSingleLine}}
    {{/allParams}}){{#returnType}}: {{{returnType}}}{{/returnType}}
    {{/formatNoEmptyLines}}
    {{/operation}}
{{/operations}}
}
{{/formatOneEmptyLine}}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy