/// <summary> /// Initializes a new instance of the <see cref="CopyModelOperation"/> class which /// tracks the status of the long-running operation for copying a custom model into a target Form Recognizer resource. /// </summary> /// <param name="operationId">The ID of this operation.</param> /// <param name="targetModelId">Model ID in the target Form Recognizer resource.</param> /// <param name="client">The client used to check for completion.</param> public CopyModelOperation(string operationId, string targetModelId, FormTrainingClient client) { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); Argument.AssertNotNull(client, nameof(client)); _serviceClient = client.ServiceClient; _diagnostics = client.Diagnostics; _targetModelId = targetModelId; _operationInternal = new(_diagnostics, this, rawResponse : null); // TODO: Use regex to parse ids. // https://github.com/Azure/azure-sdk-for-net/issues/11505 // TODO: Add validation here (should we store _resuldId and _modelId as GUIDs?) // https://github.com/Azure/azure-sdk-for-net/issues/10385 string[] substrs = operationId.Split('/'); if (substrs.Length < 3) { throw new ArgumentException($"Invalid '{nameof(operationId)}'. It should be formatted as: '{{modelId}}/copyresults/{{resultId}}'.", nameof(operationId)); } _resultId = substrs.Last(); _modelId = substrs.First(); Id = operationId; }
/// <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; }
/// <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)); }
/// <summary> /// Initializes a new instance of the <see cref="CopyModelOperation"/> class which /// tracks the status of the long-running operation for copying a custom model into a target Form Recognizer resource. /// </summary> /// <param name="operationId">The ID of this operation.</param> /// <param name="targetModelId">Model ID in the target Form Recognizer resource.</param> /// <param name="client">The client used to check for completion.</param> public CopyModelOperation(string operationId, string targetModelId, FormTrainingClient client) { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); Argument.AssertNotNull(client, nameof(client)); _serviceClient = client.ServiceClient; _diagnostics = client.Diagnostics; _targetModelId = targetModelId; _operationInternal = new(_diagnostics, this, rawResponse : null); string[] substrs = operationId.Split('/'); if (substrs.Length < 3) { throw new ArgumentException($"Invalid '{nameof(operationId)}'. It should be formatted as: '{{modelId}}/copyresults/{{resultId}}'.", nameof(operationId)); } _resultId = substrs.Last(); _modelId = substrs.First(); Id = operationId; }
/// <summary> /// Initializes a new instance of the <see cref="CopyModelOperation"/> class. /// </summary> /// <param name="operationId">The ID of this operation.</param> /// <param name="client">The client used to check for completion.</param> /// /// <param name="targetModelId">Model id in the target Form Recognizer Resource.</param> public CopyModelOperation(string operationId, string targetModelId, FormTrainingClient client) { _serviceClient = client.ServiceClient; _diagnostics = client.Diagnostics; _targetModelId = targetModelId; // TODO: Use regex to parse ids. // https://github.com/Azure/azure-sdk-for-net/issues/11505 // TODO: Add validation here (should we store _resuldId and _modelId as GUIDs?) // https://github.com/Azure/azure-sdk-for-net/issues/10385 string[] substrs = operationId.Split('/'); if (substrs.Length < 3) { throw new ArgumentException($"Invalid {operationId}. It should be formatted as: '{{modelId}}/analyzeresults/{{resultId}}'.", operationId); } _resultId = substrs.Last(); _modelId = substrs.First(); Id = operationId; }
/// <summary> /// Initializes a new instance of the <see cref="TrainingOperation"/> class. /// </summary> /// <param name="operationId">The ID of this operation.</param> /// <param name="client">The client used to check for completion.</param> public TrainingOperation(string operationId, FormTrainingClient client) { Id = operationId; _serviceClient = client.ServiceClient; }
/// <summary> /// Initializes a new <see cref="TrainingOperation"/> instance. /// </summary> /// <param name="operationId">The ID of this operation.</param> /// <param name="client">The client used to check for completion.</param> /// <param name="cancellationToken"></param> public TrainingOperation(string operationId, FormTrainingClient client, CancellationToken cancellationToken = default) { Id = operationId; _serviceClient = client.ServiceClient; _cancellationToken = cancellationToken; }
/// <summary> /// Initializes a new instance of the <see cref="TrainingOperation"/> class. /// </summary> /// <param name="operationId">The ID of this operation.</param> /// <param name="client">The client used to check for completion.</param> public CreateComposedModelOperation(string operationId, FormTrainingClient client) : base(operationId, client) { }
/// <summary> /// Initializes a new instance of the <see cref="TrainingOperation"/> class which /// tracks the status of a long-running operation for training a model from a collection of custom forms. /// </summary> /// <param name="operationId">The ID of this operation.</param> /// <param name="client">The client used to check for completion.</param> public TrainingOperation(string operationId, FormTrainingClient client) : base(operationId, client) { }
/// <summary> /// Initializes a new instance of the <see cref="TrainingOperation"/> class. /// </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) { Id = operationId; _diagnostics = client.Diagnostics; _serviceClient = client.ServiceClient; }