CommunityToolkit.Aspire.Posta
13.5.1-beta.736
Prefix Reserved
dotnet add package CommunityToolkit.Aspire.Posta --version 13.5.1-beta.736
NuGet\Install-Package CommunityToolkit.Aspire.Posta -Version 13.5.1-beta.736
<PackageReference Include="CommunityToolkit.Aspire.Posta" Version="13.5.1-beta.736" />
<PackageVersion Include="CommunityToolkit.Aspire.Posta" Version="13.5.1-beta.736" />
<PackageReference Include="CommunityToolkit.Aspire.Posta" />
paket add CommunityToolkit.Aspire.Posta --version 13.5.1-beta.736
#r "nuget: CommunityToolkit.Aspire.Posta, 13.5.1-beta.736"
#:package CommunityToolkit.Aspire.Posta@13.5.1-beta.736
#addin nuget:?package=CommunityToolkit.Aspire.Posta&version=13.5.1-beta.736&prerelease
#tool nuget:?package=CommunityToolkit.Aspire.Posta&version=13.5.1-beta.736&prerelease
Posta client integration
Use this integration to call the Posta HTTP API through an HttpClient configured with Aspire service discovery.
Getting started
dotnet add package CommunityToolkit.Aspire.Posta
Register the client in the consuming project:
builder.AddPostaClient("posta", settings =>
{
settings.ApiKey = builder.Configuration["Posta:ApiKey"];
});
The hosting resource exposes an Endpoint=... connection string, so an AppHost can use .WithReference(posta).
Calling an API section
The client intentionally covers the application-facing email, template, subscriber-list, health, and information APIs. These areas are exposed through separate interfaces.
using CommunityToolkit.Aspire.Posta.Models.Emails;
using CommunityToolkit.Aspire.Posta.Clients;
public sealed class MailService(IPostaClient posta)
{
public Task<SendAnEmailResponse?> SendAsync(CancellationToken cancellationToken) =>
posta.Emails.SendAnEmailAsync(
new SendAnEmailRequest
{
From = "Acme <hello@example.com>",
To = ["user@example.com"],
Subject = "Hello",
Html = "<h1>Hello!</h1>"
},
cancellationToken);
}
Path and query parameters are supplied separately and are escaped by the client:
await posta.Emails.GetEmailDetailsAsync(
new GetEmailDetailsRequest
{
Id = emailId
},
cancellationToken);
API-key and JWT operations select the appropriate configured credential automatically. A dynamic application-wide implementation can replace CommunityToolkit.Aspire.Posta.Configuration.IPostaCredentialProvider in DI.
For multiple Posta instances, register keyed clients with AddKeyedPostaClient(...) and resolve them through GetRequiredKeyedService<IPostaClient>(key).
Request and response models
Models are grouped by API area under CommunityToolkit.Aspire.Posta.Models, for example Models.Emails, Models.Templates, and Models.SubscriberLists. Reusable nested schemas are under Models.Shared. JSON property names, required members, path parameters, and query parameters follow Posta's OpenAPI document.
Administrative, OAuth, workspace-management, analytics, campaign, and other uncommon APIs are not duplicated in this package. They can still be called through IPostaSectionClient.SendAsync<TResponse> with a custom PostaEndpoint and PostaRequest.
Overriding endpoints
Paths are not embedded in the section clients. Replace IPostaEndpoints, or derive from PostaEndpoints and override only the changed operation:
public sealed class CustomPostaEndpoints : PostaEndpoints
{
public override PostaEndpoint SendAnEmail { get; } =
new(HttpMethod.Post, "/custom/v1/emails/send", PostaAuthentication.ApiKey);
}
builder.Services.AddSingleton<IPostaEndpoints, CustomPostaEndpoints>();
Additional documentation
Feedback & contributing
Submit issues and pull requests through the CommunityToolkit.Aspire repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 is compatible. 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. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Configuration.Binder (>= 10.0.11)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Http (>= 10.0.11)
- Microsoft.Extensions.ServiceDiscovery (>= 10.0.0)
-
net8.0
- Microsoft.Extensions.Configuration.Binder (>= 10.0.11)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Http (>= 10.0.11)
- Microsoft.Extensions.ServiceDiscovery (>= 10.0.0)
-
net9.0
- Microsoft.Extensions.Configuration.Binder (>= 10.0.11)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Http (>= 10.0.11)
- Microsoft.Extensions.ServiceDiscovery (>= 10.0.0)
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 |
|---|---|---|
| 13.5.1-beta.736 | 25 | 9/1/2026 |
| 13.5.0 | 100 | 8/25/2026 |
| 13.5.0-beta.731 | 51 | 8/24/2026 |