Poster 0.0.1

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

// Install Poster as a Cake Tool
#tool nuget:?package=Poster&version=0.0.1

Description

This library helps to build a HTTP service very quickly with embedded serialization and deserialization. You just need create interface, mark HTTP methods with attributes (GET, POST, DELETE etc.) and Poster will create your interface implementation for you.

HTTP service implementation example

    public interface IOrderService
    {
        [Get("https://test.com/order/{id}")]
        public Task<Order> GetOrderAsync(int id);

        [Post("https://test.com/order")]
        public Task CreateOrder([Body] Order order);
    }
Instrance creation
            var poster = new PosterBuilder()
                // Here you can add build configuration
                .Build();

            var orderService = poster.BuildService<IOrderService>();
            var order = await orderService.GetOrderAsync(10);

Supported HTTP requests

Poster support all main request types: GET, POST, PUT, PATCH, DELETE. You need to mark your method in service interface via GetAttribute, PostAttribute, PutAttribute, PatchAttribute or DeleteAttribute accordingly. Each http attribute has constructor with url parameter. Service will do request to this url addres. Url supports inline parameters. Parameter should be covered in bracket {} and method should contains this parameter as argument with the same name.

Method with parameters example
        [Get("https://test.com/order/{id}")]
        Task<Order> GetOrderAsync(int id);

        [Post("https://test.com/message/{testParam}?param={param}")]
        Task<Message> CreateMessageAsync(string testParam, double param);
Method return requirements

Each method in your service should returns Task or Task<TResponseModel>.

Http request body

If you want to send request body, you can add it to your method as argument and mark it via BodyAttribute

Request body example
        [Post("https://test.com/order")]
        Task CreateOrderAsync([Body] Order order);

Warning: only POST, PUT, PATCH methods support request body.

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 (1)

Showing the top 1 NuGet packages that depend on Poster:

Package Downloads
Poster.DependencyInjection

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.3 398 6/3/2021
0.0.2 456 1/13/2021
0.0.1 448 1/13/2021