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

aspnet-fastendpoints.endpoint.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
using {{packageName}}.Models;

namespace {{packageName}}.{{apiPackage}};

{{#operations}}

    {{#operation}}

/// 
/// {{summary}}
/// 
{{#isDeprecated}}[Obsolete]{{/isDeprecated}}
public class {{operationId}}Endpoint : {{>endpointType}}{{>endpointRequestType}}{{>endpointResponseType}}
{
    public override void Configure()
    {
        {{httpMethod}}("{{{basePathWithoutHost}}}{{{path}}}");
        {{#useApiVersioning}}Version({{apiVersion}});{{/useApiVersioning}}
        {{#useResponseCaching}}ResponseCache(60);{{/useResponseCaching}}
        {{^useAuthentication}}AllowAnonymous();{{/useAuthentication}}{{#useAuthentication}}//TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization{{/useAuthentication}}
        {{#allParams}}{{#isFile}}AllowFileUploads();{{/isFile}}{{/allParams}}
        Description(x =>
        {
            x.WithTags("{{#tags}}{{name}}{{/tags}}");{{#responses}}{{^is2xx}}
            FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblem{{#useProblemDetails}}Details{{/useProblemDetails}}{{^useProblemDetails}}FE{{/useProblemDetails}}(x, {{code}});{{/is2xx}}{{/responses}}
        });

        Summary(s => {
            s.Summary = "{{summary}}";
            {{#allParams}}
            s.RequestParam(r => r.{{#isBodyParam}}{{paramName}}{{/isBodyParam}}{{^isBodyParam}}{{nameInPascalCase}}{{/isBodyParam}}, "{{description}}");
            {{/allParams}}
            {{#responses}}
            s.Responses[{{code}}] = "{{message}}";
            {{/responses}}
        });
    }

    public override async Task HandleAsync({{#allParams}}{{#-first}}{{operationId}}Request req, {{/-first}}{{/allParams}}CancellationToken ct)
    {
        //Response = new()
        //{
            //...
        //};
        //return Task.CompletedTask;
    }
}

    {{/operation}}
{{/operations}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy