Mhlabs.WebApi.JsendActionFilter 4.0.0

dotnet add package Mhlabs.WebApi.JsendActionFilter --version 4.0.0                
NuGet\Install-Package Mhlabs.WebApi.JsendActionFilter -Version 4.0.0                
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="Mhlabs.WebApi.JsendActionFilter" Version="4.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Mhlabs.WebApi.JsendActionFilter --version 4.0.0                
#r "nuget: Mhlabs.WebApi.JsendActionFilter, 4.0.0"                
#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 Mhlabs.WebApi.JsendActionFilter as a Cake Addin
#addin nuget:?package=Mhlabs.WebApi.JsendActionFilter&version=4.0.0

// Install Mhlabs.WebApi.JsendActionFilter as a Cake Tool
#tool nuget:?package=Mhlabs.WebApi.JsendActionFilter&version=4.0.0                

Mhlabs.WebApi.JsendActionFilter

Action filter for optionally wrapping a response in JSend format.

See https://labs.omniti.com/labs/jsend.

To enable, add the filter as middleware.

services.AddMvc(s =>
{
    s.AddJSendResponseFormat();
});

Example usage:

[HttpGet]
public ActionResult<bool> GetIt(string id, CancellationToken cancellationToken)
{
    if (string.IsNullOrWhiteSpace(id))
    {
        return this.Error("NO_ID", "Didn't get it.");
    }

    return true;
}

[HttpGet]
public async Task<DtoObject> Get(string id, CancellationToken cancellationToken)
{
    if (string.IsNullOrEmpty(id))
    {
        this.Fail("INVALID_ID", "Id is invalid");
    }

    var dto = await _handler.GetObject(id, cancellationToken);

    if (dto == null)
    {
        this.Fail("NOT_FOUND");
    }

    return dto;
}

Pushing a new version

Set the Version number in the <a href="https://github.com/mhlabs/Mhlabs.WebApi.JsendActionFilter/blob/master/Mhlabs.WebApi.JsendActionFilter/Mhlabs.WebApi.JsendActionFilter.csproj"> .csproj-file</a> before pushing. If an existing version is pushed the <a href="https://github.com/mhlabs/Mhlabs.WebApi.JsendActionFilter/actions">build will fail</a>.

Publish pre-release packages on branches to allow us to test the package without merging to master

  1. Create a new branch
  2. Update Version number and add -beta postfix (can have .1, .2 etc. at the end)
  3. Make any required changes updating the version as you go
  4. Test beta package in solution that uses package
  5. Create PR and get it reviewed
  6. Check if there are any changes on the branch you're merging into. If there are you need to rebase those changes into yours and check that it still builds
  7. As the final thing before merging update version number and remove post fix
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
4.0.0 2,040 1/13/2023
3.3.0 3,750 4/13/2021
3.2.0 479 4/13/2021
3.1.0 9,518 11/14/2019
3.0.0 3,924 5/17/2019
2.1.0 3,805 1/7/2019
2.0.0 954 1/4/2019
1.2.1 1,847 11/13/2018
1.2.0 949 11/8/2018
1.1.0 2,087 9/25/2018
1.0.6 8,334 10/19/2017
1.0.5 3,312 6/8/2017
1.0.4 941 6/8/2017
1.0.3 936 6/8/2017
1.0.2 965 6/8/2017
1.0.1 945 6/7/2017
1.0.0 1,038 6/2/2017