An unofficial .NET API client for the MSRC CVRF API
There are two main ways to use this client:
- Dependency Injection
- Manual Instantiation
To use the client with dependency injection, register it in your IServiceCollection
:
using JamieMagee.MicrosoftSecurityUpdates.Client;
// In Program.cs
builder.Services.AddMicrosoftSecurityUpdatesClient();
// Or with custom HttpClient configuration
builder.Services.AddMicrosoftSecurityUpdatesClient(httpClient =>
{
// Add custom headers, configure policies, etc.
httpClient.Timeout = TimeSpan.FromSeconds(30);
});
Then inject IMicrosoftSecurityUpdatesClient
into your services:
public class SecurityService
{
private readonly IMicrosoftSecurityUpdatesClient _client;
public SecurityService(IMicrosoftSecurityUpdatesClient client)
{
_client = client;
}
public async Task<IEnumerable<Update>> GetLatestUpdatesAsync()
{
return await _client.GetUpdatesAsync();
}
public async Task<CvrfDocument> GetSecurityBulletinAsync(string id)
{
return await _client.GetCvrfByIdAsync(id);
}
}
You can also create instances manually:
// Using default HttpClient
using var client = new MicrosoftSecurityUpdatesClient();
// Using your own HttpClient (for advanced scenarios)
using var httpClient = new HttpClient();
httpClient.Timeout = TimeSpan.FromSeconds(30);
var client = new MicrosoftSecurityUpdatesClient(httpClient);
// Get updates
var updates = await client.GetUpdatesAsync();
All packages in this repository are licensed under the MIT license.