Astrol.Shared.Repository 10.0.13.1
Astrol.Shared.Repository
HTTP client for Blazor (WebAssembly and Server) from AstrolUI. It wraps HttpClient and always returns an
HttpResponseWrapper<T>: HTTP errors, network failures and timeouts come back in the result instead of as
exceptions.
Full documentation with a live demo: https://doc.astrolui.com/repository
Register
using Astrol.Shared.Repository;
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddAstrolRepository("https://api.my-app.com/");
// or from appsettings.json (ClientSetting: EnvironmentProduction + Address.Production / Address.Development)
builder.Services.AddAstrolRepository(clientSetting, options => options.DefaultLanguage = null);
Use
@inject IRepository Repository
var result = await Repository.Get<List<ClientDto>>("api/clients");
if (result.IsSuccess)
clients = result.Response;
else if (result.IsNetworkError)
Toast.Warning("No connection to the server.");
else
Toast.Error(result.ErrorMessage!); // ProblemDetails detail/title, validation errors, body text or HTTP status
await Repository.Post<ClientDto, ClientDto>("api/clients", client);
await Repository.Patch($"api/clients/{id}", new { FullName = "Ana" });
await Repository.Delete($"api/clients/{id}");
await Repository.Post<List<string>>("api/documents", files, fields: new Dictionary<string, string> { ["folder"] = "invoices" });
language(Accept-Language) defaults to the app culture (CultureInfo.CurrentUICulture).- Register an
IRepositoryTokenProviderto sendAuthorization: Bearer {token}on every request. RepositoryOptions:JsonSerializerOptions(Web defaults),UseJsonContext,DefaultLanguage,ThrowExceptions,AuthorizationScheme,ConfigureRequest.
Faster JSON (recommended for WebAssembly)
[JsonSerializable(typeof(ClientDto))]
[JsonSerializable(typeof(List<ClientDto>))]
internal partial class AppJsonContext : JsonSerializerContext { }
builder.Services.AddAstrolRepository(url, options => options.UseJsonContext(AppJsonContext.Default));
Types in the context use source-generated metadata (no reflection, faster first call, trimming friendly);
other types keep using reflection. The library is marked IsTrimmable / IsAotCompatible.
Showing the top 20 packages that depend on Astrol.Shared.Repository.
| Packages | Downloads |
|---|---|
|
Astrol.Component.Authorization
Package Description
|
216 |
|
Astrol.Component.Authorization
Package Description
|
146 |
|
Astrol.Component.Authorization
Package Description
|
145 |
|
Astrol.Component.Authorization
Package Description
|
135 |
|
Astrol.Component.Authorization
Package Description
|
134 |
|
Astrol.Component.Authorization
Package Description
|
131 |
|
Astrol.Component.Authorization
Package Description
|
129 |
|
Astrol.Component.Authorization
Package Description
|
123 |
|
Astrol.Component.Authorization
Package Description
|
121 |
|
Astrol.Component.Authorization
Package Description
|
111 |
|
Astrol.Component.Authorization
Package Description
|
110 |
|
Astrol.Component.Authorization
Package Description
|
108 |
|
Astrol.Component.Authorization
Package Description
|
95 |
|
Astrol.Component.Authorization
Package Description
|
91 |
|
Astrol.Component.Authorization
Package Description
|
88 |
|
Astrol.Component.Authorization
Package Description
|
87 |
|
Astrol.Component.Authorization
Package Description
|
85 |
.NET 10.0
- Microsoft.AspNetCore.Components.Web (>= 10.0.13)
| Version | Downloads | Last updated |
|---|---|---|
| 10.0.13.1 | 20 | 24/10/2026 |
| 10.0.8.2 | 14 | 23/10/2026 |
| 10.0.8.1 | 68 | 22/05/2026 |
| 9.0.7.12 | 59 | 22/05/2026 |
| 9.0.7.11 | 72 | 22/04/2026 |
| 9.0.7.4 | 64 | 15/04/2026 |
| 9.0.7.3 | 71 | 15/04/2026 |
| 9.0.7.2 | 68 | 15/04/2026 |
| 9.0.7.1 | 100 | 28/11/2025 |
| 9.0.7 | 119 | 08/07/2025 |
| 8.0.5 | 135 | 22/08/2024 |
| 8.0.4 | 225 | 21/04/2024 |
| 8.0.0 | 159 | 14/02/2024 |
| 7.0.0 | 140 | 14/02/2024 |
| 1.0.3 | 196 | 07/02/2024 |
| 1.0.2 | 154 | 07/02/2024 |
| 1.0.1 | 130 | 07/02/2024 |
| 1.0.0 | 140 | 04/07/2023 |