diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props index 2a32defe7f2e9..156d5f0b88a8f 100644 --- a/eng/Packages.Data.props +++ b/eng/Packages.Data.props @@ -174,7 +174,7 @@ All should have PrivateAssets="All" set so they don't become package dependencies --> - + diff --git a/eng/emitter-package.json b/eng/emitter-package.json index 09f1b2e83f482..92456b85b122b 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,6 +1,6 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-csharp": "0.2.0-beta.20230922.4" + "@azure-tools/typespec-csharp": "0.2.0-beta.20230924.2" } } 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 67bc13edc30a4..12f7e2a34e9f6 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 @@ -186,8 +186,10 @@ protected TextTranslationClient(System.Uri endpoint, Azure.AI.Translation.Text.T 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 GetLanguages(string clientTraceId = null, string scope = null, string acceptLanguage = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetLanguagesAsync(string clientTraceId = null, string scope = null, string acceptLanguage = null, string ifNoneMatch = 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; } 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 022ce5466e358..fa66fd19d2e67 100644 --- a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClient.cs +++ b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClient.cs @@ -725,154 +725,6 @@ public virtual Response> LookupDictionaryEx return this.LookupDictionaryExamples(from, to, new[] { new DictionaryExampleTextItem(content.Text, content.Translation) }, clientTraceId, cancellationToken); } - /// Gets the set of languages currently supported by other operations of the Translator. - /// A client-generated GUID to uniquely identify the request. - /// - /// A comma-separated list of names defining the group of languages to return. - /// Allowed group names are: `translation`, `transliteration` and `dictionary`. - /// If no scope is given, then all groups are returned, which is equivalent to passing - /// `scope=translation,transliteration,dictionary`. To decide which set of supported languages - /// is appropriate for your scenario, see the description of the [response object](#response-body). - /// - /// - /// The language to use for user interface strings. Some of the fields in the response are names of languages or - /// names of regions. Use this parameter to define the language in which these names are returned. - /// The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr` - /// to request names in French or use the value `zh-Hant` to request names in Chinese Traditional. - /// Names are provided in the English language when a target language is not specified or when localization - /// is not available. - /// - /// - /// Passing the value of the ETag response header in an If-None-Match field will allow the service to optimize the response. - /// If the resource has not been modified, the service will return status code 304 and an empty response body. - /// - /// Request context. - internal virtual async Task GetLanguagesAsync(string clientTraceId = null, string scope = null, string acceptLanguage = null, string ifNoneMatch = null, RequestContext context = default) - { - ETag? eTag = null; - if (ifNoneMatch != null) - { - eTag = new ETag(ifNoneMatch); - } - - return await this.GetLanguagesAsync(clientTraceId, scope, acceptLanguage, eTag, context).ConfigureAwait(false); - } - - /// Gets the set of languages currently supported by other operations of the Translator. - /// A client-generated GUID to uniquely identify the request. - /// - /// A comma-separated list of names defining the group of languages to return. - /// Allowed group names are: `translation`, `transliteration` and `dictionary`. - /// If no scope is given, then all groups are returned, which is equivalent to passing - /// `scope=translation,transliteration,dictionary`. To decide which set of supported languages - /// is appropriate for your scenario, see the description of the [response object](#response-body). - /// - /// - /// The language to use for user interface strings. Some of the fields in the response are names of languages or - /// names of regions. Use this parameter to define the language in which these names are returned. - /// The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr` - /// to request names in French or use the value `zh-Hant` to request names in Chinese Traditional. - /// Names are provided in the English language when a target language is not specified or when localization - /// is not available. - /// - /// - /// Passing the value of the ETag response header in an If-None-Match field will allow the service to optimize the response. - /// If the resource has not been modified, the service will return status code 304 and an empty response body. - /// - /// Request context. - internal virtual Response GetLanguages(string clientTraceId = null, string scope = null, string acceptLanguage = null, string ifNoneMatch = null, RequestContext context = default) - { - ETag? eTag = null; - if (ifNoneMatch != null) - { - eTag = new ETag(ifNoneMatch); - } - - return this.GetLanguages(clientTraceId, scope, acceptLanguage, eTag, context); - } - - // Overrides for generated class - - /// Gets the set of languages currently supported by other operations of the Translator. - /// A client-generated GUID to uniquely identify the request. - /// - /// A comma-separated list of names defining the group of languages to return. - /// Allowed group names are: `translation`, `transliteration` and `dictionary`. - /// If no scope is given, then all groups are returned, which is equivalent to passing - /// `scope=translation,transliteration,dictionary`. To decide which set of supported languages - /// is appropriate for your scenario, see the description of the [response object](#response-body). - /// - /// - /// The language to use for user interface strings. Some of the fields in the response are names of languages or - /// names of regions. Use this parameter to define the language in which these names are returned. - /// The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr` - /// to request names in French or use the value `zh-Hant` to request names in Chinese Traditional. - /// Names are provided in the English language when a target language is not specified or when localization - /// is not available. - /// - /// - /// Passing the value of the ETag response header in an If-None-Match field will allow the service to optimize the response. - /// If the resource has not been modified, the service will return status code 304 and an empty response body. - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// 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 GetLanguagesAsync(string clientTraceId = null, string scope = null, string acceptLanguage = null, ETag? ifNoneMatch = null, RequestContext context = null) - { - using var scope0 = ClientDiagnostics.CreateScope("TextTranslationClient.GetLanguages"); - scope0.Start(); - try - { - using HttpMessage message = CreateGetLanguagesRequest(clientTraceId, scope, acceptLanguage, ifNoneMatch, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Gets the set of languages currently supported by other operations of the Translator. - /// A client-generated GUID to uniquely identify the request. - /// - /// A comma-separated list of names defining the group of languages to return. - /// Allowed group names are: `translation`, `transliteration` and `dictionary`. - /// If no scope is given, then all groups are returned, which is equivalent to passing - /// `scope=translation,transliteration,dictionary`. To decide which set of supported languages - /// is appropriate for your scenario, see the description of the [response object](#response-body). - /// - /// - /// The language to use for user interface strings. Some of the fields in the response are names of languages or - /// names of regions. Use this parameter to define the language in which these names are returned. - /// The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr` - /// to request names in French or use the value `zh-Hant` to request names in Chinese Traditional. - /// Names are provided in the English language when a target language is not specified or when localization - /// is not available. - /// - /// - /// Passing the value of the ETag response header in an If-None-Match field will allow the service to optimize the response. - /// If the resource has not been modified, the service will return status code 304 and an empty response body. - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// 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 GetLanguages(string clientTraceId = null, string scope = null, string acceptLanguage = null, ETag? ifNoneMatch = null, RequestContext context = null) - { - using var scope0 = ClientDiagnostics.CreateScope("TextTranslationClient.GetLanguages"); - scope0.Start(); - try - { - using HttpMessage message = CreateGetLanguagesRequest(clientTraceId, scope, acceptLanguage, ifNoneMatch, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - /// Translate Text. /// /// Specifies the language of the output text. The target language must be one of the supported languages included diff --git a/sdk/translation/Azure.AI.Translation.Text/src/Generated/Docs/TextTranslationClient.xml b/sdk/translation/Azure.AI.Translation.Text/src/Generated/Docs/TextTranslationClient.xml index d3307a69df70b..269a37364f339 100644 --- a/sdk/translation/Azure.AI.Translation.Text/src/Generated/Docs/TextTranslationClient.xml +++ b/sdk/translation/Azure.AI.Translation.Text/src/Generated/Docs/TextTranslationClient.xml @@ -1,8 +1,8 @@ - - + + diff --git a/sdk/translation/Azure.AI.Translation.Text/src/Generated/TextTranslationClient.cs b/sdk/translation/Azure.AI.Translation.Text/src/Generated/TextTranslationClient.cs index d28b20081645c..474472bd85c3d 100644 --- a/sdk/translation/Azure.AI.Translation.Text/src/Generated/TextTranslationClient.cs +++ b/sdk/translation/Azure.AI.Translation.Text/src/Generated/TextTranslationClient.cs @@ -75,8 +75,8 @@ protected TextTranslationClient() /// If the resource has not been modified, the service will return status code 304 and an empty response body. /// /// The cancellation token to use. - /// - public virtual async Task> GetLanguagesAsync(string clientTraceId = null, string scope = null, string acceptLanguage = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + /// + public virtual async Task> GetLanguagesAsync(string clientTraceId = null, string scope = null, string acceptLanguage = null, ETag? ifNoneMatch = null, CancellationToken cancellationToken = default) { RequestContext context = FromCancellationToken(cancellationToken); Response response = await GetLanguagesAsync(clientTraceId, scope, acceptLanguage, ifNoneMatch, context).ConfigureAwait(false); @@ -105,14 +105,124 @@ public virtual async Task> GetLanguagesAsync(string /// If the resource has not been modified, the service will return status code 304 and an empty response body. /// /// The cancellation token to use. - /// - public virtual Response GetLanguages(string clientTraceId = null, string scope = null, string acceptLanguage = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + /// + public virtual Response GetLanguages(string clientTraceId = null, string scope = null, string acceptLanguage = null, ETag? ifNoneMatch = null, CancellationToken cancellationToken = default) { RequestContext context = FromCancellationToken(cancellationToken); Response response = GetLanguages(clientTraceId, scope, acceptLanguage, ifNoneMatch, context); return Response.FromValue(GetLanguagesResult.FromResponse(response), response); } + /// + /// [Protocol Method] Gets the set of languages currently supported by other operations of the Translator. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// A client-generated GUID to uniquely identify the request. + /// + /// A comma-separated list of names defining the group of languages to return. + /// Allowed group names are: `translation`, `transliteration` and `dictionary`. + /// If no scope is given, then all groups are returned, which is equivalent to passing + /// `scope=translation,transliteration,dictionary`. To decide which set of supported languages + /// is appropriate for your scenario, see the description of the [response object](#response-body). + /// + /// + /// The language to use for user interface strings. Some of the fields in the response are names of languages or + /// names of regions. Use this parameter to define the language in which these names are returned. + /// The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr` + /// to request names in French or use the value `zh-Hant` to request names in Chinese Traditional. + /// Names are provided in the English language when a target language is not specified or when localization + /// is not available. + /// + /// + /// Passing the value of the ETag response header in an If-None-Match field will allow the service to optimize the response. + /// If the resource has not been modified, the service will return status code 304 and an empty response body. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetLanguagesAsync(string clientTraceId, string scope, string acceptLanguage, ETag? ifNoneMatch, RequestContext context) + { + using var scope0 = ClientDiagnostics.CreateScope("TextTranslationClient.GetLanguages"); + scope0.Start(); + try + { + using HttpMessage message = CreateGetLanguagesRequest(clientTraceId, scope, acceptLanguage, ifNoneMatch, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets the set of languages currently supported by other operations of the Translator. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// A client-generated GUID to uniquely identify the request. + /// + /// A comma-separated list of names defining the group of languages to return. + /// Allowed group names are: `translation`, `transliteration` and `dictionary`. + /// If no scope is given, then all groups are returned, which is equivalent to passing + /// `scope=translation,transliteration,dictionary`. To decide which set of supported languages + /// is appropriate for your scenario, see the description of the [response object](#response-body). + /// + /// + /// The language to use for user interface strings. Some of the fields in the response are names of languages or + /// names of regions. Use this parameter to define the language in which these names are returned. + /// The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr` + /// to request names in French or use the value `zh-Hant` to request names in Chinese Traditional. + /// Names are provided in the English language when a target language is not specified or when localization + /// is not available. + /// + /// + /// Passing the value of the ETag response header in an If-None-Match field will allow the service to optimize the response. + /// If the resource has not been modified, the service will return status code 304 and an empty response body. + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetLanguages(string clientTraceId, string scope, string acceptLanguage, ETag? ifNoneMatch, RequestContext context) + { + using var scope0 = ClientDiagnostics.CreateScope("TextTranslationClient.GetLanguages"); + scope0.Start(); + try + { + using HttpMessage message = CreateGetLanguagesRequest(clientTraceId, scope, acceptLanguage, ifNoneMatch, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + internal HttpMessage CreateGetLanguagesRequest(string clientTraceId, string scope, string acceptLanguage, ETag? ifNoneMatch, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200);