Skip to content

Commit 6ceeb85

Browse files
authored
[TA] Add pagination with transforms to analyze (Azure#19266)
* add pagination with transforms * re-record becuase of new displayname
1 parent af21bab commit 6ceeb85

File tree

8 files changed

+474
-316
lines changed

8 files changed

+474
-316
lines changed

sdk/textanalytics/Azure.AI.TextAnalytics/src/AnalyzeBatchActionsOperation.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,6 @@ public class AnalyzeBatchActionsOperation : PageableOperation<AnalyzeBatchAction
121121
/// </summary>
122122
private bool? _showStats { get; }
123123

124-
/// <summary>
125-
/// Provides the api version to use when doing pagination.
126-
/// </summary>
127-
private readonly string _apiVersion;
128-
129124
/// <summary>
130125
/// Returns true if the long-running operation completed successfully and has produced final result (accessible by Value property).
131126
/// </summary>
@@ -150,15 +145,13 @@ public AnalyzeBatchActionsOperation(string operationId, TextAnalyticsClient clie
150145
/// </summary>
151146
/// <param name="serviceClient">The client for communicating with the Form Recognizer Azure Cognitive Service through its REST API.</param>
152147
/// <param name="diagnostics">The client diagnostics for exception creation in case of failure.</param>
153-
/// <param name="apiversion">The specific api version to use.</param>
154148
/// <param name="operationLocation">The address of the long-running operation. It can be obtained from the response headers upon starting the operation.</param>
155149
/// <param name="idToIndexMap"></param>
156150
/// <param name="showStats"></param>
157-
internal AnalyzeBatchActionsOperation(TextAnalyticsRestClient serviceClient, ClientDiagnostics diagnostics, string apiversion, string operationLocation, IDictionary<string, int> idToIndexMap, bool? showStats = default)
151+
internal AnalyzeBatchActionsOperation(TextAnalyticsRestClient serviceClient, ClientDiagnostics diagnostics, string operationLocation, IDictionary<string, int> idToIndexMap, bool? showStats = default)
158152
{
159153
_serviceClient = serviceClient;
160154
_diagnostics = diagnostics;
161-
_apiVersion = apiversion;
162155
_idToIndexMap = idToIndexMap;
163156
_showStats = showStats;
164157

@@ -295,7 +288,7 @@ async Task<Page<AnalyzeBatchActionsResult>> NextPageFunc(string nextLink, int? p
295288
//diagnostics scope?
296289
try
297290
{
298-
Response<AnalyzeJobState> jobState = await _serviceClient.AnalyzeStatusNextPageAsync(_apiVersion, nextLink, _showStats).ConfigureAwait(false);
291+
Response<AnalyzeJobState> jobState = await _serviceClient.AnalyzeStatusNextPageAsync(nextLink, _showStats).ConfigureAwait(false);
299292

300293
AnalyzeBatchActionsResult result = Transforms.ConvertToAnalyzeOperationResult(jobState.Value, _idToIndexMap);
301294
return Page.FromValues(new List<AnalyzeBatchActionsResult>() { result }, jobState.Value.NextLink, jobState.GetRawResponse());
@@ -324,7 +317,7 @@ Page<AnalyzeBatchActionsResult> NextPageFunc(string nextLink, int? pageSizeHint)
324317
//diagnostics scope?
325318
try
326319
{
327-
Response<AnalyzeJobState> jobState = _serviceClient.AnalyzeStatusNextPage(_apiVersion, nextLink, _showStats);
320+
Response<AnalyzeJobState> jobState = _serviceClient.AnalyzeStatusNextPage(nextLink, _showStats);
328321

329322
AnalyzeBatchActionsResult result = Transforms.ConvertToAnalyzeOperationResult(jobState.Value, _idToIndexMap);
330323
return Page.FromValues(new List<AnalyzeBatchActionsResult>() { result }, jobState.Value.NextLink, jobState.GetRawResponse());

sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/TextAnalyticsRestClient.cs

Lines changed: 145 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2375,7 +2375,7 @@ private AnalyzeBatchActionsOperation StartAnalyzeBatchActions(MultiLanguageBatch
23752375

23762376
IDictionary<string, int> idToIndexMap = CreateIdToIndexMap(batchInput.Documents);
23772377

2378-
return new AnalyzeBatchActionsOperation(_serviceRestClient, _clientDiagnostics, _options.GetVersionString(), location, idToIndexMap, options.IncludeStatistics);
2378+
return new AnalyzeBatchActionsOperation(_serviceRestClient, _clientDiagnostics, location, idToIndexMap, options.IncludeStatistics);
23792379
}
23802380
catch (Exception e)
23812381
{
@@ -2419,7 +2419,7 @@ private async Task<AnalyzeBatchActionsOperation> StartAnalyzeBatchActionsAsync(M
24192419

24202420
IDictionary<string, int> idToIndexMap = CreateIdToIndexMap(batchInput.Documents);
24212421

2422-
return new AnalyzeBatchActionsOperation(_serviceRestClient, _clientDiagnostics, _options.GetVersionString(), location, idToIndexMap, options.IncludeStatistics);
2422+
return new AnalyzeBatchActionsOperation(_serviceRestClient, _clientDiagnostics, location, idToIndexMap, options.IncludeStatistics);
24232423
}
24242424
catch (Exception e)
24252425
{

sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsRestClient.cs

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)