akamsteeg / AtleX.HaveIBeenPwned

A fully async .NET Standard client library for the API of HaveIBeenPwned.com
https://www.nuget.org/packages/AtleX.HaveIBeenPwned/
MIT License
5 stars 0 forks source link

Add support for getting the latest breach #87

Closed akamsteeg closed 1 year ago

akamsteeg commented 1 year ago

Recently, support for getting only the latest breach was added to the V3 API of HaveIBeenPwned.com. We should implement it as well.

Let's expand IHaveIBeenPwnedBreachesClient and add the new methods and implement them in HaveIBeenPwnedClient.

  /// <summary>
  /// Get the latest breach for an account
  /// </summary>
  /// <param name="account">
  /// The account to get the latest breach for
  /// </param>
  /// <returns>
  /// An awaitable <see cref="Task{TResult}"/> with the latest
  /// <see cref="Breach"/> the account was found in
  /// </returns>
  Task<Breach> GetLatestBreachAsync(string account);

  /// <summary>
  /// Get the latest breach for an account
  /// </summary>
  /// <param name="account">
  /// The account to get the latest breach for
  /// </param>
  /// <param name="cancellationToken">
  /// The <see cref="CancellationToken"/> for this operation
  /// </param>
  /// <returns>
  /// An awaitable <see cref="Task{TResult}"/> with the latest
  /// <see cref="Breach"/> the account was found in
  /// </returns>
  Task<Breach> GetLatestBreachAsync(string account, CancellationToken cancellationToken);