Exemple #1
0
        /// <summary>
        /// Get a single breached site by the breach name.
        /// </summary>
        /// <param name="breachName">Breach name. This is the stable value which may or may not be the same as the breach "title".</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <returns>The task object representing the asynchronous operation with a result of the breach.</returns>
        /// <exception cref="T:System.ArgumentException"><paramref name="breachName" /> is null or empty.</exception>
        /// <exception cref="T:ByteDev.Hibp.HibpClientException">Unhandled API error occured.</exception>
        public async Task <HibpBreachResponse> GetBreachSiteByNameAsync(string breachName, CancellationToken cancellationToken = default)
        {
            var uri = HibpUriFactory.CreateBreachSiteByNameUri(breachName);

            var response = await _httpClient.ApiGetAsync(uri, _options, cancellationToken);

            return(await HibpResponseFactory.CreateBreachResponseAsync(response));
        }