public FormRecognizerLiveTestBase(bool isAsync, FormRecognizerClientOptions.ServiceVersion serviceVersion) : base(isAsync) { _serviceVersion = serviceVersion; JsonPathSanitizers.Add("$..accessToken"); JsonPathSanitizers.Add("$..source"); SanitizedHeaders.Add(Constants.AuthorizationHeader); }
/// <summary> /// Initializes a new instance of the <see cref="CreateCustomFormModelOperation"/> class which /// tracks the status of a long-running operation for creating a custom model. /// </summary> /// <param name="operationId">The ID of this operation.</param> /// <param name="client">The client used to check for completion.</param> public CreateCustomFormModelOperation(string operationId, FormTrainingClient client) { Argument.AssertNotNull(client, nameof(client)); Id = operationId; _diagnostics = client.Diagnostics; _serviceClient = client.ServiceClient; _serviceVersion = client.ServiceVersion; }
/// <summary> /// Initializes a new instance of the <see cref="CreateCustomFormModelOperation"/> class which /// tracks the status of a long-running operation for creating a custom model. /// </summary> /// <param name="operationId">The ID of this operation.</param> /// <param name="client">The client used to check for completion.</param> public CreateCustomFormModelOperation(string operationId, FormTrainingClient client) { Argument.AssertNotNull(client, nameof(client)); Id = operationId; _diagnostics = client.Diagnostics; _serviceClient = client.ServiceClient; _serviceVersion = client.ServiceVersion; _operationInternal = new(_diagnostics, this, rawResponse : null, nameof(CreateCustomFormModelOperation)); }
public FormRecognizerLiveTestBase(bool isAsync, FormRecognizerClientOptions.ServiceVersion serviceVersion) : base(isAsync) { _serviceVersion = serviceVersion; JsonPathSanitizers.Add("$..accessToken"); JsonPathSanitizers.Add("$..containerUrl"); SanitizedHeaders.Add(Constants.AuthorizationHeader); // temporary until https://github.com/Azure/azure-sdk-for-net/issues/27688 is addressed CompareBodies = false; }
/// <summary> /// Initializes a new instance of the <see cref="FormTrainingClient"/> class. /// </summary> /// <param name="endpoint">The endpoint to use for connecting to the Form Recognizer Azure Cognitive Service.</param> /// <param name="credential">A credential used to authenticate to an Azure Service.</param> /// <param name="options">A set of options to apply when configuring the client.</param> /// <remarks> /// The <paramref name="endpoint"/> URI string can be found in the Azure Portal. /// For more information see <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/formrecognizer/Azure.AI.FormRecognizer/README.md#authenticate-a-form-recognizer-client"> here</see>. /// </remarks> public FormTrainingClient(Uri endpoint, TokenCredential credential, FormRecognizerClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); Argument.AssertNotNull(credential, nameof(credential)); Argument.AssertNotNull(options, nameof(options)); Diagnostics = new ClientDiagnostics(options); ServiceVersion = options.Version; var pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, Constants.DefaultCognitiveScope)); ServiceClient = new FormRecognizerRestClient(Diagnostics, pipeline, endpoint.AbsoluteUri, FormRecognizerClientOptions.GetVersionString(ServiceVersion)); }
/// <summary> /// Initializes a new instance of the <see cref="FormTrainingClient"/> class. /// </summary> /// <param name="endpoint">The endpoint to use for connecting to the Form Recognizer Azure Cognitive Service.</param> /// <param name="credential">A credential used to authenticate to an Azure Service.</param> /// <param name="options">A set of options to apply when configuring the client.</param> /// <remarks> /// Both the <paramref name="endpoint"/> URI string and the <paramref name="credential"/> <c>string</c> key /// can be found in the Azure Portal. /// For more information see <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/formrecognizer/Azure.AI.FormRecognizer/README.md#authenticate-a-form-recognizer-client"> here</see>. /// </remarks> public FormTrainingClient(Uri endpoint, AzureKeyCredential credential, FormRecognizerClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); Argument.AssertNotNull(credential, nameof(credential)); Argument.AssertNotNull(options, nameof(options)); Diagnostics = new ClientDiagnostics(options); ServiceVersion = options.Version; HttpPipeline pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, Constants.AuthorizationHeader)); ServiceClient = new FormRecognizerRestClient(Diagnostics, pipeline, endpoint.AbsoluteUri, FormRecognizerClientOptions.GetVersionString(ServiceVersion)); }
internal CustomFormModel(Model model, FormRecognizerClientOptions.ServiceVersion serviceVersion) { ModelId = model.ModelInfo.ModelId; ModelName = model.ModelInfo.ModelName; Status = model.ModelInfo.Status; TrainingStartedOn = model.ModelInfo.TrainingStartedOn; TrainingCompletedOn = model.ModelInfo.TrainingCompletedOn; Submodels = ConvertToSubmodels(model, serviceVersion); TrainingDocuments = ConvertToTrainingDocuments(model); Errors = model.TrainResult?.Errors ?? new List <FormRecognizerError>(); Properties = model.ModelInfo.Properties ?? new CustomFormModelProperties(); }
internal CreateCustomFormModelOperation( string location, FormRecognizerRestClient allOperations, ClientDiagnostics diagnostics, FormRecognizerClientOptions.ServiceVersion serviceVersion) { _serviceClient = allOperations; _diagnostics = diagnostics; _serviceVersion = serviceVersion; _operationInternal = new(_diagnostics, this, rawResponse : null, nameof(CreateCustomFormModelOperation)); Id = location.Split('/').Last(); }
internal CreateCustomFormModelOperation( string location, FormRecognizerRestClient allOperations, ClientDiagnostics diagnostics, FormRecognizerClientOptions.ServiceVersion serviceVersion) { _serviceClient = allOperations; _diagnostics = diagnostics; _serviceVersion = serviceVersion; // TODO: validate this // https://github.com/Azure/azure-sdk-for-net/issues/10385 Id = location.Split('/').Last(); }
/// <summary> /// Initializes a new instance of the <see cref="FormTrainingClient"/> class. /// </summary> /// <param name="endpoint">The endpoint to use for connecting to the Form Recognizer Azure Cognitive Service.</param> /// <param name="credential">A credential used to authenticate to an Azure Service.</param> /// <param name="options">A set of options to apply when configuring the client.</param> /// <remarks> /// The <paramref name="endpoint"/> URI string can be found in the Azure Portal. /// For more information see <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/formrecognizer/Azure.AI.FormRecognizer/README.md#authenticate-a-form-recognizer-client"> here</see>. /// </remarks> public FormTrainingClient(Uri endpoint, TokenCredential credential, FormRecognizerClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); Argument.AssertNotNull(credential, nameof(credential)); Argument.AssertNotNull(options, nameof(options)); string defaultScope = $"{(string.IsNullOrEmpty(options.Audience?.ToString()) ? FormRecognizerAudience.AzurePublicCloud : options.Audience)}/.default"; Diagnostics = new ClientDiagnostics(options); ServiceVersion = options.Version; var pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, defaultScope)); ServiceClient = new FormRecognizerRestClient(Diagnostics, pipeline, endpoint.AbsoluteUri, FormRecognizerClientOptions.GetVersionString(ServiceVersion)); }
/// <summary> /// Initializes a new instance of the <see cref="FormTrainingClientLiveTests"/> class. /// </summary> /// <param name="isAsync">A flag used by the Azure Core Test Framework to differentiate between tests for asynchronous and synchronous methods.</param> public FormTrainingClientLiveTests(bool isAsync, FormRecognizerClientOptions.ServiceVersion serviceVersion) : base(isAsync, serviceVersion) { }
private static IReadOnlyList <CustomFormSubmodel> ConvertToSubmodels(Model model, FormRecognizerClientOptions.ServiceVersion serviceVersion = default) { if (model.Keys != null) { return(ConvertFromUnlabeled(model)); } if (model.TrainResult != null) { return(ConvertFromLabeled(model, serviceVersion)); } if (model.ComposedTrainResults != null) { return(ConvertFromLabeledComposedModel(model)); } return(null); }
public RecognizeCustomFormsLiveTests(bool isAsync, FormRecognizerClientOptions.ServiceVersion serviceVersion) : base(isAsync, serviceVersion) { }
/// <summary> /// Initializes a new instance of the <see cref="FormRecognizerOperationsLiveTests"/> class. /// </summary> /// <param name="isAsync">A flag used by the Azure Core Test Framework to differentiate between tests for asynchronous and synchronous methods.</param> public FormRecognizerOperationsLiveTests(bool isAsync, FormRecognizerClientOptions.ServiceVersion serviceVersion) : base(isAsync, serviceVersion) { }
public RecognizeBusinessCardsLiveTests(bool isAsync, FormRecognizerClientOptions.ServiceVersion serviceVersion) : base(isAsync, serviceVersion) { }
public RecognizeIdentityDocumentsLiveTests(bool isAsync, FormRecognizerClientOptions.ServiceVersion serviceVersion) : base(isAsync, serviceVersion) { }
internal TrainingOperation(string location, FormRecognizerRestClient allOperations, ClientDiagnostics diagnostics, FormRecognizerClientOptions.ServiceVersion serviceVersion) : base(location, allOperations, diagnostics, serviceVersion) { }
public FormRecognizerLiveTestBase(bool isAsync, FormRecognizerClientOptions.ServiceVersion serviceVersion) : base(isAsync) { _serviceVersion = serviceVersion; Sanitizer = new FormRecognizerRecordedTestSanitizer(); }
internal CreateComposedModelOperation(string location, FormRecognizerRestClient allOperations, ClientDiagnostics diagnostics, FormRecognizerClientOptions.ServiceVersion serviceVersion) : base(location, allOperations, diagnostics, serviceVersion) { }