There is currently one ZIP extension for Solid.Http.Core. The extension uses the System.IO.Compression for deserialization. This package is useful if you need to request a zip archive and manipulate it programmatically.
Solid.Http.Zip uses System.IO.Compression internally.
> dotnet add package Solid.Http.Zip
You can add Solid.Http.Zip using the builder.
public void ConfigureServices(IServiceCollection services)
{
// This call to AddSolidHttpCore could be replaced with AddSolidHttp
services.AddSolidHttpCore(builder =>
{
builder.AddZip(options =>
{
options.Mode = ZipArchiveMode.Read;
});
});
}
You can also specify the ZipArchiveMode if a specific HTTP endpoint differs from the default.
public async Task<Post> GetAsync(int id)
{
return await _client
.GetAsync("posts")
.WithQueryParameter("zip", true)
.ExpectSuccess()
// mode is optional
.As<Post>(settings, mode: ZipArchiveMode.Read)
;
}