From 0b8edf60637eafaeb0b37123300654eee22b85c9 Mon Sep 17 00:00:00 2001 From: Michal Materna Date: Tue, 5 Mar 2024 09:55:57 -0800 Subject: [PATCH] [Text Translation] Update clientRequestId parameter type to System.Guid (#42238) * [Text Translation] Update type of clientTraceId to Guid * Suppress the clientTraceId of type string methods * Fix build --------- Co-authored-by: Michal Materna --- ...zure.AI.Translation.Text.netstandard2.0.cs | 42 +++--- .../src/Custom/TextTranslationClient.cs | 123 +++++++++++------- .../Custom/TextTranslationTranslateOptions.cs | 6 +- .../TextTranslationTransliterateOptions.cs | 7 +- .../tsp-location.yaml | 2 +- 5 files changed, 107 insertions(+), 73 deletions(-) diff --git a/sdk/translation/Azure.AI.Translation.Text/api/Azure.AI.Translation.Text.netstandard2.0.cs b/sdk/translation/Azure.AI.Translation.Text/api/Azure.AI.Translation.Text.netstandard2.0.cs index 961ee5132bfdf..28e382cb5d0de 100644 --- a/sdk/translation/Azure.AI.Translation.Text/api/Azure.AI.Translation.Text.netstandard2.0.cs +++ b/sdk/translation/Azure.AI.Translation.Text/api/Azure.AI.Translation.Text.netstandard2.0.cs @@ -257,35 +257,35 @@ public TextTranslationClient(Azure.Core.TokenCredential credential, System.Uri e protected TextTranslationClient(System.Uri endpoint) { } protected TextTranslationClient(System.Uri endpoint, Azure.AI.Translation.Text.TextTranslationClientOptions options) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response> FindSentenceBoundaries(System.Collections.Generic.IEnumerable content, string clientTraceId = null, string language = null, string script = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response> FindSentenceBoundaries(string text, string clientTraceId = null, string language = null, string script = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> FindSentenceBoundariesAsync(System.Collections.Generic.IEnumerable content, string clientTraceId = null, string language = null, string script = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> FindSentenceBoundariesAsync(string text, string clientTraceId = null, string language = null, string script = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response> FindSentenceBoundaries(System.Collections.Generic.IEnumerable content, System.Guid clientTraceId = default(System.Guid), string language = null, string script = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response> FindSentenceBoundaries(string text, System.Guid clientTraceId = default(System.Guid), string language = null, string script = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task>> FindSentenceBoundariesAsync(System.Collections.Generic.IEnumerable content, System.Guid clientTraceId = default(System.Guid), string language = null, string script = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task>> FindSentenceBoundariesAsync(string text, System.Guid clientTraceId = default(System.Guid), string language = null, string script = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetLanguages(string clientTraceId, string scope, string acceptLanguage, Azure.ETag? ifNoneMatch, Azure.RequestContext context) { throw null; } public virtual Azure.Response GetLanguages(string clientTraceId = null, string scope = null, string acceptLanguage = null, Azure.ETag? ifNoneMatch = default(Azure.ETag?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetLanguagesAsync(string clientTraceId, string scope, string acceptLanguage, Azure.ETag? ifNoneMatch, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> GetLanguagesAsync(string clientTraceId = null, string scope = null, string acceptLanguage = null, Azure.ETag? ifNoneMatch = default(Azure.ETag?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response> LookupDictionaryEntries(string from, string to, System.Collections.Generic.IEnumerable words, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response> LookupDictionaryEntries(string from, string to, string word, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> LookupDictionaryEntriesAsync(string from, string to, System.Collections.Generic.IEnumerable words, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> LookupDictionaryEntriesAsync(string from, string to, string word, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response> LookupDictionaryExamples(string from, string to, Azure.AI.Translation.Text.InputTextWithTranslation content, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response> LookupDictionaryExamples(string from, string to, System.Collections.Generic.IEnumerable content, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> LookupDictionaryExamplesAsync(string from, string to, Azure.AI.Translation.Text.InputTextWithTranslation content, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> LookupDictionaryExamplesAsync(string from, string to, System.Collections.Generic.IEnumerable content, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response> LookupDictionaryEntries(string from, string to, System.Collections.Generic.IEnumerable words, System.Guid clientTraceId = default(System.Guid), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response> LookupDictionaryEntries(string from, string to, string word, System.Guid clientTraceId = default(System.Guid), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task>> LookupDictionaryEntriesAsync(string from, string to, System.Collections.Generic.IEnumerable words, System.Guid clientTraceId = default(System.Guid), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task>> LookupDictionaryEntriesAsync(string from, string to, string word, System.Guid clientTraceId = default(System.Guid), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response> LookupDictionaryExamples(string from, string to, Azure.AI.Translation.Text.InputTextWithTranslation content, System.Guid clientTraceId = default(System.Guid), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response> LookupDictionaryExamples(string from, string to, System.Collections.Generic.IEnumerable content, System.Guid clientTraceId = default(System.Guid), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task>> LookupDictionaryExamplesAsync(string from, string to, Azure.AI.Translation.Text.InputTextWithTranslation content, System.Guid clientTraceId = default(System.Guid), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task>> LookupDictionaryExamplesAsync(string from, string to, System.Collections.Generic.IEnumerable content, System.Guid clientTraceId = default(System.Guid), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response> Translate(Azure.AI.Translation.Text.TextTranslationTranslateOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response> Translate(System.Collections.Generic.IEnumerable targetLanguages, System.Collections.Generic.IEnumerable content, string clientTraceId = null, string sourceLanguage = null, Azure.AI.Translation.Text.TextType? textType = default(Azure.AI.Translation.Text.TextType?), string category = null, Azure.AI.Translation.Text.ProfanityAction? profanityAction = default(Azure.AI.Translation.Text.ProfanityAction?), Azure.AI.Translation.Text.ProfanityMarker? profanityMarker = default(Azure.AI.Translation.Text.ProfanityMarker?), bool? includeAlignment = default(bool?), bool? includeSentenceLength = default(bool?), string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response> Translate(System.Collections.Generic.IEnumerable targetLanguages, System.Collections.Generic.IEnumerable content, System.Guid clientTraceId = default(System.Guid), string sourceLanguage = null, Azure.AI.Translation.Text.TextType? textType = default(Azure.AI.Translation.Text.TextType?), string category = null, Azure.AI.Translation.Text.ProfanityAction? profanityAction = default(Azure.AI.Translation.Text.ProfanityAction?), Azure.AI.Translation.Text.ProfanityMarker? profanityMarker = default(Azure.AI.Translation.Text.ProfanityMarker?), bool? includeAlignment = default(bool?), bool? includeSentenceLength = default(bool?), string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response> Translate(string targetLanguage, System.Collections.Generic.IEnumerable content, string sourceLanguage = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response> Translate(string targetLanguage, string text, string sourceLanguage = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> TranslateAsync(Azure.AI.Translation.Text.TextTranslationTranslateOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> TranslateAsync(System.Collections.Generic.IEnumerable targetLanguages, System.Collections.Generic.IEnumerable content, string clientTraceId = null, string sourceLanguage = null, Azure.AI.Translation.Text.TextType? textType = default(Azure.AI.Translation.Text.TextType?), string category = null, Azure.AI.Translation.Text.ProfanityAction? profanityAction = default(Azure.AI.Translation.Text.ProfanityAction?), Azure.AI.Translation.Text.ProfanityMarker? profanityMarker = default(Azure.AI.Translation.Text.ProfanityMarker?), bool? includeAlignment = default(bool?), bool? includeSentenceLength = default(bool?), string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task>> TranslateAsync(System.Collections.Generic.IEnumerable targetLanguages, System.Collections.Generic.IEnumerable content, System.Guid clientTraceId = default(System.Guid), string sourceLanguage = null, Azure.AI.Translation.Text.TextType? textType = default(Azure.AI.Translation.Text.TextType?), string category = null, Azure.AI.Translation.Text.ProfanityAction? profanityAction = default(Azure.AI.Translation.Text.ProfanityAction?), Azure.AI.Translation.Text.ProfanityMarker? profanityMarker = default(Azure.AI.Translation.Text.ProfanityMarker?), bool? includeAlignment = default(bool?), bool? includeSentenceLength = default(bool?), string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> TranslateAsync(string targetLanguage, System.Collections.Generic.IEnumerable content, string sourceLanguage = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> TranslateAsync(string targetLanguage, string text, string sourceLanguage = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response> Transliterate(Azure.AI.Translation.Text.TextTranslationTransliterateOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response> Transliterate(string language, string fromScript, string toScript, System.Collections.Generic.IEnumerable content, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response> Transliterate(string language, string fromScript, string toScript, System.Collections.Generic.IEnumerable content, System.Guid clientTraceId = default(System.Guid), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response> Transliterate(string language, string fromScript, string toScript, string text, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> TransliterateAsync(Azure.AI.Translation.Text.TextTranslationTransliterateOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> TransliterateAsync(string language, string fromScript, string toScript, System.Collections.Generic.IEnumerable content, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task>> TransliterateAsync(string language, string fromScript, string toScript, System.Collections.Generic.IEnumerable content, System.Guid clientTraceId = default(System.Guid), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> TransliterateAsync(string language, string fromScript, string toScript, string text, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class TextTranslationClientOptions : Azure.Core.ClientOptions @@ -299,11 +299,11 @@ public enum ServiceVersion public partial class TextTranslationTranslateOptions { public TextTranslationTranslateOptions(System.Collections.Generic.IEnumerable targetLanguages, System.Collections.Generic.IEnumerable content) { } - public TextTranslationTranslateOptions(System.Collections.Generic.IEnumerable targetLanguages, System.Collections.Generic.IEnumerable content, string clientTraceId = null, string sourceLanguage = null, Azure.AI.Translation.Text.TextType? textType = default(Azure.AI.Translation.Text.TextType?), string category = null, Azure.AI.Translation.Text.ProfanityAction? profanityAction = default(Azure.AI.Translation.Text.ProfanityAction?), Azure.AI.Translation.Text.ProfanityMarker? profanityMarker = default(Azure.AI.Translation.Text.ProfanityMarker?), bool? includeAlignment = default(bool?), bool? includeSentenceLength = default(bool?), string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = default(bool?)) { } + public TextTranslationTranslateOptions(System.Collections.Generic.IEnumerable targetLanguages, System.Collections.Generic.IEnumerable content, System.Guid clientTraceId = default(System.Guid), string sourceLanguage = null, Azure.AI.Translation.Text.TextType? textType = default(Azure.AI.Translation.Text.TextType?), string category = null, Azure.AI.Translation.Text.ProfanityAction? profanityAction = default(Azure.AI.Translation.Text.ProfanityAction?), Azure.AI.Translation.Text.ProfanityMarker? profanityMarker = default(Azure.AI.Translation.Text.ProfanityMarker?), bool? includeAlignment = default(bool?), bool? includeSentenceLength = default(bool?), string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = default(bool?)) { } public TextTranslationTranslateOptions(string targetLanguage, string content) { } public bool? AllowFallback { get { throw null; } set { } } public string Category { get { throw null; } set { } } - public string ClientTraceId { get { throw null; } set { } } + public System.Guid ClientTraceId { get { throw null; } set { } } public System.Collections.Generic.IEnumerable Content { get { throw null; } } public string FromScript { get { throw null; } set { } } public bool? IncludeAlignment { get { throw null; } set { } } @@ -318,9 +318,9 @@ public TextTranslationTranslateOptions(string targetLanguage, string content) { } public partial class TextTranslationTransliterateOptions { - public TextTranslationTransliterateOptions(string language, string fromScript, string toScript, System.Collections.Generic.IEnumerable content, string clientTraceId = null) { } - public TextTranslationTransliterateOptions(string language, string fromScript, string toScript, string content, string clientTraceId = null) { } - public string ClientTraceId { get { throw null; } set { } } + public TextTranslationTransliterateOptions(string language, string fromScript, string toScript, System.Collections.Generic.IEnumerable content, System.Guid clientTraceId = default(System.Guid)) { } + public TextTranslationTransliterateOptions(string language, string fromScript, string toScript, string content, System.Guid clientTraceId = default(System.Guid)) { } + public System.Guid ClientTraceId { get { throw null; } set { } } public System.Collections.Generic.IEnumerable Content { get { throw null; } } public string FromScript { get { throw null; } } public string Language { get { throw null; } } diff --git a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClient.cs b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClient.cs index c5d0d908eb7cc..fa15173ba1eb6 100644 --- a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClient.cs +++ b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClient.cs @@ -14,6 +14,27 @@ namespace Azure.AI.Translation.Text { /// The Translator service client. + // Methods are replaced by the version where clientTraceId parameter is of type System.Guid + [CodeGenSuppress("TranslateAsync", typeof(IEnumerable), typeof(IEnumerable), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(bool?), typeof(bool?), typeof(string), typeof(string), typeof(string), typeof(bool?), typeof(CancellationToken))] + [CodeGenSuppress("Translate", typeof(IEnumerable), typeof(IEnumerable), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(bool?), typeof(bool?), typeof(string), typeof(string), typeof(string), typeof(bool?), typeof(CancellationToken))] + [CodeGenSuppress("TranslateAsync", typeof(IEnumerable), typeof(RequestContent), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(bool?), typeof(bool?), typeof(string), typeof(string), typeof(string), typeof(bool?), typeof(RequestContext))] + [CodeGenSuppress("Translate", typeof(IEnumerable), typeof(RequestContent), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(bool?), typeof(bool?), typeof(string), typeof(string), typeof(string), typeof(bool?), typeof(RequestContext))] + [CodeGenSuppress("TransliterateAsync", typeof(string), typeof(string), typeof(string), typeof(IEnumerable), typeof(string), typeof(CancellationToken))] + [CodeGenSuppress("Transliterate", typeof(string), typeof(string), typeof(string), typeof(IEnumerable), typeof(string), typeof(CancellationToken))] + [CodeGenSuppress("TransliterateAsync", typeof(string), typeof(string), typeof(string), typeof(RequestContent), typeof(string), typeof(RequestContext))] + [CodeGenSuppress("Transliterate", typeof(string), typeof(string), typeof(string), typeof(RequestContent), typeof(string), typeof(RequestContext))] + [CodeGenSuppress("FindSentenceBoundariesAsync", typeof(IEnumerable), typeof(string), typeof(string), typeof(string), typeof(CancellationToken))] + [CodeGenSuppress("FindSentenceBoundaries", typeof(IEnumerable), typeof(string), typeof(string), typeof(string), typeof(CancellationToken))] + [CodeGenSuppress("FindSentenceBoundariesAsync", typeof(RequestContent), typeof(string), typeof(string), typeof(string), typeof(RequestContext))] + [CodeGenSuppress("FindSentenceBoundaries", typeof(RequestContent), typeof(string), typeof(string), typeof(string), typeof(RequestContext))] + [CodeGenSuppress("LookupDictionaryEntriesAsync", typeof(string), typeof(string), typeof(IEnumerable), typeof(string), typeof(CancellationToken))] + [CodeGenSuppress("LookupDictionaryEntries", typeof(string), typeof(string), typeof(IEnumerable), typeof(string), typeof(CancellationToken))] + [CodeGenSuppress("LookupDictionaryEntriesAsync", typeof(string), typeof(string), typeof(RequestContent), typeof(string), typeof(RequestContext))] + [CodeGenSuppress("LookupDictionaryEntries", typeof(string), typeof(string), typeof(RequestContent), typeof(string), typeof(RequestContext))] + [CodeGenSuppress("LookupDictionaryExamplesAsync", typeof(string), typeof(string), typeof(IEnumerable), typeof(string), typeof(CancellationToken))] + [CodeGenSuppress("LookupDictionaryExamples", typeof(string), typeof(string), typeof(IEnumerable), typeof(string), typeof(CancellationToken))] + [CodeGenSuppress("LookupDictionaryExamplesAsync", typeof(string), typeof(string), typeof(RequestContent), typeof(string), typeof(RequestContext))] + [CodeGenSuppress("LookupDictionaryExamples", typeof(string), typeof(string), typeof(RequestContent), typeof(string), typeof(RequestContext))] public partial class TextTranslationClient { private const string KEY_HEADER_NAME = "Ocp-Apim-Subscription-Key"; @@ -179,7 +200,7 @@ public TextTranslationClient(TokenCredential credential, Uri endpoint, TextTrans /// /// The cancellation token to use. /// or is null. - public virtual Task>> TranslateAsync(IEnumerable targetLanguages, IEnumerable content, string clientTraceId = null, string sourceLanguage = null, TextType? textType = null, string category = null, ProfanityAction? profanityAction = null, ProfanityMarker? profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, CancellationToken cancellationToken = default) + public virtual Task>> TranslateAsync(IEnumerable targetLanguages, IEnumerable content, Guid clientTraceId = default, string sourceLanguage = null, TextType? textType = null, string category = null, ProfanityAction? profanityAction = null, ProfanityMarker? profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(targetLanguages, nameof(targetLanguages)); Argument.AssertNotNull(content, nameof(content)); @@ -311,7 +332,7 @@ public virtual Task>> TranslateAsync( /// /// The cancellation token to use. /// or is null. - public virtual Response> Translate(IEnumerable targetLanguages, IEnumerable content, string clientTraceId = null, string sourceLanguage = null, TextType? textType = null, string category = null, ProfanityAction? profanityAction = null, ProfanityMarker? profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, CancellationToken cancellationToken = default) + public virtual Response> Translate(IEnumerable targetLanguages, IEnumerable content, Guid clientTraceId = default, string sourceLanguage = null, TextType? textType = null, string category = null, ProfanityAction? profanityAction = null, ProfanityMarker? profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(targetLanguages, nameof(targetLanguages)); Argument.AssertNotNull(content, nameof(content)); @@ -400,7 +421,7 @@ public virtual Response> Translate(string targ /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , , or is null. - public virtual Task>> TransliterateAsync(string language, string fromScript, string toScript, IEnumerable content, string clientTraceId = null, CancellationToken cancellationToken = default) + public virtual Task>> TransliterateAsync(string language, string fromScript, string toScript, IEnumerable content, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(language, nameof(language)); Argument.AssertNotNull(fromScript, nameof(fromScript)); @@ -466,7 +487,7 @@ public virtual Task>> TransliterateAs /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , , or is null. - public virtual Response> Transliterate(string language, string fromScript, string toScript, IEnumerable content, string clientTraceId = null, CancellationToken cancellationToken = default) + public virtual Response> Transliterate(string language, string fromScript, string toScript, IEnumerable content, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(language, nameof(language)); Argument.AssertNotNull(fromScript, nameof(fromScript)); @@ -527,7 +548,7 @@ public virtual Response> Transliterate(string /// /// The cancellation token to use. /// is null. - public virtual Task>> FindSentenceBoundariesAsync(IEnumerable content, string clientTraceId = null, string language = null, string script = null, CancellationToken cancellationToken = default) + public virtual Task>> FindSentenceBoundariesAsync(IEnumerable content, Guid clientTraceId = default, string language = null, string script = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); @@ -547,7 +568,7 @@ public virtual Task>> FindSentenceBoun /// /// The cancellation token to use. /// is null. - public virtual Task>> FindSentenceBoundariesAsync(string text, string clientTraceId = null, string language = null, string script = null, CancellationToken cancellationToken = default) + public virtual Task>> FindSentenceBoundariesAsync(string text, Guid clientTraceId = default, string language = null, string script = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(text, nameof(text)); @@ -567,7 +588,7 @@ public virtual Task>> FindSentenceBoun /// /// The cancellation token to use. /// is null. - public virtual Response> FindSentenceBoundaries(IEnumerable content, string clientTraceId = null, string language = null, string script = null, CancellationToken cancellationToken = default) + public virtual Response> FindSentenceBoundaries(IEnumerable content, Guid clientTraceId = default, string language = null, string script = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); @@ -587,7 +608,7 @@ public virtual Response> FindSentenceBoundaries /// /// The cancellation token to use. /// is null. - public virtual Response> FindSentenceBoundaries(string text, string clientTraceId = null, string language = null, string script = null, CancellationToken cancellationToken = default) + public virtual Response> FindSentenceBoundaries(string text, Guid clientTraceId = default, string language = null, string script = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(text, nameof(text)); @@ -607,7 +628,7 @@ public virtual Response> FindSentenceBoundaries /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , or is null. - public virtual Task>> LookupDictionaryEntriesAsync(string @from, string to, IEnumerable words, string clientTraceId = null, CancellationToken cancellationToken = default) + public virtual Task>> LookupDictionaryEntriesAsync(string @from, string to, IEnumerable words, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -629,7 +650,7 @@ public virtual Task>> LookupDiction /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , or is null. - public virtual Task>> LookupDictionaryEntriesAsync(string @from, string to, string word, string clientTraceId = null, CancellationToken cancellationToken = default) + public virtual Task>> LookupDictionaryEntriesAsync(string @from, string to, string word, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -651,7 +672,7 @@ public virtual Task>> LookupDiction /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , or is null. - public virtual Response> LookupDictionaryEntries(string @from, string to, IEnumerable words, string clientTraceId = null, CancellationToken cancellationToken = default) + public virtual Response> LookupDictionaryEntries(string @from, string to, IEnumerable words, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -673,7 +694,7 @@ public virtual Response> LookupDictionaryEnt /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , or is null. - public virtual Response> LookupDictionaryEntries(string @from, string to, string word, string clientTraceId = null, CancellationToken cancellationToken = default) + public virtual Response> LookupDictionaryEntries(string @from, string to, string word, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -695,7 +716,7 @@ public virtual Response> LookupDictionaryEnt /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , or is null. - public virtual Task>> LookupDictionaryExamplesAsync(string @from, string to, IEnumerable content, string clientTraceId = null, CancellationToken cancellationToken = default) + public virtual Task>> LookupDictionaryExamplesAsync(string @from, string to, IEnumerable content, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -717,7 +738,7 @@ public virtual Task>> LookupDictio /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , or is null. - public virtual Task>> LookupDictionaryExamplesAsync(string @from, string to, InputTextWithTranslation content, string clientTraceId = null, CancellationToken cancellationToken = default) + public virtual Task>> LookupDictionaryExamplesAsync(string @from, string to, InputTextWithTranslation content, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -739,7 +760,7 @@ public virtual Task>> LookupDictio /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , or is null. - public virtual Response> LookupDictionaryExamples(string @from, string to, IEnumerable content, string clientTraceId = null, CancellationToken cancellationToken = default) + public virtual Response> LookupDictionaryExamples(string @from, string to, IEnumerable content, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -761,7 +782,7 @@ public virtual Response> LookupDictionaryEx /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , or is null. - public virtual Response> LookupDictionaryExamples(string @from, string to, InputTextWithTranslation content, string clientTraceId = null, CancellationToken cancellationToken = default) + public virtual Response> LookupDictionaryExamples(string @from, string to, InputTextWithTranslation content, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -831,7 +852,7 @@ public virtual Response> LookupDictionaryEx /// /// The cancellation token to use. /// or is null. - internal virtual async Task>> TranslateAsync(IEnumerable to, IEnumerable requestBody, string clientTraceId = null, string @from = null, string textType = null, string category = null, string profanityAction = null, string profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, CancellationToken cancellationToken = default) + internal virtual async Task>> TranslateAsync(IEnumerable to, IEnumerable requestBody, Guid clientTraceId = default, string @from = null, string textType = null, string category = null, string profanityAction = null, string profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(to, nameof(to)); Argument.AssertNotNull(requestBody, nameof(requestBody)); @@ -910,7 +931,7 @@ internal virtual async Task>> Transla /// /// The cancellation token to use. /// or is null. - internal virtual Response> Translate(IEnumerable to, IEnumerable requestBody, string clientTraceId = null, string @from = null, string textType = null, string category = null, string profanityAction = null, string profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, CancellationToken cancellationToken = default) + internal virtual Response> Translate(IEnumerable to, IEnumerable requestBody, Guid clientTraceId = default, string @from = null, string textType = null, string category = null, string profanityAction = null, string profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(to, nameof(to)); Argument.AssertNotNull(requestBody, nameof(requestBody)); @@ -991,7 +1012,7 @@ internal virtual Response> Translate(IEnumerab /// or is null. /// Service returned a non-success status code. /// The response returned from the service. Details of the response body schema are in the Remarks section below. - internal virtual async Task TranslateAsync(IEnumerable to, RequestContent content, string clientTraceId = null, string @from = null, string textType = null, string category = null, string profanityAction = null, string profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, RequestContext context = null) + internal virtual async Task TranslateAsync(IEnumerable to, RequestContent content, Guid clientTraceId = default, string @from = null, string textType = null, string category = null, string profanityAction = null, string profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, RequestContext context = null) { Argument.AssertNotNull(to, nameof(to)); Argument.AssertNotNull(content, nameof(content)); @@ -1000,7 +1021,7 @@ internal virtual async Task TranslateAsync(IEnumerable to, Req scope.Start(); try { - using HttpMessage message = CreateTranslateRequest(to, content, clientTraceId, @from, textType, category, profanityAction, profanityMarker, includeAlignment, includeSentenceLength, suggestedFrom, fromScript, toScript, allowFallback, context); + using HttpMessage message = CreateTranslateRequest(to, content, GetClientTraceId(clientTraceId), @from, textType, category, profanityAction, profanityMarker, includeAlignment, includeSentenceLength, suggestedFrom, fromScript, toScript, allowFallback, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1073,7 +1094,7 @@ internal virtual async Task TranslateAsync(IEnumerable to, Req /// or is null. /// Service returned a non-success status code. /// The response returned from the service. Details of the response body schema are in the Remarks section below. - internal virtual Response Translate(IEnumerable to, RequestContent content, string clientTraceId = null, string @from = null, string textType = null, string category = null, string profanityAction = null, string profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, RequestContext context = null) + internal virtual Response Translate(IEnumerable to, RequestContent content, Guid clientTraceId = default, string @from = null, string textType = null, string category = null, string profanityAction = null, string profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, RequestContext context = null) { Argument.AssertNotNull(to, nameof(to)); Argument.AssertNotNull(content, nameof(content)); @@ -1082,7 +1103,7 @@ internal virtual Response Translate(IEnumerable to, RequestContent conte scope.Start(); try { - using HttpMessage message = CreateTranslateRequest(to, content, clientTraceId, @from, textType, category, profanityAction, profanityMarker, includeAlignment, includeSentenceLength, suggestedFrom, fromScript, toScript, allowFallback, context); + using HttpMessage message = CreateTranslateRequest(to, content, GetClientTraceId(clientTraceId), @from, textType, category, profanityAction, profanityMarker, includeAlignment, includeSentenceLength, suggestedFrom, fromScript, toScript, allowFallback, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1110,7 +1131,7 @@ internal virtual Response Translate(IEnumerable to, RequestContent conte /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , , or is null. - internal virtual async Task>> TransliterateAsync(string language, string fromScript, string toScript, IEnumerable requestBody, string clientTraceId = null, CancellationToken cancellationToken = default) + internal virtual async Task>> TransliterateAsync(string language, string fromScript, string toScript, IEnumerable requestBody, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(language, nameof(language)); Argument.AssertNotNull(fromScript, nameof(fromScript)); @@ -1148,7 +1169,7 @@ internal virtual async Task>> Transli /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , , or is null. - internal virtual Response> Transliterate(string language, string fromScript, string toScript, IEnumerable requestBody, string clientTraceId = null, CancellationToken cancellationToken = default) + internal virtual Response> Transliterate(string language, string fromScript, string toScript, IEnumerable requestBody, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(language, nameof(language)); Argument.AssertNotNull(fromScript, nameof(fromScript)); @@ -1188,7 +1209,7 @@ internal virtual Response> Transliterate(strin /// , , or is null. /// Service returned a non-success status code. /// The response returned from the service. Details of the response body schema are in the Remarks section below. - internal virtual async Task TransliterateAsync(string language, string fromScript, string toScript, RequestContent content, string clientTraceId = null, RequestContext context = null) + internal virtual async Task TransliterateAsync(string language, string fromScript, string toScript, RequestContent content, Guid clientTraceId = default, RequestContext context = null) { Argument.AssertNotNull(language, nameof(language)); Argument.AssertNotNull(fromScript, nameof(fromScript)); @@ -1199,7 +1220,7 @@ internal virtual async Task TransliterateAsync(string language, string scope.Start(); try { - using HttpMessage message = CreateTransliterateRequest(language, fromScript, toScript, content, clientTraceId, context); + using HttpMessage message = CreateTransliterateRequest(language, fromScript, toScript, content, GetClientTraceId(clientTraceId), context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1229,7 +1250,7 @@ internal virtual async Task TransliterateAsync(string language, string /// , , or is null. /// Service returned a non-success status code. /// The response returned from the service. Details of the response body schema are in the Remarks section below. - internal virtual Response Transliterate(string language, string fromScript, string toScript, RequestContent content, string clientTraceId = null, RequestContext context = null) + internal virtual Response Transliterate(string language, string fromScript, string toScript, RequestContent content, Guid clientTraceId = default, RequestContext context = null) { Argument.AssertNotNull(language, nameof(language)); Argument.AssertNotNull(fromScript, nameof(fromScript)); @@ -1240,7 +1261,7 @@ internal virtual Response Transliterate(string language, string fromScript, stri scope.Start(); try { - using HttpMessage message = CreateTransliterateRequest(language, fromScript, toScript, content, clientTraceId, context); + using HttpMessage message = CreateTransliterateRequest(language, fromScript, toScript, content, GetClientTraceId(clientTraceId), context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1263,7 +1284,7 @@ internal virtual Response Transliterate(string language, string fromScript, stri /// /// The cancellation token to use. /// is null. - internal virtual async Task>> FindSentenceBoundariesAsync(IEnumerable requestBody, string clientTraceId = null, string language = null, string script = null, CancellationToken cancellationToken = default) + internal virtual async Task>> FindSentenceBoundariesAsync(IEnumerable requestBody, Guid clientTraceId = default, string language = null, string script = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(requestBody, nameof(requestBody)); @@ -1293,7 +1314,7 @@ internal virtual async Task>> FindSent /// /// The cancellation token to use. /// is null. - internal virtual Response> FindSentenceBoundaries(IEnumerable requestBody, string clientTraceId = null, string language = null, string script = null, CancellationToken cancellationToken = default) + internal virtual Response> FindSentenceBoundaries(IEnumerable requestBody, Guid clientTraceId = default, string language = null, string script = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(requestBody, nameof(requestBody)); @@ -1325,7 +1346,7 @@ internal virtual Response> FindSentenceBoundari /// is null. /// Service returned a non-success status code. /// The response returned from the service. Details of the response body schema are in the Remarks section below. - internal virtual async Task FindSentenceBoundariesAsync(RequestContent content, string clientTraceId = null, string language = null, string script = null, RequestContext context = null) + internal virtual async Task FindSentenceBoundariesAsync(RequestContent content, Guid clientTraceId = default, string language = null, string script = null, RequestContext context = null) { Argument.AssertNotNull(content, nameof(content)); @@ -1333,7 +1354,7 @@ internal virtual async Task FindSentenceBoundariesAsync(RequestContent scope.Start(); try { - using HttpMessage message = CreateFindSentenceBoundariesRequest(content, clientTraceId, language, script, context); + using HttpMessage message = CreateFindSentenceBoundariesRequest(content, GetClientTraceId(clientTraceId), language, script, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1358,7 +1379,7 @@ internal virtual async Task FindSentenceBoundariesAsync(RequestContent /// is null. /// Service returned a non-success status code. /// The response returned from the service. Details of the response body schema are in the Remarks section below. - internal virtual Response FindSentenceBoundaries(RequestContent content, string clientTraceId = null, string language = null, string script = null, RequestContext context = null) + internal virtual Response FindSentenceBoundaries(RequestContent content, Guid clientTraceId = default, string language = null, string script = null, RequestContext context = null) { Argument.AssertNotNull(content, nameof(content)); @@ -1366,7 +1387,7 @@ internal virtual Response FindSentenceBoundaries(RequestContent content, string scope.Start(); try { - using HttpMessage message = CreateFindSentenceBoundariesRequest(content, clientTraceId, language, script, context); + using HttpMessage message = CreateFindSentenceBoundariesRequest(content, GetClientTraceId(clientTraceId), language, script, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1389,7 +1410,7 @@ internal virtual Response FindSentenceBoundaries(RequestContent content, string /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , or is null. - internal virtual async Task>> LookupDictionaryEntriesAsync(string @from, string to, IEnumerable requestBody, string clientTraceId = null, CancellationToken cancellationToken = default) + internal virtual async Task>> LookupDictionaryEntriesAsync(string @from, string to, IEnumerable requestBody, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -1421,7 +1442,7 @@ internal virtual async Task>> Looku /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , or is null. - internal virtual Response> LookupDictionaryEntries(string @from, string to, IEnumerable requestBody, string clientTraceId = null, CancellationToken cancellationToken = default) + internal virtual Response> LookupDictionaryEntries(string @from, string to, IEnumerable requestBody, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -1455,7 +1476,7 @@ internal virtual Response> LookupDictionaryE /// , or is null. /// Service returned a non-success status code. /// The response returned from the service. Details of the response body schema are in the Remarks section below. - internal virtual async Task LookupDictionaryEntriesAsync(string @from, string to, RequestContent content, string clientTraceId = null, RequestContext context = null) + internal virtual async Task LookupDictionaryEntriesAsync(string @from, string to, RequestContent content, Guid clientTraceId = default, RequestContext context = null) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -1465,7 +1486,7 @@ internal virtual async Task LookupDictionaryEntriesAsync(string @from, scope.Start(); try { - using HttpMessage message = CreateLookupDictionaryEntriesRequest(@from, to, content, clientTraceId, context); + using HttpMessage message = CreateLookupDictionaryEntriesRequest(@from, to, content, GetClientTraceId(clientTraceId), context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1490,7 +1511,7 @@ internal virtual async Task LookupDictionaryEntriesAsync(string @from, /// , or is null. /// Service returned a non-success status code. /// The response returned from the service. Details of the response body schema are in the Remarks section below. - internal virtual Response LookupDictionaryEntries(string @from, string to, RequestContent content, string clientTraceId = null, RequestContext context = null) + internal virtual Response LookupDictionaryEntries(string @from, string to, RequestContent content, Guid clientTraceId = default, RequestContext context = null) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -1500,7 +1521,7 @@ internal virtual Response LookupDictionaryEntries(string @from, string to, Reque scope.Start(); try { - using HttpMessage message = CreateLookupDictionaryEntriesRequest(@from, to, content, clientTraceId, context); + using HttpMessage message = CreateLookupDictionaryEntriesRequest(@from, to, content, GetClientTraceId(clientTraceId), context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1523,7 +1544,7 @@ internal virtual Response LookupDictionaryEntries(string @from, string to, Reque /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , or is null. - internal virtual async Task>> LookupDictionaryExamplesAsync(string @from, string to, IEnumerable requestBody, string clientTraceId = null, CancellationToken cancellationToken = default) + internal virtual async Task>> LookupDictionaryExamplesAsync(string @from, string to, IEnumerable requestBody, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -1555,7 +1576,7 @@ internal virtual async Task>> Look /// A client-generated GUID to uniquely identify the request. /// The cancellation token to use. /// , or is null. - internal virtual Response> LookupDictionaryExamples(string @from, string to, IEnumerable requestBody, string clientTraceId = null, CancellationToken cancellationToken = default) + internal virtual Response> LookupDictionaryExamples(string @from, string to, IEnumerable requestBody, Guid clientTraceId = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -1589,7 +1610,7 @@ internal virtual Response> LookupDictionary /// , or is null. /// Service returned a non-success status code. /// The response returned from the service. Details of the response body schema are in the Remarks section below. - internal virtual async Task LookupDictionaryExamplesAsync(string @from, string to, RequestContent content, string clientTraceId = null, RequestContext context = null) + internal virtual async Task LookupDictionaryExamplesAsync(string @from, string to, RequestContent content, Guid clientTraceId = default, RequestContext context = null) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -1599,7 +1620,7 @@ internal virtual async Task LookupDictionaryExamplesAsync(string @from scope.Start(); try { - using HttpMessage message = CreateLookupDictionaryExamplesRequest(@from, to, content, clientTraceId, context); + using HttpMessage message = CreateLookupDictionaryExamplesRequest(@from, to, content, GetClientTraceId(clientTraceId), context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1624,7 +1645,7 @@ internal virtual async Task LookupDictionaryExamplesAsync(string @from /// , or is null. /// Service returned a non-success status code. /// The response returned from the service. Details of the response body schema are in the Remarks section below. - internal virtual Response LookupDictionaryExamples(string @from, string to, RequestContent content, string clientTraceId = null, RequestContext context = null) + internal virtual Response LookupDictionaryExamples(string @from, string to, RequestContent content, Guid clientTraceId = default, RequestContext context = null) { Argument.AssertNotNull(@from, nameof(@from)); Argument.AssertNotNull(to, nameof(to)); @@ -1634,7 +1655,7 @@ internal virtual Response LookupDictionaryExamples(string @from, string to, Requ scope.Start(); try { - using HttpMessage message = CreateLookupDictionaryExamplesRequest(@from, to, content, clientTraceId, context); + using HttpMessage message = CreateLookupDictionaryExamplesRequest(@from, to, content, GetClientTraceId(clientTraceId), context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1643,5 +1664,15 @@ internal virtual Response LookupDictionaryExamples(string @from, string to, Requ throw; } } + + /// + /// Gets the value of Client Trace Id. + /// + /// Client Trace Id + /// Value of Client Trace Id. + private static string GetClientTraceId(Guid clientTraceId) + { + return clientTraceId == default ? null : clientTraceId.ToString(); + } } } diff --git a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTranslateOptions.cs b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTranslateOptions.cs index 2e59728665b20..9cd61b8c0a536 100644 --- a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTranslateOptions.cs +++ b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTranslateOptions.cs @@ -2,11 +2,13 @@ // Licensed under the MIT License. using Azure.Core; +using System; using System.Collections.Generic; namespace Azure.AI.Translation.Text { /// Client options for TextTranslationClient.Translate + [CodeGenSuppress("ClientTraceId", typeof(string))] public partial class TextTranslationTranslateOptions { /// @@ -23,7 +25,7 @@ public partial class TextTranslationTranslateOptions /// /// A client-generated GUID to uniquely identify the request. /// - public string ClientTraceId { get; set; } + public Guid ClientTraceId { get; set; } /// /// Specifies the language of the input text. Find which languages are available to translate from by /// looking up supported languages using the translation scope. If the from parameter isn't specified, @@ -179,7 +181,7 @@ public TextTranslationTranslateOptions(string targetLanguage, string content) /// If no system is found with the specific category, the request will return a 400 status code. allowFallback=true /// specifies that the service is allowed to fall back to a general system when a custom system doesn't exist. /// - public TextTranslationTranslateOptions(IEnumerable targetLanguages, IEnumerable content, string clientTraceId = null, string sourceLanguage = null, TextType? textType = null, string category = null, ProfanityAction? profanityAction = null, ProfanityMarker? profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null): base() + public TextTranslationTranslateOptions(IEnumerable targetLanguages, IEnumerable content, Guid clientTraceId = default, string sourceLanguage = null, TextType? textType = null, string category = null, ProfanityAction? profanityAction = null, ProfanityMarker? profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null): base() { TargetLanguages = targetLanguages; Content = content; diff --git a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTransliterateOptions.cs b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTransliterateOptions.cs index a1e7b57853bb2..4a580bf2e1544 100644 --- a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTransliterateOptions.cs +++ b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTransliterateOptions.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using Azure.Core; +using System; using System.Collections.Generic; namespace Azure.AI.Translation.Text @@ -32,7 +33,7 @@ public partial class TextTranslationTransliterateOptions /// /// A client-generated GUID to uniquely identify the request. /// - public string ClientTraceId { get; set; } + public Guid ClientTraceId { get; set; } /// Initializes new instance of TextTranslationTransliterateOptions. /// @@ -50,7 +51,7 @@ public partial class TextTranslationTransliterateOptions /// /// Array of the text to be transliterated. /// A client-generated GUID to uniquely identify the request. - public TextTranslationTransliterateOptions(string language, string fromScript, string toScript, IEnumerable content, string clientTraceId = null): base() + public TextTranslationTransliterateOptions(string language, string fromScript, string toScript, IEnumerable content, Guid clientTraceId = default): base() { Language = language; FromScript = fromScript; @@ -75,7 +76,7 @@ public TextTranslationTransliterateOptions(string language, string fromScript, s /// /// The text to be transliterated. /// A client-generated GUID to uniquely identify the request. - public TextTranslationTransliterateOptions(string language, string fromScript, string toScript, string content, string clientTraceId = null) + public TextTranslationTransliterateOptions(string language, string fromScript, string toScript, string content, Guid clientTraceId = default) { Language = language; FromScript = fromScript; diff --git a/sdk/translation/Azure.AI.Translation.Text/tsp-location.yaml b/sdk/translation/Azure.AI.Translation.Text/tsp-location.yaml index 8653c85fbf9b2..2870e7447eceb 100644 --- a/sdk/translation/Azure.AI.Translation.Text/tsp-location.yaml +++ b/sdk/translation/Azure.AI.Translation.Text/tsp-location.yaml @@ -1,3 +1,3 @@ directory: specification/translation/Azure.AI.TextTranslation -commit: 4637adf8aac277915fad37135dc4d11d34e166b9 +commit: 7b097c7e91a72a8930b94282274158b71e604695 repo: Azure/azure-rest-api-specs