Fixed appending name information for non-overloads. Full regeneration.

This commit is contained in:
Michael Yanni 2020-03-09 14:13:19 -07:00
Родитель c8429f714e
Коммит 2da7111d4b
4 изменённых файлов: 274 добавлений и 4 удалений

Просмотреть файл

@ -89,6 +89,24 @@ namespace Azure.AI.FormRecognizer
{
return RestClient.AnalyzeWithCustomModel(modelId, includeTextDetails, contentType, cancellationToken).GetRawResponse();
}
/// <summary> Extract key-value pairs, tables, and semantic values from a given document. The input document must be of one of the supported content types - &apos;application/pdf&apos;, &apos;image/jpeg&apos;, &apos;image/png&apos; or &apos;image/tiff&apos;. Alternatively, use &apos;application/json&apos; type to specify the location (Uri or local path) of the document to be analyzed. </summary>
/// <param name="modelId"> Model identifier. </param>
/// <param name="includeTextDetails"> Include text lines and element references in the result. </param>
/// <param name="fileStream"> .json, .pdf, .jpg, .png or .tiff type file stream. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> AnalyzeWithCustomModelAsync(Guid modelId, bool? includeTextDetails, SourcePath fileStream, CancellationToken cancellationToken = default)
{
return (await RestClient.AnalyzeWithCustomModelAsync(modelId, includeTextDetails, fileStream, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
/// <summary> Extract key-value pairs, tables, and semantic values from a given document. The input document must be of one of the supported content types - &apos;application/pdf&apos;, &apos;image/jpeg&apos;, &apos;image/png&apos; or &apos;image/tiff&apos;. Alternatively, use &apos;application/json&apos; type to specify the location (Uri or local path) of the document to be analyzed. </summary>
/// <param name="modelId"> Model identifier. </param>
/// <param name="includeTextDetails"> Include text lines and element references in the result. </param>
/// <param name="fileStream"> .json, .pdf, .jpg, .png or .tiff type file stream. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response AnalyzeWithCustomModel(Guid modelId, bool? includeTextDetails, SourcePath fileStream, CancellationToken cancellationToken = default)
{
return RestClient.AnalyzeWithCustomModel(modelId, includeTextDetails, fileStream, cancellationToken).GetRawResponse();
}
/// <summary> Obtain current status and the result of the analyze form operation. </summary>
/// <param name="modelId"> Model identifier. </param>
/// <param name="resultId"> Analyze operation result identifier. </param>
@ -121,6 +139,22 @@ namespace Azure.AI.FormRecognizer
{
return RestClient.AnalyzeReceiptAsync(includeTextDetails, contentType, cancellationToken).GetRawResponse();
}
/// <summary> Extract field text and semantic values from a given receipt document. The input document must be of one of the supported content types - &apos;application/pdf&apos;, &apos;image/jpeg&apos;, &apos;image/png&apos; or &apos;image/tiff&apos;. Alternatively, use &apos;application/json&apos; type to specify the location (Uri or local path) of the document to be analyzed. </summary>
/// <param name="includeTextDetails"> Include text lines and element references in the result. </param>
/// <param name="fileStream"> .json, .pdf, .jpg, .png or .tiff type file stream. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> AnalyzeReceiptAsyncAsync(bool? includeTextDetails, SourcePath fileStream, CancellationToken cancellationToken = default)
{
return (await RestClient.AnalyzeReceiptAsyncAsync(includeTextDetails, fileStream, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
/// <summary> Extract field text and semantic values from a given receipt document. The input document must be of one of the supported content types - &apos;application/pdf&apos;, &apos;image/jpeg&apos;, &apos;image/png&apos; or &apos;image/tiff&apos;. Alternatively, use &apos;application/json&apos; type to specify the location (Uri or local path) of the document to be analyzed. </summary>
/// <param name="includeTextDetails"> Include text lines and element references in the result. </param>
/// <param name="fileStream"> .json, .pdf, .jpg, .png or .tiff type file stream. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response AnalyzeReceiptAsync(bool? includeTextDetails, SourcePath fileStream, CancellationToken cancellationToken = default)
{
return RestClient.AnalyzeReceiptAsync(includeTextDetails, fileStream, cancellationToken).GetRawResponse();
}
/// <summary> Track the progress and obtain the result of the analyze receipt operation. </summary>
/// <param name="resultId"> Analyze operation result identifier. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
@ -149,6 +183,20 @@ namespace Azure.AI.FormRecognizer
{
return RestClient.AnalyzeLayoutAsync(contentType, cancellationToken).GetRawResponse();
}
/// <summary> Extract text and layout information from a given document. The input document must be of one of the supported content types - &apos;application/pdf&apos;, &apos;image/jpeg&apos;, &apos;image/png&apos; or &apos;image/tiff&apos;. Alternatively, use &apos;application/json&apos; type to specify the location (Uri or local path) of the document to be analyzed. </summary>
/// <param name="fileStream"> .json, .pdf, .jpg, .png or .tiff type file stream. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response> AnalyzeLayoutAsyncAsync(SourcePath fileStream, CancellationToken cancellationToken = default)
{
return (await RestClient.AnalyzeLayoutAsyncAsync(fileStream, cancellationToken).ConfigureAwait(false)).GetRawResponse();
}
/// <summary> Extract text and layout information from a given document. The input document must be of one of the supported content types - &apos;application/pdf&apos;, &apos;image/jpeg&apos;, &apos;image/png&apos; or &apos;image/tiff&apos;. Alternatively, use &apos;application/json&apos; type to specify the location (Uri or local path) of the document to be analyzed. </summary>
/// <param name="fileStream"> .json, .pdf, .jpg, .png or .tiff type file stream. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response AnalyzeLayoutAsync(SourcePath fileStream, CancellationToken cancellationToken = default)
{
return RestClient.AnalyzeLayoutAsync(fileStream, cancellationToken).GetRawResponse();
}
/// <summary> Track the progress and obtain the result of the analyze layout operation. </summary>
/// <param name="resultId"> Analyze operation result identifier. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>

Просмотреть файл

@ -403,6 +403,84 @@ namespace Azure.AI.FormRecognizer
throw;
}
}
internal HttpMessage CreateAnalyzeWithCustomModelRequest(Guid modelId, bool? includeTextDetails, SourcePath fileStream)
{
var message = pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Post;
var uri = new RawRequestUriBuilder();
uri.AppendRaw(endpoint, false);
uri.AppendRaw("/formrecognizer/v2.0-preview", false);
uri.AppendPath("/custom/models/", false);
uri.AppendPath(modelId, true);
uri.AppendPath("/analyze", false);
if (includeTextDetails != null)
{
uri.AppendQuery("includeTextDetails", includeTextDetails.Value, true);
}
request.Uri = uri;
request.Headers.Add("Content-Type", "application/json");
using var content = new Utf8JsonRequestContent();
content.JsonWriter.WriteObjectValue(fileStream);
request.Content = content;
return message;
}
/// <summary> Extract key-value pairs, tables, and semantic values from a given document. The input document must be of one of the supported content types - &apos;application/pdf&apos;, &apos;image/jpeg&apos;, &apos;image/png&apos; or &apos;image/tiff&apos;. Alternatively, use &apos;application/json&apos; type to specify the location (Uri or local path) of the document to be analyzed. </summary>
/// <param name="modelId"> Model identifier. </param>
/// <param name="includeTextDetails"> Include text lines and element references in the result. </param>
/// <param name="fileStream"> .json, .pdf, .jpg, .png or .tiff type file stream. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<ResponseWithHeaders<AnalyzeWithCustomModelHeaders>> AnalyzeWithCustomModelAsync(Guid modelId, bool? includeTextDetails, SourcePath fileStream, CancellationToken cancellationToken = default)
{
using var scope = clientDiagnostics.CreateScope("ServiceClient.AnalyzeWithCustomModel");
scope.Start();
try
{
using var message = CreateAnalyzeWithCustomModelRequest(modelId, includeTextDetails, fileStream);
await pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 202:
var headers = new AnalyzeWithCustomModelHeaders(message.Response);
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Extract key-value pairs, tables, and semantic values from a given document. The input document must be of one of the supported content types - &apos;application/pdf&apos;, &apos;image/jpeg&apos;, &apos;image/png&apos; or &apos;image/tiff&apos;. Alternatively, use &apos;application/json&apos; type to specify the location (Uri or local path) of the document to be analyzed. </summary>
/// <param name="modelId"> Model identifier. </param>
/// <param name="includeTextDetails"> Include text lines and element references in the result. </param>
/// <param name="fileStream"> .json, .pdf, .jpg, .png or .tiff type file stream. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public ResponseWithHeaders<AnalyzeWithCustomModelHeaders> AnalyzeWithCustomModel(Guid modelId, bool? includeTextDetails, SourcePath fileStream, CancellationToken cancellationToken = default)
{
using var scope = clientDiagnostics.CreateScope("ServiceClient.AnalyzeWithCustomModel");
scope.Start();
try
{
using var message = CreateAnalyzeWithCustomModelRequest(modelId, includeTextDetails, fileStream);
pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 202:
var headers = new AnalyzeWithCustomModelHeaders(message.Response);
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
internal HttpMessage CreateGetAnalyzeFormResultRequest(Guid modelId, Guid resultId)
{
var message = pipeline.CreateMessage();
@ -552,6 +630,80 @@ namespace Azure.AI.FormRecognizer
throw;
}
}
internal HttpMessage CreateAnalyzeReceiptAsyncRequest(bool? includeTextDetails, SourcePath fileStream)
{
var message = pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Post;
var uri = new RawRequestUriBuilder();
uri.AppendRaw(endpoint, false);
uri.AppendRaw("/formrecognizer/v2.0-preview", false);
uri.AppendPath("/prebuilt/receipt/analyze", false);
if (includeTextDetails != null)
{
uri.AppendQuery("includeTextDetails", includeTextDetails.Value, true);
}
request.Uri = uri;
request.Headers.Add("Content-Type", "application/json");
using var content = new Utf8JsonRequestContent();
content.JsonWriter.WriteObjectValue(fileStream);
request.Content = content;
return message;
}
/// <summary> Extract field text and semantic values from a given receipt document. The input document must be of one of the supported content types - &apos;application/pdf&apos;, &apos;image/jpeg&apos;, &apos;image/png&apos; or &apos;image/tiff&apos;. Alternatively, use &apos;application/json&apos; type to specify the location (Uri or local path) of the document to be analyzed. </summary>
/// <param name="includeTextDetails"> Include text lines and element references in the result. </param>
/// <param name="fileStream"> .json, .pdf, .jpg, .png or .tiff type file stream. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<ResponseWithHeaders<AnalyzeReceiptAsyncHeaders>> AnalyzeReceiptAsyncAsync(bool? includeTextDetails, SourcePath fileStream, CancellationToken cancellationToken = default)
{
using var scope = clientDiagnostics.CreateScope("ServiceClient.AnalyzeReceiptAsync");
scope.Start();
try
{
using var message = CreateAnalyzeReceiptAsyncRequest(includeTextDetails, fileStream);
await pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 202:
var headers = new AnalyzeReceiptAsyncHeaders(message.Response);
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Extract field text and semantic values from a given receipt document. The input document must be of one of the supported content types - &apos;application/pdf&apos;, &apos;image/jpeg&apos;, &apos;image/png&apos; or &apos;image/tiff&apos;. Alternatively, use &apos;application/json&apos; type to specify the location (Uri or local path) of the document to be analyzed. </summary>
/// <param name="includeTextDetails"> Include text lines and element references in the result. </param>
/// <param name="fileStream"> .json, .pdf, .jpg, .png or .tiff type file stream. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public ResponseWithHeaders<AnalyzeReceiptAsyncHeaders> AnalyzeReceiptAsync(bool? includeTextDetails, SourcePath fileStream, CancellationToken cancellationToken = default)
{
using var scope = clientDiagnostics.CreateScope("ServiceClient.AnalyzeReceiptAsync");
scope.Start();
try
{
using var message = CreateAnalyzeReceiptAsyncRequest(includeTextDetails, fileStream);
pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 202:
var headers = new AnalyzeReceiptAsyncHeaders(message.Response);
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
internal HttpMessage CreateGetAnalyzeReceiptResultRequest(Guid resultId)
{
var message = pipeline.CreateMessage();
@ -691,6 +843,74 @@ namespace Azure.AI.FormRecognizer
throw;
}
}
internal HttpMessage CreateAnalyzeLayoutAsyncRequest(SourcePath fileStream)
{
var message = pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Post;
var uri = new RawRequestUriBuilder();
uri.AppendRaw(endpoint, false);
uri.AppendRaw("/formrecognizer/v2.0-preview", false);
uri.AppendPath("/layout/analyze", false);
request.Uri = uri;
request.Headers.Add("Content-Type", "application/json");
using var content = new Utf8JsonRequestContent();
content.JsonWriter.WriteObjectValue(fileStream);
request.Content = content;
return message;
}
/// <summary> Extract text and layout information from a given document. The input document must be of one of the supported content types - &apos;application/pdf&apos;, &apos;image/jpeg&apos;, &apos;image/png&apos; or &apos;image/tiff&apos;. Alternatively, use &apos;application/json&apos; type to specify the location (Uri or local path) of the document to be analyzed. </summary>
/// <param name="fileStream"> .json, .pdf, .jpg, .png or .tiff type file stream. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<ResponseWithHeaders<AnalyzeLayoutAsyncHeaders>> AnalyzeLayoutAsyncAsync(SourcePath fileStream, CancellationToken cancellationToken = default)
{
using var scope = clientDiagnostics.CreateScope("ServiceClient.AnalyzeLayoutAsync");
scope.Start();
try
{
using var message = CreateAnalyzeLayoutAsyncRequest(fileStream);
await pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 202:
var headers = new AnalyzeLayoutAsyncHeaders(message.Response);
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw await clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Extract text and layout information from a given document. The input document must be of one of the supported content types - &apos;application/pdf&apos;, &apos;image/jpeg&apos;, &apos;image/png&apos; or &apos;image/tiff&apos;. Alternatively, use &apos;application/json&apos; type to specify the location (Uri or local path) of the document to be analyzed. </summary>
/// <param name="fileStream"> .json, .pdf, .jpg, .png or .tiff type file stream. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public ResponseWithHeaders<AnalyzeLayoutAsyncHeaders> AnalyzeLayoutAsync(SourcePath fileStream, CancellationToken cancellationToken = default)
{
using var scope = clientDiagnostics.CreateScope("ServiceClient.AnalyzeLayoutAsync");
scope.Start();
try
{
using var message = CreateAnalyzeLayoutAsyncRequest(fileStream);
pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 202:
var headers = new AnalyzeLayoutAsyncHeaders(message.Response);
return ResponseWithHeaders.FromValue(headers, message.Response);
default:
throw clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
internal HttpMessage CreateGetAnalyzeLayoutResultRequest(Guid resultId)
{
var message = pipeline.CreateMessage();

Просмотреть файл

@ -60,7 +60,7 @@ namespace AutoRest.CSharp.V3.Output.Builders
Dictionary<string, OperationMethod> operationMethods = new Dictionary<string, OperationMethod>(StringComparer.InvariantCultureIgnoreCase);
foreach (Operation operation in operationGroup.Operations)
{
int overloadCount = 0;
int overloadSuffix = 0;
foreach (ServiceRequest serviceRequest in operation.Requests)
{
HttpRequest? httpRequest = serviceRequest.Protocol.Http as HttpRequest;
@ -71,7 +71,9 @@ namespace AutoRest.CSharp.V3.Output.Builders
}
RestClientMethod method = BuildMethod(operation, clientName, clientParameters, httpRequest, serviceRequest.Parameters);
operationMethods.Add($"{operation.Language.Default.Name}{overloadCount++}", new OperationMethod(operation, method));
string suffix = overloadSuffix > 0 ? $"{overloadSuffix}" : String.Empty;
overloadSuffix++;
operationMethods.Add($"{operation.Language.Default.Name}{suffix}", new OperationMethod(operation, method));
}
}

Просмотреть файл

@ -28,7 +28,7 @@ namespace media_types
/// <summary> Analyze body, that could be different media types. </summary>
/// <param name="contentType"> Upload file type. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async ValueTask<Response<string>> AnalyzeBodyAsync(ContentType? contentType, CancellationToken cancellationToken = default)
public virtual async Task<Response<string>> AnalyzeBodyAsync(ContentType? contentType, CancellationToken cancellationToken = default)
{
return await RestClient.AnalyzeBodyAsync(contentType, cancellationToken).ConfigureAwait(false);
}
@ -42,7 +42,7 @@ namespace media_types
/// <summary> Analyze body, that could be different media types. </summary>
/// <param name="input"> Input parameter. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async ValueTask<Response<string>> AnalyzeBodyAsync(SourcePath input, CancellationToken cancellationToken = default)
public virtual async Task<Response<string>> AnalyzeBodyAsync(SourcePath input, CancellationToken cancellationToken = default)
{
return await RestClient.AnalyzeBodyAsync(input, cancellationToken).ConfigureAwait(false);
}