public async Task <BanPage> GetBanPageAsync(int page = 1) { if (!_webManager.IsAuthenticated) { throw new Exception("User must be authenticated before using this method."); } var result = await _webManager.GetDataAsync(string.Format(EndPoints.RapSheet, page)); var document = await _webManager.Parser.ParseAsync(result.ResultHtml); return(BanHandler.ParseBanPage(document)); }
/// <summary> /// Get the Banned Members page. /// </summary> /// <param name="page">The page number to start parsing from. Defaults to 1.</param> /// <param name="token">A CancellationToken.</param> /// <returns>A BanPage.</returns> public async Task <BanPage> GetBanPageAsync(int page = 1, CancellationToken token = default) { if (!this.webManager.IsAuthenticated) { throw new UserAuthenticationException(Awful.Core.Resources.ExceptionMessages.UserAuthenticationError); } var result = await this.webManager.GetDataAsync(string.Format(CultureInfo.InvariantCulture, EndPoints.RapSheet, page), token).ConfigureAwait(false); var document = await this.webManager.Parser.ParseDocumentAsync(result.ResultHtml, token).ConfigureAwait(false); return(BanHandler.ParseBanPage(document)); }