diff --git a/sdk/cognitiveservices/Language.LUIS.Authoring/CHANGELOG.md b/sdk/cognitiveservices/Language.LUIS.Authoring/CHANGELOG.md new file mode 100644 index 000000000000..f24817de2add --- /dev/null +++ b/sdk/cognitiveservices/Language.LUIS.Authoring/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 3.2.0-preview.2 (Unreleased) +### Added +- Adding Luis App import and export in .lu format +- Adding Luis App import v2 app that enables to import an app that has entities with children of type "String" + +### Fixed +- Issue where AzureAccount Api are not able to be authenticated ([#8023](https://github.com/Azure/azure-sdk-for-net/issues/8023)) + +## 3.2.0-preview.1 (2019-10-30) \ No newline at end of file diff --git a/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/Apps.cs b/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/Apps.cs index 5b21ed9daa1f..57d3f3e553a5 100644 --- a/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/Apps.cs +++ b/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/Apps.cs @@ -3637,7 +3637,7 @@ public Apps(LUISAuthoringClient client) /// Imports an application to LUIS, the application's structure is included in /// the request body. /// - /// + /// /// A LUIS application structure. /// /// @@ -3666,15 +3666,15 @@ public Apps(LUISAuthoringClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ImportLuFromatWithHttpMessagesAsync(string luisApplu, string appName = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ImportLuFormatWithHttpMessagesAsync(string luisAppLu, string appName = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.Endpoint == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); } - if (luisApplu == null) + if (luisAppLu == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "luisApplu"); + throw new ValidationException(ValidationRules.CannotBeNull, "luisAppLu"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -3684,9 +3684,9 @@ public Apps(LUISAuthoringClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("appName", appName); - tracingParameters.Add("luisApplu", luisApplu); + tracingParameters.Add("luisAppLu", luisAppLu); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ImportLuFromat", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ImportLuFormat", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri; @@ -3723,9 +3723,9 @@ public Apps(LUISAuthoringClient client) // Serialize Request string _requestContent = null; - if(luisApplu != null) + if(luisAppLu != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(luisApplu, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(luisAppLu, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("text/plain"); } diff --git a/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/AppsExtensions.cs b/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/AppsExtensions.cs index 804614a68121..56882b59472d 100644 --- a/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/AppsExtensions.cs +++ b/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/AppsExtensions.cs @@ -525,7 +525,7 @@ public static partial class AppsExtensions /// /// The operations group for this extension method. /// - /// + /// /// A LUIS application structure. /// /// @@ -536,9 +536,9 @@ public static partial class AppsExtensions /// /// The cancellation token. /// - public static async Task ImportLuFromatAsync(this IApps operations, string luisApplu, string appName = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ImportLuFormatAsync(this IApps operations, string luisAppLu, string appName = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ImportLuFromatWithHttpMessagesAsync(luisApplu, appName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ImportLuFormatWithHttpMessagesAsync(luisAppLu, appName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/IApps.cs b/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/IApps.cs index 18964d6c982e..199bc28b3d97 100644 --- a/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/IApps.cs +++ b/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/IApps.cs @@ -577,7 +577,7 @@ public partial interface IApps /// Imports an application to LUIS, the application's structure is /// included in the request body. /// - /// + /// /// A LUIS application structure. /// /// @@ -600,6 +600,6 @@ public partial interface IApps /// /// Thrown when a required parameter is null /// - Task> ImportLuFromatWithHttpMessagesAsync(string luisApplu, string appName = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ImportLuFormatWithHttpMessagesAsync(string luisAppLu, string appName = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/IVersions.cs b/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/IVersions.cs index 35a98f3ca9e0..c40c5a30d2f5 100644 --- a/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/IVersions.cs +++ b/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/IVersions.cs @@ -315,7 +315,7 @@ public partial interface IVersions /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/Versions.cs b/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/Versions.cs index 4c802bd2be51..d04f8ea1db2c 100644 --- a/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/Versions.cs +++ b/sdk/cognitiveservices/Language.LUIS.Authoring/src/Generated/Versions.cs @@ -1770,7 +1770,7 @@ public Versions(LUISAuthoringClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1868,19 +1868,12 @@ public Versions(LUISAuthoringClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } } - catch (JsonException) - { - // Ignore the exception + else { + _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); diff --git a/sdk/cognitiveservices/Language.LUIS.Authoring/tests/Luis/ImportExportTests.cs b/sdk/cognitiveservices/Language.LUIS.Authoring/tests/Luis/ImportExportTests.cs index f9ef1855f30f..535486fa836b 100644 --- a/sdk/cognitiveservices/Language.LUIS.Authoring/tests/Luis/ImportExportTests.cs +++ b/sdk/cognitiveservices/Language.LUIS.Authoring/tests/Luis/ImportExportTests.cs @@ -1,6 +1,7 @@ namespace LUIS.Authoring.Tests.Luis { using System.IO; + using System.Text; using Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring; using Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring.Models; using Newtonsoft.Json; @@ -52,6 +53,12 @@ public void ExportAppVersionLuFormat() await client.Apps.DeleteAsync(appId); + var buffer = new byte[app.Length]; + + app.Read(buffer, 0, (int)app.Length); + + var f = Encoding.UTF8.GetString(buffer); + //LocalEncoding.GetString(stream.ToArray()); Assert.NotNull(app); }); } @@ -176,7 +183,7 @@ public void ImportAppLuFormat() UseClientFor(async client => { - var testAppId = await client.Apps.ImportLuFromatAsync(appText, "Test Import LUIS App Lu format"); + var testAppId = await client.Apps.ImportLuFormatAsync(appText, "Test Import LUIS App Lu format"); var testApp = await client.Apps.GetAsync(testAppId); await client.Apps.DeleteAsync(testAppId);