Exemplo n.º 1
0
        public async Task <WaivesDocument> ExtractAsync(string extractorName, CancellationToken cancellationToken = default)
        {
            if (string.IsNullOrWhiteSpace(extractorName))
            {
                throw new ArgumentException("Value cannot be null or whitespace.",
                                            nameof(extractorName));
            }

            return(new WaivesDocument(Source, HttpDocument)
            {
                ClassificationResults = ClassificationResults,
                ExtractionResults = await HttpDocument
                                    .ExtractAsync(extractorName, cancellationToken)
                                    .ConfigureAwait(false)
            });
        }
Exemplo n.º 2
0
        public async Task <WaivesDocument> RedactAsync(
            string extractorName,
            Func <WaivesDocument, Stream, Task> resultFunc,
            CancellationToken cancellationToken = default)
        {
            if (string.IsNullOrWhiteSpace(extractorName))
            {
                throw new ArgumentNullException(nameof(extractorName));
            }

            if (resultFunc == null)
            {
                throw new ArgumentNullException(nameof(resultFunc));
            }

            var resultStream = await HttpDocument
                               .RedactAsync(extractorName, cancellationToken)
                               .ConfigureAwait(false);

            await resultFunc(this, resultStream).ConfigureAwait(false);

            return(this);
        }