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

csharp-functions.functions.mustache Maven / Gradle / Ivy

There is a newer version: 7.6.0
Show newest version
{{>partial_header}}

using System;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;

namespace {{packageName}}.{{apiPackage}}
{ {{#operations}}
    public partial {{#classModifier}}{{classModifier}} {{/classModifier}}class {{classname}}
    { {{#operation}}
        [FunctionName("{{classname}}_{{operationId}}")]
        public async Task _{{operationId}}([HttpTrigger(AuthorizationLevel.Anonymous, "{{httpMethod}}", Route = "{{{apiBasePath}}}{{{path}}}")]HttpRequest req, ExecutionContext context{{#allParams}}{{#isPathParam}}, {{>pathParam}}{{/isPathParam}}{{/allParams}})
        {
            var method = this.GetType().GetMethod("{{operationId}}");

            return method != null 
                ? (await ((Task)method.Invoke(this, new object[] { req, context{{#allParams}}{{#isPathParam}}, {{/isPathParam}}{{/allParams}} })).ConfigureAwait(false))
                : new StatusCodeResult((int)HttpStatusCode.NotImplemented);
        }
        {{/operation}}
    }
}
    {{/operations}}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy