AugusteVN.Modules.Sponsorships.Api
1.0.7
dotnet add package AugusteVN.Modules.Sponsorships.Api --version 1.0.7
NuGet\Install-Package AugusteVN.Modules.Sponsorships.Api -Version 1.0.7
<PackageReference Include="AugusteVN.Modules.Sponsorships.Api" Version="1.0.7" />
<PackageVersion Include="AugusteVN.Modules.Sponsorships.Api" Version="1.0.7" />
<PackageReference Include="AugusteVN.Modules.Sponsorships.Api" />
paket add AugusteVN.Modules.Sponsorships.Api --version 1.0.7
#r "nuget: AugusteVN.Modules.Sponsorships.Api, 1.0.7"
#:package AugusteVN.Modules.Sponsorships.Api@1.0.7
#addin nuget:?package=AugusteVN.Modules.Sponsorships.Api&version=1.0.7
#tool nuget:?package=AugusteVN.Modules.Sponsorships.Api&version=1.0.7
AugusteVN.Modules.Sponsorships.Api
Minimal API endpoints for sponsor segment management — with scoped-permission authorization, FluentValidation, and CQRS dispatch via Mapster.
Part of the AugusteVN Modules collection.
Extension Methods
AddSponsorshipsApi(this IServiceCollection, IConfiguration)
Registers the Sponsorships API layer:
- Scans the
_Sharedassembly for FluentValidation validators (CreateSponsorSegmentRequestand related) and registers them in the DI container.
MapSponsorshipsEndpoints(this IEndpointRouteBuilder)
Maps all sponsor segment endpoints under a single route group (SponsorSegments) with:
- Tagged Swagger grouping (
SponsorSegments) ApiExceptionFilterfor centralized exception-to-ProblemDetails mapping- Individual endpoint registration via extension methods
API Routes
All routes are grouped under /SponsorSegments.
| Method | Route | Authorization | Description |
|---|---|---|---|
| GET | /SponsorSegments/ |
ManageSponsorships |
Retrieve a paginated list of all sponsor segments |
| GET | /SponsorSegments/{Id} |
ManageSponsorships |
Retrieve a single sponsor segment by ID |
| GET | /SponsorSegments/Content |
Anonymous | Retrieve the sponsor segment for a specific blog post |
| POST | /SponsorSegments/ |
Anonymous | Create a new sponsor segment (validated) |
| PUT | /SponsorSegments/ |
ManageSponsorships |
Update an existing sponsor segment (validated) |
GET /SponsorSegments/
Retrieves paginated sponsor segments. Accepts PageNumber and PageSize query parameters via GetSponsorSegmentsRequest. Requires ManageSponsorships permission.
GET /SponsorSegments/{Id}
Retrieves a single sponsor segment by its unique Guid identifier. Requires ManageSponsorships permission.
GET /SponsorSegments/Content
Retrieves the sponsor segment associated with a specific blog post via BlogPostSlug query parameter. This endpoint is publicly accessible (no authorization) so content pages can embed sponsor segments.
POST /SponsorSegments/
Creates a new sponsor segment. The request body is validated through EndpointValidationFilter<CreateSponsorSegmentRequest>. Returns 204 No Content on success.
PUT /SponsorSegments/
Updates an existing sponsor segment. Requires ManageSponsorships permission. The request body is validated through EndpointValidationFilter<UpdateSponsorSegmentRequest>. Returns 204 No Content on success.
Authorization
Endpoints use the RequirePermission extension method on the route builder chain:
builder.MapGet("/", GetSponsorSegmentsAsync)
.RequirePermission(nameof(Sponsorships), (int)Permissions.ManageSponsorships);
The GetSponsorSegmentsForContent endpoint is intentionally left without authorization to allow anonymous content rendering.
Error Handling
All endpoints use ApiExceptionFilter (extending EndpointExceptionFilter) to convert exceptions into RFC 7807 Problem Details responses. CQRS results use the Result pattern — failures are mapped to Results.Problem(result.Error.Description).
Registration
// Program.cs
builder.Services.AddSponsorshipsApi(builder.Configuration);
app.MapSponsorshipsEndpoints();
Installation
dotnet add package AugusteVN.Modules.Sponsorships.Api
Full Documentation
See the Sponsorships Module README for complete documentation.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- AugusteVN.Api.Auth.Extensions (>= 1.1.0)
- AugusteVN.Api.EndpointFilters (>= 1.1.0)
- AugusteVN.CQRS.Extensions (>= 1.1.0)
- AugusteVN.Modules.Sponsorships._Shared (>= 1.0.7)
- AugusteVN.Modules.Sponsorships.Database.EfCore (>= 1.0.7)
- AugusteVN.Modules.Sponsorships.Database.Mongo (>= 1.0.7)
- AugusteVN.Modules.Sponsorships.Features (>= 1.0.7)
- Mapster (>= 10.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.