diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/ExtractedReceipt.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/ExtractedReceipt.cs index 14890619dd7d..b0c2b73e9b9b 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/ExtractedReceipt.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/ExtractedReceipt.cs @@ -221,7 +221,7 @@ private static string ConvertStringValue(string fieldName, IReadOnlyDictionary value.ValueDate == null ? default : DateTimeOffset.Parse(value.ValueDate, CultureInfo.InvariantCulture), + FieldValueType.DateType => value.ValueDate.HasValue ? value.ValueDate.Value : default, FieldValueType.TimeType => value.ValueTime == null ? default : DateTimeOffset.Parse(value.ValueTime, CultureInfo.InvariantCulture), _ => throw new InvalidOperationException($"The value type {value.Type} was expected to be a Date or Time") }; diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FieldValue.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FieldValue.cs index dd9cbca59c9c..fef1dcbf173a 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FieldValue.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FieldValue.cs @@ -83,7 +83,7 @@ public float AsFloat() } /// - /// Gets the value of the field as a . + /// Gets the value of the field as a . /// /// public DateTime AsDate() @@ -93,13 +93,12 @@ public DateTime AsDate() throw new InvalidOperationException($"Cannot get field as Date. Field value's type is {Type}."); } - DateTime date = default; - if (!DateTime.TryParse(_fieldValue.ValueDate, out date)) + if (!_fieldValue.ValueDate.HasValue) { throw new InvalidOperationException($"Cannot parse Date value {_fieldValue.ValueDate}."); } - return date; + return _fieldValue.ValueDate.Value.UtcDateTime; } /// diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormTrainingClient.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormTrainingClient.cs index 5722fecf1a46..cfb09aaaff63 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormTrainingClient.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormTrainingClient.cs @@ -166,7 +166,7 @@ public virtual async Task DeleteModelAsync(string modelId, Cancellatio [ForwardsClientCalls] public virtual Pageable GetModelInfos(CancellationToken cancellationToken = default) { - return ServiceClient.GetCustomModelsPageableModelInfo(GetModelOptions.Full, cancellationToken); + return ServiceClient.GetCustomModelsPageableModelInfo(cancellationToken); } /// @@ -178,7 +178,7 @@ public virtual Pageable GetModelInfos(CancellationToken can [ForwardsClientCalls] public virtual AsyncPageable GetModelInfosAsync(CancellationToken cancellationToken = default) { - return ServiceClient.GetCustomModelsPageableModelInfoAsync(GetModelOptions.Full, cancellationToken); + return ServiceClient.GetCustomModelsPageableModelInfoAsync(cancellationToken); } /// @@ -189,7 +189,7 @@ public virtual AsyncPageable GetModelInfosAsync(Cancellatio [ForwardsClientCalls] public virtual Response GetAccountProperties(CancellationToken cancellationToken = default) { - Response response = ServiceClient.RestClient.GetCustomModels(GetModelOptions.Summary, cancellationToken); + Response response = ServiceClient.RestClient.GetCustomModels(cancellationToken); return Response.FromValue(new AccountProperties(response.Value.Summary), response.GetRawResponse()); } @@ -201,7 +201,7 @@ public virtual Response GetAccountProperties(CancellationToke [ForwardsClientCalls] public virtual async Task> GetAccountPropertiesAsync(CancellationToken cancellationToken = default) { - Response response = await ServiceClient.RestClient.GetCustomModelsAsync(GetModelOptions.Summary, cancellationToken).ConfigureAwait(false); + Response response = await ServiceClient.RestClient.GetCustomModelsAsync(cancellationToken).ConfigureAwait(false); return Response.FromValue(new AccountProperties(response.Value.Summary), response.GetRawResponse()); } diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/FieldValue_internal.Serialization.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/FieldValue_internal.Serialization.cs index f51db09226b6..a22e595ec33c 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/FieldValue_internal.Serialization.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/FieldValue_internal.Serialization.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -17,7 +18,7 @@ internal static FieldValue_internal DeserializeFieldValue_internal(JsonElement e { FieldValueType type = default; string valueString = default; - string valueDate = default; + DateTimeOffset? valueDate = default; string valueTime = default; string valuePhoneNumber = default; float? valueNumber = default; @@ -51,7 +52,7 @@ internal static FieldValue_internal DeserializeFieldValue_internal(JsonElement e { continue; } - valueDate = property.Value.GetString(); + valueDate = property.Value.GetDateTimeOffset("D"); continue; } if (property.NameEquals("valueTime")) diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/FieldValue_internal.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/FieldValue_internal.cs index df9e756c8ab1..84b6b9793a52 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/FieldValue_internal.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/FieldValue_internal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.AI.FormRecognizer.Models @@ -34,7 +35,7 @@ internal FieldValue_internal(FieldValueType type) /// Confidence score. /// When includeTextDetails is set to true, a list of references to the text elements constituting this field. /// The 1-based page number in the input document. - internal FieldValue_internal(FieldValueType type, string valueString, string valueDate, string valueTime, string valuePhoneNumber, float? valueNumber, int? valueInteger, IReadOnlyList valueArray, IReadOnlyDictionary valueObject, string text, IReadOnlyList boundingBox, float? confidence, IReadOnlyList elements, int? page) + internal FieldValue_internal(FieldValueType type, string valueString, DateTimeOffset? valueDate, string valueTime, string valuePhoneNumber, float? valueNumber, int? valueInteger, IReadOnlyList valueArray, IReadOnlyDictionary valueObject, string text, IReadOnlyList boundingBox, float? confidence, IReadOnlyList elements, int? page) { Type = type; ValueString = valueString; @@ -57,7 +58,7 @@ internal FieldValue_internal(FieldValueType type, string valueString, string val /// String value. public string ValueString { get; } /// Date value. - public string ValueDate { get; } + public DateTimeOffset? ValueDate { get; } /// Time value. public string ValueTime { get; } /// Phone number value. diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/GetModelOptions.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/GetModelOptions.cs deleted file mode 100644 index 34f410b7fbd1..000000000000 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/GetModelOptions.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.FormRecognizer.Models -{ - /// The Enum0. - internal readonly partial struct GetModelOptions : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - public GetModelOptions(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string FullValue = "full"; - private const string SummaryValue = "summary"; - - /// full. - public static GetModelOptions Full { get; } = new GetModelOptions(FullValue); - /// summary. - public static GetModelOptions Summary { get; } = new GetModelOptions(SummaryValue); - /// Determines if two values are the same. - public static bool operator ==(GetModelOptions left, GetModelOptions right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(GetModelOptions left, GetModelOptions right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator GetModelOptions(string value) => new GetModelOptions(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is GetModelOptions other && Equals(other); - /// - public bool Equals(GetModelOptions other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/ModelsSummary_internal.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/ModelsSummary_internal.cs index 3785d1f81294..47bf24620017 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/ModelsSummary_internal.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Models/ModelsSummary_internal.cs @@ -14,7 +14,7 @@ internal partial class ModelsSummary_internal { /// Initializes a new instance of ModelsSummary_internal. /// Current count of trained custom models. - /// Max number of models that can be trained for this subscription. + /// Max number of models that can be trained for this account. /// Date and time (UTC) when the summary was last updated. internal ModelsSummary_internal(int count, int limit, DateTimeOffset lastUpdatedDateTime) { @@ -25,7 +25,7 @@ internal ModelsSummary_internal(int count, int limit, DateTimeOffset lastUpdated /// Current count of trained custom models. public int Count { get; } - /// Max number of models that can be trained for this subscription. + /// Max number of models that can be trained for this account. public int Limit { get; } /// Date and time (UTC) when the summary was last updated. public DateTimeOffset LastUpdatedDateTime { get; } diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Operations/ServiceClient.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Operations/ServiceClient.cs index 5273419d96c0..aa42ab8781cf 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Operations/ServiceClient.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Operations/ServiceClient.cs @@ -249,36 +249,48 @@ public virtual Response GetAnalyzeLayoutResult( } /// Get information about all custom models. - /// Specify whether to return summary or full list of models. /// The cancellation token to use. - public virtual AsyncPageable GetCustomModelsAsync(GetModelOptions? op = null, CancellationToken cancellationToken = default) + public virtual async Task> GetCustomModelsAsync(CancellationToken cancellationToken = default) + { + return await RestClient.GetCustomModelsAsync(cancellationToken).ConfigureAwait(false); + } + + /// Get information about all custom models. + /// The cancellation token to use. + public virtual Response GetCustomModels(CancellationToken cancellationToken = default) + { + return RestClient.GetCustomModels(cancellationToken); + } + + /// Get information about all custom models. + /// The cancellation token to use. + public virtual AsyncPageable ListCustomModelsAsync(CancellationToken cancellationToken = default) { async Task> FirstPageFunc(int? pageSizeHint) { - var response = await RestClient.GetCustomModelsAsync(op, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListCustomModelsAsync(cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.ModelList, response.Value.NextLink, response.GetRawResponse()); } async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - var response = await RestClient.GetCustomModelsNextPageAsync(nextLink, op, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListCustomModelsNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.ModelList, response.Value.NextLink, response.GetRawResponse()); } return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } /// Get information about all custom models. - /// Specify whether to return summary or full list of models. /// The cancellation token to use. - public virtual Pageable GetCustomModels(GetModelOptions? op = null, CancellationToken cancellationToken = default) + public virtual Pageable ListCustomModels(CancellationToken cancellationToken = default) { Page FirstPageFunc(int? pageSizeHint) { - var response = RestClient.GetCustomModels(op, cancellationToken); + var response = RestClient.ListCustomModels(cancellationToken); return Page.FromValues(response.Value.ModelList, response.Value.NextLink, response.GetRawResponse()); } Page NextPageFunc(string nextLink, int? pageSizeHint) { - var response = RestClient.GetCustomModelsNextPage(nextLink, op, cancellationToken); + var response = RestClient.ListCustomModelsNextPage(nextLink, cancellationToken); return Page.FromValues(response.Value.ModelList, response.Value.NextLink, response.GetRawResponse()); } return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Operations/ServiceRestClient.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Operations/ServiceRestClient.cs index dd39e4a7ba96..aef302eae78a 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Operations/ServiceRestClient.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Generated/Operations/ServiceRestClient.cs @@ -118,99 +118,6 @@ public ResponseWithHeaders TrainCustomModel } } - internal HttpMessage CreateGetCustomModelsRequest(GetModelOptions? op) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(endpoint, false); - uri.AppendRaw("/formrecognizer/v2.0-preview", false); - uri.AppendPath("/custom/models", false); - if (op != null) - { - uri.AppendQuery("op", op.Value.ToString(), true); - } - request.Uri = uri; - return message; - } - - /// Get information about all custom models. - /// Specify whether to return summary or full list of models. - /// The cancellation token to use. - public async ValueTask> GetCustomModelsAsync(GetModelOptions? op = null, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetCustomModels"); - scope.Start(); - try - { - using var message = CreateGetCustomModelsRequest(op); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - Models_internal value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - if (document.RootElement.ValueKind == JsonValueKind.Null) - { - value = null; - } - else - { - value = Models_internal.DeserializeModels_internal(document.RootElement); - } - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get information about all custom models. - /// Specify whether to return summary or full list of models. - /// The cancellation token to use. - public Response GetCustomModels(GetModelOptions? op = null, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetCustomModels"); - scope.Start(); - try - { - using var message = CreateGetCustomModelsRequest(op); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - Models_internal value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - if (document.RootElement.ValueKind == JsonValueKind.Null) - { - value = null; - } - else - { - value = Models_internal.DeserializeModels_internal(document.RootElement); - } - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - internal HttpMessage CreateGetCustomModelRequest(Guid modelId, bool? includeKeys) { var message = _pipeline.CreateMessage(); @@ -1144,7 +1051,183 @@ public Response GetAnalyzeLayoutResult(Guid res } } - internal HttpMessage CreateGetCustomModelsNextPageRequest(string nextLink, GetModelOptions? op) + internal HttpMessage CreateListCustomModelsRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw(endpoint, false); + uri.AppendRaw("/formrecognizer/v2.0-preview", false); + uri.AppendPath("/custom/models", false); + uri.AppendQuery("op", "full", true); + request.Uri = uri; + return message; + } + + /// Get information about all custom models. + /// The cancellation token to use. + public async ValueTask> ListCustomModelsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ServiceClient.ListCustomModels"); + scope.Start(); + try + { + using var message = CreateListCustomModelsRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Models_internal value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Models_internal.DeserializeModels_internal(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get information about all custom models. + /// The cancellation token to use. + public Response ListCustomModels(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ServiceClient.ListCustomModels"); + scope.Start(); + try + { + using var message = CreateListCustomModelsRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Models_internal value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Models_internal.DeserializeModels_internal(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateGetCustomModelsRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw(endpoint, false); + uri.AppendRaw("/formrecognizer/v2.0-preview", false); + uri.AppendPath("/custom/models", false); + uri.AppendQuery("op", "summary", true); + request.Uri = uri; + return message; + } + + /// Get information about all custom models. + /// The cancellation token to use. + public async ValueTask> GetCustomModelsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetCustomModels"); + scope.Start(); + try + { + using var message = CreateGetCustomModelsRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Models_internal value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Models_internal.DeserializeModels_internal(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get information about all custom models. + /// The cancellation token to use. + public Response GetCustomModels(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetCustomModels"); + scope.Start(); + try + { + using var message = CreateGetCustomModelsRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Models_internal value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + if (document.RootElement.ValueKind == JsonValueKind.Null) + { + value = null; + } + else + { + value = Models_internal.DeserializeModels_internal(document.RootElement); + } + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateListCustomModelsNextPageRequest(string nextLink) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1157,20 +1240,19 @@ internal HttpMessage CreateGetCustomModelsNextPageRequest(string nextLink, GetMo /// Get information about all custom models. /// The URL to the next page of results. - /// Specify whether to return summary or full list of models. /// The cancellation token to use. - public async ValueTask> GetCustomModelsNextPageAsync(string nextLink, GetModelOptions? op = null, CancellationToken cancellationToken = default) + public async ValueTask> ListCustomModelsNextPageAsync(string nextLink, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } - using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetCustomModels"); + using var scope = _clientDiagnostics.CreateScope("ServiceClient.ListCustomModels"); scope.Start(); try { - using var message = CreateGetCustomModelsNextPageRequest(nextLink, op); + using var message = CreateListCustomModelsNextPageRequest(nextLink); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1201,20 +1283,19 @@ public async ValueTask> GetCustomModelsNextPageAsync(s /// Get information about all custom models. /// The URL to the next page of results. - /// Specify whether to return summary or full list of models. /// The cancellation token to use. - public Response GetCustomModelsNextPage(string nextLink, GetModelOptions? op = null, CancellationToken cancellationToken = default) + public Response ListCustomModelsNextPage(string nextLink, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } - using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetCustomModels"); + using var scope = _clientDiagnostics.CreateScope("ServiceClient.ListCustomModels"); scope.Start(); try { - using var message = CreateGetCustomModelsNextPageRequest(nextLink, op); + using var message = CreateListCustomModelsNextPageRequest(nextLink); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/ServiceClient.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/ServiceClient.cs index 437c717d3c94..7879d49c7cc2 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/ServiceClient.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/ServiceClient.cs @@ -14,37 +14,35 @@ namespace Azure.AI.FormRecognizer internal partial class ServiceClient { /// Get information about all custom models. - /// Specify whether to return summary or full list of models. /// The cancellation token to use. - public Pageable GetCustomModelsPageableModelInfo(GetModelOptions? op, CancellationToken cancellationToken = default) + public Pageable GetCustomModelsPageableModelInfo(CancellationToken cancellationToken = default) { Page FirstPageFunc(int? pageSizeHint) { - var response = RestClient.GetCustomModels(op, cancellationToken); + Response response = RestClient.ListCustomModels(cancellationToken); return Page.FromValues(response.Value.ModelList.Select(info => new CustomFormModelInfo(info)), response.Value.NextLink, response.GetRawResponse()); } Page NextPageFunc(string nextLink, int? pageSizeHint) { - var response = RestClient.GetCustomModelsNextPage(nextLink, op, cancellationToken); + Response response = RestClient.ListCustomModelsNextPage(nextLink, cancellationToken); return Page.FromValues(response.Value.ModelList.Select(info => new CustomFormModelInfo(info)), response.Value.NextLink, response.GetRawResponse()); } return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } /// Get information about all custom models. - /// Specify whether to return summary or full list of models. /// The cancellation token to use. - public AsyncPageable GetCustomModelsPageableModelInfoAsync(GetModelOptions? op, CancellationToken cancellationToken = default) + public AsyncPageable GetCustomModelsPageableModelInfoAsync(CancellationToken cancellationToken = default) { async Task> FirstPageFunc(int? pageSizeHint) { - var response = await RestClient.GetCustomModelsAsync(op, cancellationToken).ConfigureAwait(false); + Response response = await RestClient.ListCustomModelsAsync(cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.ModelList.Select(info => new CustomFormModelInfo(info)), response.Value.NextLink, response.GetRawResponse()); } async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - var response = await RestClient.GetCustomModelsNextPageAsync(nextLink, op, cancellationToken).ConfigureAwait(false); + Response response = await RestClient.ListCustomModelsNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.ModelList.Select(info => new CustomFormModelInfo(info)), response.Value.NextLink, response.GetRawResponse()); } return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/autorest.md b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/autorest.md index 44af68b0892d..b495aa8b2c1f 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/autorest.md +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/autorest.md @@ -7,5 +7,22 @@ Run `dotnet msbuild /t:GenerateCode` to generate code. ``` yaml input-file: - - https://raw.githubusercontent.com/kristapratico/azure-rest-api-specs/form-recognizer-patch/specification/cognitiveservices/data-plane/FormRecognizer/preview/v2.0/FormRecognizer.json + - https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cognitiveservices/data-plane/FormRecognizer/preview/v2.0/FormRecognizer.json +``` + + + +### Hide LROs +``` yaml +directive: +- from: swagger-document + where: $["paths"] + transform: > + for (var path in $) { + for (var op of Object.values($[path])) { + if (op["x-ms-long-running-operation"]) { + delete op["x-ms-long-running-operation"]; + } + } + } ```