Exemple #1
0
        /// <summary>
        /// Get all pastes for an account. Requires that a client API key be provided.
        /// </summary>
        /// <param name="emailAddress">Email address for the account.</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 pastes.</returns>
        /// <exception cref="T:System.ArgumentException"><paramref name="emailAddress" /> is null or empty.</exception>
        /// <exception cref="T:ByteDev.Hibp.HibpClientException">Unhandled API error occured.</exception>
        public async Task <IEnumerable <HibpPasteResponse> > GetAccountPastesAsync(string emailAddress, CancellationToken cancellationToken = default)
        {
            var uri = HibpUriFactory.CreateAccountPastesUri(emailAddress);

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

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