Gossip4Net.Http
0.0.1
See the version list below for details.
dotnet add package Gossip4Net.Http --version 0.0.1
NuGet\Install-Package Gossip4Net.Http -Version 0.0.1
<PackageReference Include="Gossip4Net.Http" Version="0.0.1" />
paket add Gossip4Net.Http --version 0.0.1
#r "nuget: Gossip4Net.Http, 0.0.1"
// Install Gossip4Net.Http as a Cake Addin #addin nuget:?package=Gossip4Net.Http&version=0.0.1 // Install Gossip4Net.Http as a Cake Tool #tool nuget:?package=Gossip4Net.Http&version=0.0.1
Gossip4Net
Gossip4Net is an extensible http client middleware similar to Spring Feign. It allows developers to easily consume APIs using an interface contract, which gets automatically implemented.
Getting started
0. Get Gossip4Net
For standalone usage:
Install-Package Gossip4Net.Http
For usage within ASP.NET core:
Install-Package Gossip4Net.Http.DependencyInjection
1. Define your API contract and models
namespace MyDemo {
public record HttpBinResponseDto(IDictionary<string, string> Headers);
public record PersonRequestDto(string Fistname, string Lastname);
[HttpApi("https://httpbin.org")]
public interface HttpBinApi {
[GetMapping("/get")]
Task<HttpBinResponseDto> GetAsync();
[GetMapping("/get")]
HttpBinResponseDto GetSync();
[PostMapping("/post")]
Task PostAsync(Person person);
}
}
2. Obtain and configure a HttpGossipBuilder
using Gossip4Net.Http;
namespace MyDemo {
public class Demo {
public async Task Startup() {
IHttpGossipBuilder<HttpBinApi> builder = new HttpGossipBuilder<HttpBinApi>();
builder.AddDefaultBehavior();
}
}
}
For ASP.NET core, dependency injection can be used:
using Gossip4Net.Http.DependencyInjection;
namespace AspNetDemo {
public class Startup {
public void ConfigureServices(IServiceCollection services)
{
services.AddGossipHttpClient<HttpBinApi>();
}
}
}
3. Let Gossip4Net implement your API interface
using Gossip4Net.Http;
namespace MyDemo {
public class Demo {
public async Task Startup() {
IHttpGossipBuilder<HttpBinApi> builder = new HttpGossipBuilder<HttpBinApi>();
builder.AddDefaultBehavior();
HttpBinApi api = builder.Build();
}
}
}
4. Use your API
using Gossip4Net.Http;
namespace MyDemo {
public class Demo {
public async Task Startup() {
IHttpGossipBuilder<HttpBinApi> builder = new HttpGossipBuilder<HttpBinApi>();
builder.AddDefaultBehavior();
HttpBinApi api = builder.Build();
HttpBinResponseDto response = await api.GetAync();
}
}
}
Product | Versions 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. net9.0 was computed. 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. |
-
net6.0
- Gossip4Net.Model (>= 0.0.1)
- ImpromptuInterface (>= 7.0.1)
- System.Net.Http (>= 4.3.4)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Gossip4Net.Http:
Package | Downloads |
---|---|
Gossip4Net.Http.DependencyInjection
Gossip4Net is an extensible http client middleware similar to Spring Feign. It allows developers to easily consume APIs using an interface contract, which gets automatically implemented. |
|
Gossip4Net.Http.Xml
Gossip4Net is an extensible http client middleware similar to Spring Feign. It allows developers to easily consume APIs using an interface contract, which gets automatically implemented. |
GitHub repositories
This package is not used by any popular GitHub repositories.