@@ -22,8 +22,6 @@ public class TextAnalyticsClient
2222 internal readonly TextAnalyticsRestClient _serviceRestClient ;
2323 internal readonly ClientDiagnostics _clientDiagnostics ;
2424 private readonly TextAnalyticsClientOptions _options ;
25- private readonly string DefaultCognitiveScope = "https://cognitiveservices.azure.com/.default" ;
26- private const string AuthorizationHeader = "Ocp-Apim-Subscription-Key" ;
2725
2826 /// <summary>
2927 /// Protected constructor to allow mocking.
@@ -65,7 +63,7 @@ public TextAnalyticsClient(Uri endpoint, TokenCredential credential, TextAnalyti
6563 _clientDiagnostics = new TextAnalyticsClientDiagnostics ( options ) ;
6664 _options = options ;
6765
68- var pipeline = HttpPipelineBuilder . Build ( options , new BearerTokenAuthenticationPolicy ( credential , DefaultCognitiveScope ) ) ;
66+ var pipeline = HttpPipelineBuilder . Build ( options , new BearerTokenAuthenticationPolicy ( credential , Constants . DefaultCognitiveScope ) ) ;
6967 _serviceRestClient = new TextAnalyticsRestClient ( _clientDiagnostics , pipeline , endpoint . AbsoluteUri , TextAnalyticsClientOptions . GetVersionString ( options . Version ) ) ;
7068 }
7169
@@ -104,7 +102,7 @@ public TextAnalyticsClient(Uri endpoint, AzureKeyCredential credential, TextAnal
104102 _clientDiagnostics = new TextAnalyticsClientDiagnostics ( options ) ;
105103 _options = options ;
106104
107- var pipeline = HttpPipelineBuilder . Build ( options , new AzureKeyCredentialPolicy ( credential , AuthorizationHeader ) ) ;
105+ var pipeline = HttpPipelineBuilder . Build ( options , new AzureKeyCredentialPolicy ( credential , Constants . AuthorizationHeader ) ) ;
108106 _serviceRestClient = new TextAnalyticsRestClient ( _clientDiagnostics , pipeline , endpoint . AbsoluteUri , TextAnalyticsClientOptions . GetVersionString ( options . Version ) ) ;
109107 }
110108
@@ -433,7 +431,7 @@ public virtual async Task<Response<CategorizedEntityCollection>> RecognizeEntiti
433431
434432 Response < EntitiesResult > result = await _serviceRestClient . EntitiesRecognitionGeneralAsync (
435433 new MultiLanguageBatchInput ( documents ) ,
436- stringIndexType : StringIndexType . Utf16CodeUnit ,
434+ stringIndexType : Constants . DefaultStringIndexType ,
437435 cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
438436 Response response = result . GetRawResponse ( ) ;
439437
@@ -491,7 +489,7 @@ public virtual Response<CategorizedEntityCollection> RecognizeEntities(string do
491489
492490 Response < EntitiesResult > result = _serviceRestClient . EntitiesRecognitionGeneral (
493491 new MultiLanguageBatchInput ( documents ) ,
494- stringIndexType : StringIndexType . Utf16CodeUnit ,
492+ stringIndexType : Constants . DefaultStringIndexType ,
495493 cancellationToken : cancellationToken ) ;
496494 Response response = result . GetRawResponse ( ) ;
497495
@@ -819,7 +817,7 @@ private async Task<Response<RecognizeEntitiesResultCollection>> RecognizeEntitie
819817 options . ModelVersion ,
820818 options . IncludeStatistics ,
821819 options . DisableServiceLogs ,
822- options . StringIndexType ,
820+ Constants . DefaultStringIndexType ,
823821 cancellationToken ) . ConfigureAwait ( false ) ;
824822 var response = result . GetRawResponse ( ) ;
825823
@@ -846,7 +844,7 @@ private Response<RecognizeEntitiesResultCollection> RecognizeEntitiesBatch(Multi
846844 options . ModelVersion ,
847845 options . IncludeStatistics ,
848846 options . DisableServiceLogs ,
849- options . StringIndexType ,
847+ Constants . DefaultStringIndexType ,
850848 cancellationToken ) ;
851849 var response = result . GetRawResponse ( ) ;
852850
@@ -914,7 +912,7 @@ public virtual async Task<Response<PiiEntityCollection>> RecognizePiiEntitiesAsy
914912 options . IncludeStatistics ,
915913 options . DisableServiceLogs ,
916914 options . DomainFilter . GetString ( ) ,
917- options . StringIndexType ,
915+ Constants . DefaultStringIndexType ,
918916 options . CategoriesFilter . Count == 0 ? null : options . CategoriesFilter ,
919917 cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
920918 Response response = result . GetRawResponse ( ) ;
@@ -984,7 +982,7 @@ public virtual Response<PiiEntityCollection> RecognizePiiEntities(string documen
984982 options . IncludeStatistics ,
985983 options . DisableServiceLogs ,
986984 options . DomainFilter . GetString ( ) ,
987- options . StringIndexType ,
985+ Constants . DefaultStringIndexType ,
988986 options . CategoriesFilter . Count == 0 ? null : options . CategoriesFilter ,
989987 cancellationToken : cancellationToken ) ;
990988 Response response = result . GetRawResponse ( ) ;
@@ -1164,7 +1162,7 @@ private async Task<Response<RecognizePiiEntitiesResultCollection>> RecognizePiiE
11641162 options . IncludeStatistics ,
11651163 options . DisableServiceLogs ,
11661164 options . DomainFilter . GetString ( ) ,
1167- options . StringIndexType ,
1165+ Constants . DefaultStringIndexType ,
11681166 options . CategoriesFilter . Count == 0 ? null : options . CategoriesFilter ,
11691167 cancellationToken ) . ConfigureAwait ( false ) ;
11701168 var response = result . GetRawResponse ( ) ;
@@ -1193,7 +1191,7 @@ private Response<RecognizePiiEntitiesResultCollection> RecognizePiiEntitiesBatch
11931191 options . IncludeStatistics ,
11941192 options . DisableServiceLogs ,
11951193 options . DomainFilter . GetString ( ) ,
1196- options . StringIndexType ,
1194+ Constants . DefaultStringIndexType ,
11971195 options . CategoriesFilter . Count == 0 ? null : options . CategoriesFilter ,
11981196 cancellationToken ) ;
11991197 var response = result . GetRawResponse ( ) ;
@@ -1309,7 +1307,7 @@ public virtual async Task<Response<DocumentSentiment>> AnalyzeSentimentAsync(str
13091307 options . IncludeStatistics ,
13101308 options . DisableServiceLogs ,
13111309 options . IncludeOpinionMining ,
1312- options . StringIndexType ,
1310+ Constants . DefaultStringIndexType ,
13131311 cancellationToken ) . ConfigureAwait ( false ) ;
13141312 Response response = result . GetRawResponse ( ) ;
13151313
@@ -1370,7 +1368,7 @@ public virtual Response<DocumentSentiment> AnalyzeSentiment(string document, str
13701368 options . IncludeStatistics ,
13711369 options . DisableServiceLogs ,
13721370 options . IncludeOpinionMining ,
1373- options . StringIndexType ,
1371+ Constants . DefaultStringIndexType ,
13741372 cancellationToken ) ;
13751373 Response response = result . GetRawResponse ( ) ;
13761374
@@ -1647,7 +1645,7 @@ private async Task<Response<AnalyzeSentimentResultCollection>> AnalyzeSentimentB
16471645 options . IncludeStatistics ,
16481646 options . DisableServiceLogs ,
16491647 options . IncludeOpinionMining ,
1650- options . StringIndexType ,
1648+ Constants . DefaultStringIndexType ,
16511649 cancellationToken ) . ConfigureAwait ( false ) ;
16521650 var response = result . GetRawResponse ( ) ;
16531651
@@ -1675,7 +1673,7 @@ private Response<AnalyzeSentimentResultCollection> AnalyzeSentimentBatch(MultiLa
16751673 options . IncludeStatistics ,
16761674 options . DisableServiceLogs ,
16771675 options . IncludeOpinionMining ,
1678- options . StringIndexType ,
1676+ Constants . DefaultStringIndexType ,
16791677 cancellationToken ) ;
16801678 var response = result . GetRawResponse ( ) ;
16811679
@@ -2178,7 +2176,7 @@ public virtual async Task<Response<LinkedEntityCollection>> RecognizeLinkedEntit
21782176
21792177 Response < EntityLinkingResult > result = await _serviceRestClient . EntitiesLinkingAsync (
21802178 new MultiLanguageBatchInput ( documents ) ,
2181- stringIndexType : StringIndexType . Utf16CodeUnit ,
2179+ stringIndexType : Constants . DefaultStringIndexType ,
21822180 cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
21832181 Response response = result . GetRawResponse ( ) ;
21842182
@@ -2234,7 +2232,7 @@ public virtual Response<LinkedEntityCollection> RecognizeLinkedEntities(string d
22342232
22352233 Response < EntityLinkingResult > result = _serviceRestClient . EntitiesLinking (
22362234 new MultiLanguageBatchInput ( documents ) ,
2237- stringIndexType : StringIndexType . Utf16CodeUnit ,
2235+ stringIndexType : Constants . DefaultStringIndexType ,
22382236 cancellationToken : cancellationToken ) ;
22392237 Response response = result . GetRawResponse ( ) ;
22402238
@@ -2542,7 +2540,7 @@ private async Task<Response<RecognizeLinkedEntitiesResultCollection>> RecognizeL
25422540 options . ModelVersion ,
25432541 options . IncludeStatistics ,
25442542 options . DisableServiceLogs ,
2545- options . StringIndexType ,
2543+ Constants . DefaultStringIndexType ,
25462544 cancellationToken ) . ConfigureAwait ( false ) ;
25472545 var response = result . GetRawResponse ( ) ;
25482546
@@ -2568,7 +2566,7 @@ private Response<RecognizeLinkedEntitiesResultCollection> RecognizeLinkedEntitie
25682566 options . ModelVersion ,
25692567 options . IncludeStatistics ,
25702568 options . DisableServiceLogs ,
2571- options . StringIndexType ,
2569+ Constants . DefaultStringIndexType ,
25722570 cancellationToken ) ;
25732571 var response = result . GetRawResponse ( ) ;
25742572
@@ -2738,7 +2736,7 @@ private AnalyzeHealthcareEntitiesOperation StartAnalyzeHealthcareEntities(MultiL
27382736 ResponseWithHeaders < TextAnalyticsHealthHeaders > response = _serviceRestClient . Health (
27392737 batchInput ,
27402738 options . ModelVersion ,
2741- options . StringIndexType ,
2739+ Constants . DefaultStringIndexType ,
27422740 options . DisableServiceLogs ,
27432741 cancellationToken ) ;
27442742 string location = response . Headers . OperationLocation ;
@@ -2766,7 +2764,7 @@ private async Task<AnalyzeHealthcareEntitiesOperation> StartAnalyzeHealthcareEnt
27662764 ResponseWithHeaders < TextAnalyticsHealthHeaders > response = await _serviceRestClient . HealthAsync (
27672765 batchInput ,
27682766 options . ModelVersion ,
2769- options . StringIndexType ,
2767+ Constants . DefaultStringIndexType ,
27702768 options . DisableServiceLogs ,
27712769 cancellationToken ) . ConfigureAwait ( false ) ;
27722770 string location = response . Headers . OperationLocation ;
0 commit comments