FastDev.WebApi 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package FastDev.WebApi --version 0.1.0                
NuGet\Install-Package FastDev.WebApi -Version 0.1.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="FastDev.WebApi" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FastDev.WebApi --version 0.1.0                
#r "nuget: FastDev.WebApi, 0.1.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 FastDev.WebApi as a Cake Addin
#addin nuget:?package=FastDev.WebApi&version=0.1.0

// Install FastDev.WebApi as a Cake Tool
#tool nuget:?package=FastDev.WebApi&version=0.1.0                

FastDev.WebApi

Se utiliza da estrutura dos pacotes FastDev.Service, FastDev.Notifications e FastDev.Infra.Data para criar controllers no padrão REST com todos os metodos http básicos (Get, Post, Put, Delete e Patch), filtrar dados de retorno alem tratar retornos em forma de notificações facilitando o trabalho do desenvolvimento front-end.

Padrão de rotas e retornos

Tomaremos como exemplo a seguinte model:

public class User : DataModel<Guid>
{
    public string Email { get; set; }
    public string Name { get; set; }
}

GET

request
baseurl/users
responses
Http status code 204 - No Content
Http status code 200 - Success
[
    {
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "email": "someemail",
        "name": "somename"
    }
]

GET with fields

request
baseurl/users?getFields=Id,Email
responses
Http status code 204 - No Content
Http status code 200 - Success
[
    {
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "email": "someemail"
    }
]

GET/{id}

request
baseurl/users
responses
Http status code 204 - No Content
Http status code 200 - Success
{
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "email": "someemail",
    "name": "somename"
}

GET/{id} with fields

request
baseurl/users?getFields=Id,Email
responses
Http status code 204 - No Content
Http status code 200 - Success
{
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "email": "someemail"
}

POST

Request
baseurl/users

body

{
    "email": "someemail",
    "name": "somename"
}
responses
Http status code 400 - BadRequest
Http status code 400 - BadRequest
[
    {
        "property": "string",
        "message": "string",
        "level": 0
    }
]
Http status code 201 - Created
{
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "email": "someemail",
    "name": "somename"
}

POST with fields

Request
baseurl/users?getFields=Id

body

{
    "email": "someemail",
    "name": "somename"
}
responses
Http status code 400 - BadRequest
Http status code 400 - BadRequest
[
    {
        "property": "string",
        "message": "string",
        "level": 0
    }
]
Http status code 201 - Created
{
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

PUT

Request
baseurl/users/{id}

body

{
    "email": "someemail",
    "name": "somename"
}
responses
Http status code 404 - NotFound
{
    "property": null,
    "message": "user not found",
    "level": 2
}
Http status code 400 - BadRequest
Http status code 400 - BadRequest
[
    {
        "property": "string",
        "message": "string",
        "level": 1
    }
]
Http status code 200 - Success
{
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "email": "someemail",
    "name": "somename"
}

DELETE

Request
baseurl/users/{id}
responses
Http status code 404 - NotFound
{
    "property": null,
    "message": "user not found",
    "level": 2
}
Http status code 400 - BadRequest
Http status code 400 - BadRequest
[
    {
        "property": "string",
        "message": "string",
        "level": 1
    }
]
Http status code 200 - Success

PATCH

Request
baseurl/users/{id}

body

{
    email: "some-new-email"
}
responses
Http status code 404 - NotFound
{
    "property": null,
    "message": "user not found",
    "level": 2
}
Http status code 400 - BadRequest
Http status code 400 - BadRequest
[
    {
        "property": "PropX",
        "message": "PropX not existis",
        "level": 0
    }
]
Http status code 200 - Success
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
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
0.1.1 564 3/13/2022
0.1.0 522 3/7/2022