Skip to content

JamieMagee/MicrosoftSecurityUpdates

Repository files navigation

Microsoft Security Updates Client

GitHub Workflow Status NuGet Package Version NuGet Package Downloads MIT License

An unofficial .NET API client for the MSRC CVRF API

Usage

There are two main ways to use this client:

  • Dependency Injection
  • Manual Instantiation

Dependency Injection

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);
    }
}

Manual Instantiation

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();

License

All packages in this repository are licensed under the MIT license.

About

MSRC API client for .NET

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •  

Languages