diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md b/sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md index 6dab78df2e67..3023486415f1 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md @@ -5,6 +5,7 @@ - Renamed the model `Appearance` to `TextAppearance`. - Renamed the model `Style` to `TextStyle`. - Renamed the extensible enum `TextStyle` to `TextStyleName`. +- Changed object type for property `Pages` under `RecognizeContentOptions` from `IEnumerable` to `IList`. ## 3.1.0-beta.1 (2020-11-23) diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/api/Azure.AI.FormRecognizer.netstandard2.0.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/api/Azure.AI.FormRecognizer.netstandard2.0.cs index 1efa3a039cf7..d0e5240880a3 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/api/Azure.AI.FormRecognizer.netstandard2.0.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/api/Azure.AI.FormRecognizer.netstandard2.0.cs @@ -70,7 +70,7 @@ public partial class RecognizeContentOptions public RecognizeContentOptions() { } public Azure.AI.FormRecognizer.FormContentType? ContentType { get { throw null; } set { } } public string Language { get { throw null; } set { } } - public System.Collections.Generic.IEnumerable Pages { get { throw null; } set { } } + public System.Collections.Generic.IList Pages { get { throw null; } } } public partial class RecognizeCustomFormsOptions { diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormRecognizerClient.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormRecognizerClient.cs index 5e022b31c590..4e1dc818c9ad 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormRecognizerClient.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormRecognizerClient.cs @@ -142,7 +142,7 @@ public virtual RecognizeContentOperation StartRecognizeContent(Stream form, Reco formContentType.ConvertToContentType1(), form, recognizeContentOptions.Language == null ? (Language?)null : recognizeContentOptions.Language, - recognizeContentOptions.Pages, + recognizeContentOptions.Pages.Count == 0 ? null : recognizeContentOptions.Pages, cancellationToken); string location = ClientCommon.GetResponseHeader(response.Headers, Constants.OperationLocationHeader); @@ -181,7 +181,7 @@ public virtual async Task StartRecognizeContentAsync( formContentType.ConvertToContentType1(), form, recognizeContentOptions.Language == null ? (Language?)null : recognizeContentOptions.Language, - recognizeContentOptions.Pages, + recognizeContentOptions.Pages.Count == 0 ? null : recognizeContentOptions.Pages, cancellationToken).ConfigureAwait(false); string location = ClientCommon.GetResponseHeader(response.Headers, Constants.OperationLocationHeader); @@ -217,7 +217,7 @@ public virtual RecognizeContentOperation StartRecognizeContentFromUri(Uri formUr SourcePath sourcePath = new SourcePath() { Source = formUri.AbsoluteUri }; Response response = ServiceClient.AnalyzeLayoutAsync( recognizeContentOptions.Language == null ? (Language?)null : recognizeContentOptions.Language, - recognizeContentOptions.Pages, + recognizeContentOptions.Pages.Count == 0 ? null : recognizeContentOptions.Pages, sourcePath, cancellationToken); string location = ClientCommon.GetResponseHeader(response.Headers, Constants.OperationLocationHeader); @@ -254,7 +254,7 @@ public virtual async Task StartRecognizeContentFromUr SourcePath sourcePath = new SourcePath() { Source = formUri.AbsoluteUri }; Response response = await ServiceClient.AnalyzeLayoutAsyncAsync( recognizeContentOptions.Language == null ? (Language?)null : recognizeContentOptions.Language, - recognizeContentOptions.Pages, + recognizeContentOptions.Pages.Count == 0 ? null : recognizeContentOptions.Pages, sourcePath, cancellationToken).ConfigureAwait(false); string location = ClientCommon.GetResponseHeader(response.Headers, Constants.OperationLocationHeader); diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/RecognizeContentOptions.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/RecognizeContentOptions.cs index 8ff0abf132fd..eaf0b9072f96 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/RecognizeContentOptions.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/RecognizeContentOptions.cs @@ -38,10 +38,16 @@ public RecognizeContentOptions() public string Language { get; set; } /// - /// Custom page numbers for multi-page documents(PDF/TIFF). Input the number of the - /// pages you want to get OCR result. For a range of pages, use a hyphen. - /// Separate each page or range with a comma. + /// + /// Custom page numbers for multi-page documents(PDF/TIFF). Input the page numbers + /// and/or ranges of pages you want to get in the result. For a range of pages, use a hyphen, like + /// `Pages = { "1-3", "5-6" }`. Separate each page number or range with a comma. + /// + /// + /// Although this collection cannot be set, it can be modified. + /// See collection initializer. + /// /// - public IEnumerable Pages { get; set; } + public IList Pages { get; } = new List(); } } diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/FormRecognizerClientLiveTests.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/FormRecognizerClientLiveTests.cs index a6744ab80c3c..33b0d0108810 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/FormRecognizerClientLiveTests.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/FormRecognizerClientLiveTests.cs @@ -461,7 +461,7 @@ public async Task StartRecognizeContentWithOnePageArgument(string pages, int exp using var stream = FormRecognizerTestEnvironment.CreateStream(TestFile.InvoiceMultipageBlank); using (Recording.DisableRequestBodyRecording()) { - operation = await client.StartRecognizeContentAsync(stream, new RecognizeContentOptions() { Pages = new List { pages } }); + operation = await client.StartRecognizeContentAsync(stream, new RecognizeContentOptions() { Pages = { pages } }); } FormPageCollection formPages = await operation.WaitForCompletionAsync(PollingInterval); @@ -480,7 +480,7 @@ public async Task StartRecognizeContentWithMultiplePageArgument(string page1, st using var stream = FormRecognizerTestEnvironment.CreateStream(TestFile.InvoiceMultipageBlank); using (Recording.DisableRequestBodyRecording()) { - operation = await client.StartRecognizeContentAsync(stream, new RecognizeContentOptions() { Pages = new List { page1, page2 } }); + operation = await client.StartRecognizeContentAsync(stream, new RecognizeContentOptions() { Pages = { page1, page2 } }); } FormPageCollection formPages = await operation.WaitForCompletionAsync(PollingInterval);