Dosaic.Plugins.Endpoints.RestResourceEntity 1.0.34

There is a newer version of this package available.
See the version list below for details.
dotnet add package Dosaic.Plugins.Endpoints.RestResourceEntity --version 1.0.34
                    
NuGet\Install-Package Dosaic.Plugins.Endpoints.RestResourceEntity -Version 1.0.34
                    
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="Dosaic.Plugins.Endpoints.RestResourceEntity" Version="1.0.34" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dosaic.Plugins.Endpoints.RestResourceEntity" Version="1.0.34" />
                    
Directory.Packages.props
<PackageReference Include="Dosaic.Plugins.Endpoints.RestResourceEntity" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Dosaic.Plugins.Endpoints.RestResourceEntity --version 1.0.34
                    
#r "nuget: Dosaic.Plugins.Endpoints.RestResourceEntity, 1.0.34"
                    
#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.
#addin nuget:?package=Dosaic.Plugins.Endpoints.RestResourceEntity&version=1.0.34
                    
Install Dosaic.Plugins.Endpoints.RestResourceEntity as a Cake Addin
#tool nuget:?package=Dosaic.Plugins.Endpoints.RestResourceEntity&version=1.0.34
                    
Install Dosaic.Plugins.Endpoints.RestResourceEntity as a Cake Tool

Dosaic.Plugins.Endpoints.RestResourceEntity

Overview

A plugin that provides REST endpoint configurations for resource entities in the Dosaic framework. This plugin simplifies the creation of standardized REST endpoints for entities that implement IGuidIdentifier.

Features

  • Simplified REST endpoint configuration
  • Support for standard HTTP methods
  • Built-in response type management
  • Configurable OpenAPI documentation
  • Flexible authorization policies
  • Global response handling

Installation

To install the nuget package follow these steps:

dotnet add package Dosaic.Plugins.Endpoints.RestResourceEntity

or add as package reference to your .csproj

<PackageReference Include="Dosaic.Plugins.Endpoints.RestResourceEntity" Version="" />

Usage

Configure REST endpoints for your resource entities:

public void ConfigureEndpoints(IEndpointRouteBuilder endpointRouteBuilder, IServiceProvider serviceProvider)
{
    // to configure all http verbs/actions at once
    endpointRouteBuilder
        .AddSimpleRestResource<Entity>(serviceProvider, "api-route-resource-name")
        .ForAll();

    //to configure specific http verbs/actions
    endpointRouteBuilder
        .AddSimpleRestResource<Entity>(serviceProvider, "api-route-resource-name")
        .ForDelete(c =>
            c.WithDisplayName("deleter")
             .WithGroupName("testgorup")
             .WithOpenApiTags("test", "tester")
             .WithPolicies("deleter") // or .AllowAnonymous()
             .Produces<ErrorResponse>(HttpStatusCode.Accepted)
             .Produces<ErrorResponse>(HttpStatusCode.OK)
             .DisableDefaultResponses()
    );
}

Configuration Options

  • OpenAPI tags customization
  • Authorization policies
  • Custom response types
  • Default response handling
  • Anonymous access control

Global Response Types

The plugin includes default response mappings for common HTTP status codes:

  • 401 Unauthorized: ErrorResponse
  • 403 Forbidden: ErrorResponse
  • 500 Internal Server Error: ErrorResponse
  • 400 Bad Request: ValidationErrorResponse

Default response mapping can be customized

public sealed class RestResourceEntityPlugin : IPluginServiceConfiguration
{
    public void ConfigureServices(IServiceCollection serviceCollection)
    {
        var options = new GlobalResponseOptions();
        options.Add(HttpStatusCode.NoContent);
        options.Add<GlobalResponseOptionsTests>(HttpStatusCode.Processing);
        options.Remove(HttpStatusCode.InternalServerError);
        serviceCollection.AddSingleton<GlobalResponseOptions>(options);
    }
}
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.37 152 4/7/2025
1.0.36 467 3/25/2025
1.0.35 211 3/4/2025
1.0.34 206 3/4/2025
1.0.32 141 3/3/2025
1.0.30 101 1/30/2025
1.0.27 96 1/29/2025
1.0.26 97 1/29/2025
1.0.25 86 1/29/2025
1.0.18 94 1/23/2025
1.0.17 89 1/23/2025