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 domain searches #86

Closed akamsteeg closed 1 year ago

akamsteeg commented 1 year ago

Domain searches are here. 🎉 https://www.troyhunt.com/welcome-to-the-new-have-i-been-pwned-domain-search-subscription-service/ We should add a new interface and implement it in HaveIBeenPwnedClient.

/// <summary>
/// Represents a client for the domain search functionality of the <see
/// href="https://haveibeenpwned.com/">HaveIBeenPwned</see> service
/// </summary>
public interface IHaveIBeenPwnedDomainClient
{
  /// <summary>
  /// Get all the breached users in a domain with the breaches they appeared in
  /// </summary>
  /// <param name="domain">
  /// The domain to get the breached users for
  /// </param>
  /// <returns>
  /// An awaitable <see cref="Task{TResult}"/> with the collection of every
  /// breached <see cref="DomainUser"/> of the domain
  /// </returns>
  Task<IEnumerable<DomainUser>> GetBreachedDomainUsersAsync(string domain);

  /// <summary>
  /// Get all the breached users in a domain with the breaches they appeared in
  /// </summary>
  /// <param name="domain">
  /// The domain to get the breached users for
  /// </param>
  /// <param name="cancellationToken">
  /// The <see cref="CancellationToken"/> for this operation
  /// </param>
  /// <returns>
  /// An awaitable <see cref="Task{TResult}"/> with the collection of every
  /// breached <see cref="DomainUser"/> of the domain
  /// </returns>
  Task<IEnumerable<DomainUser>> GetBreachedDomainUsersAsync(string domain, CancellationToken cancellationToken);
}