Tizzani.AzureFunctionsWorkerHttpExtensions 1.0.0-preview1

This is a prerelease version of Tizzani.AzureFunctionsWorkerHttpExtensions.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Tizzani.AzureFunctionsWorkerHttpExtensions --version 1.0.0-preview1                
NuGet\Install-Package Tizzani.AzureFunctionsWorkerHttpExtensions -Version 1.0.0-preview1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tizzani.AzureFunctionsWorkerHttpExtensions" Version="1.0.0-preview1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tizzani.AzureFunctionsWorkerHttpExtensions --version 1.0.0-preview1                
#r "nuget: Tizzani.AzureFunctionsWorkerHttpExtensions, 1.0.0-preview1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Tizzani.AzureFunctionsWorkerHttpExtensions as a Cake Addin
#addin nuget:?package=Tizzani.AzureFunctionsWorkerHttpExtensions&version=1.0.0-preview1&prerelease

// Install Tizzani.AzureFunctionsWorkerHttpExtensions as a Cake Tool
#tool nuget:?package=Tizzani.AzureFunctionsWorkerHttpExtensions&version=1.0.0-preview1&prerelease                

AzureFunctionsWorkerHttpExtensions

This package adds support for binding query parameters in Azure Functions HTTP Triggers.

Usage

// Bind directly to primitive types:
[Function(nameof(SayHello))]
public HttpResponseData SayHello(
    [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestData req,
    [BindQuery] string name)
{
    var response = req.CreateResponse(HttpStatusCode.OK);
    response.WriteString($"Hello, {name}");
    return response;
}

// Bind to multiple parameters at once:
[Function(nameof(AddNumbers))]
public HttpResponseData AddNumbers(
    [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestData req,
    [BindQuery] int number1,
    [BindQuery] int number2)
{
    var response = req.CreateResponse(HttpStatusCode.OK);
    response.WriteString($"{number1} + {number2} = {number1 + number2}");
    return response;
}

// Or bind to POCO!:
[Function(nameof(PocoExample))]
public HttpResponseData PocoExample(
    [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestData req,
    [BindQuery] Poco? poco)
{
    var response = req.CreateResponse(HttpStatusCode.OK);
    response.WriteString($"Hello, {poco?.Name ?? "user"}!");

    if (poco?.Numbers is not null)
    {
        var numbersString = string.Join(" + ", poco.Numbers);
        response.WriteString($" {numbersString} = {poco.Numbers.Sum()}");
    }

    return response;
}

public record Poco(string Name, int[] Numbers);
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-preview2 102 7/28/2024
1.0.0-preview1 51 7/28/2024