/// <summary>
        /// Initializes a new instance of the <see cref="AnalyzeBatchActionsOperation"/> class.
        /// </summary>
        /// <param name="operationId">The ID of this operation.</param>
        /// <param name="client">The client used to check for completion.</param>
        public AnalyzeBatchActionsOperation(string operationId, TextAnalyticsClient client)
        {
            // TODO: Add argument validation here.

            Id             = operationId;
            _serviceClient = client._serviceRestClient;
            _diagnostics   = client._clientDiagnostics;
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnalyzeActionsOperation"/> class.
 /// </summary>
 /// <param name="operationId">The ID of this operation.</param>
 /// <param name="client">The client used to check for completion.</param>
 public AnalyzeActionsOperation(string operationId, TextAnalyticsClient client)
 {
     // TODO: Add argument validation here.
     Id                 = operationId;
     _serviceClient     = client._serviceRestClient;
     _diagnostics       = client._clientDiagnostics;
     _operationInternal = new OperationInternal <AsyncPageable <AnalyzeActionsResult> >(_diagnostics, this, rawResponse: null);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="AnalyzeHealthcareEntitiesOperation"/> class.
        /// </summary>
        /// <param name="operationId">The ID of this operation.</param>
        /// <param name="client">The client used to check for completion.</param>
        public AnalyzeHealthcareEntitiesOperation(string operationId, TextAnalyticsClient client)
        {
            // TODO: Add argument validation here.

            Id                 = operationId;
            _serviceClient     = client._serviceRestClient;
            _diagnostics       = client._clientDiagnostics;
            _operationInternal = new(_diagnostics, this, rawResponse : null);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AnalyzeBatchActionsOperation"/> class.
        /// </summary>
        /// <param name="serviceClient">The client for communicating with the Form Recognizer Azure Cognitive Service through its REST API.</param>
        /// <param name="diagnostics">The client diagnostics for exception creation in case of failure.</param>
        /// <param name="operationLocation">The address of the long-running operation. It can be obtained from the response headers upon starting the operation.</param>
        /// <param name="idToIndexMap"></param>
        /// <param name="showStats"></param>
        internal AnalyzeBatchActionsOperation(TextAnalyticsRestClient serviceClient, ClientDiagnostics diagnostics, string operationLocation, IDictionary <string, int> idToIndexMap, bool?showStats = default)
        {
            _serviceClient = serviceClient;
            _diagnostics   = diagnostics;
            _idToIndexMap  = idToIndexMap;
            _showStats     = showStats;

            // TODO: Add validation here
            // https://github.com/Azure/azure-sdk-for-net/issues/11505
            Id = operationLocation.Split('/').Last();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AnalyzeActionsOperation"/> class.
        /// </summary>
        /// <param name="serviceClient">The client for communicating with the Form Recognizer Azure Cognitive Service through its REST API.</param>
        /// <param name="diagnostics">The client diagnostics for exception creation in case of failure.</param>
        /// <param name="operationLocation">The address of the long-running operation. It can be obtained from the response headers upon starting the operation.</param>
        /// <param name="idToIndexMap"></param>
        /// <param name="showStats"></param>
        internal AnalyzeActionsOperation(TextAnalyticsRestClient serviceClient, ClientDiagnostics diagnostics, string operationLocation, IDictionary <string, int> idToIndexMap, bool?showStats = default)
        {
            _serviceClient     = serviceClient;
            _diagnostics       = diagnostics;
            _idToIndexMap      = idToIndexMap;
            _showStats         = showStats;
            _operationInternal = new OperationInternal <AsyncPageable <AnalyzeActionsResult> >(_diagnostics, this, rawResponse: null);

            // TODO: Add validation here
            // https://github.com/Azure/azure-sdk-for-net/issues/11505
            Id = operationLocation.Split('/').Last();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AnalyzeHealthcareEntitiesOperation"/> class.
        /// </summary>
        /// <param name="serviceClient">The client for communicating with the Text Analytics Azure Cognitive Service through its REST API.</param>
        /// <param name="diagnostics">The client diagnostics for exception creation in case of failure.</param>
        /// <param name="operationLocation">The address of the long-running operation. It can be obtained from the response headers upon starting the operation.</param>
        /// <param name="idToIndexMap"></param>
        /// <param name="showStats"></param>
        internal AnalyzeHealthcareEntitiesOperation(TextAnalyticsRestClient serviceClient, ClientDiagnostics diagnostics, string operationLocation, IDictionary <string, int> idToIndexMap, bool?showStats = default)
        {
            _serviceClient     = serviceClient;
            _diagnostics       = diagnostics;
            _idToIndexMap      = idToIndexMap;
            _showStats         = showStats;
            _operationInternal = new(_diagnostics, this, rawResponse : null);

            // TODO: Add validation here
            // https://github.com/Azure/azure-sdk-for-net/issues/11505
            _jobId = operationLocation.Split('/').Last();

            Id = OperationContinuationToken.Serialize(_jobId, idToIndexMap, showStats);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AnalyzeHealthcareEntitiesOperation"/> class.
        /// </summary>
        /// <param name="operationId">The ID of this operation.</param>
        /// <param name="client">The client used to check for completion.</param>
        public AnalyzeHealthcareEntitiesOperation(string operationId, TextAnalyticsClient client)
        {
            Argument.AssertNotNullOrEmpty(operationId, nameof(operationId));
            Argument.AssertNotNull(client, nameof(client));

            try
            {
                OperationContinuationToken token = OperationContinuationToken.Deserialize(operationId);

                _jobId        = token.JobId;
                _showStats    = token.ShowStats;
                _idToIndexMap = token.InputDocumentOrder;
            }
            catch (Exception e)
            {
                throw new ArgumentException($"Invalid value. Please use the {nameof(AnalyzeHealthcareEntitiesOperation)}.{nameof(Id)} property value.", nameof(operationId), e);
            }

            Id                 = operationId;
            _serviceClient     = client._serviceRestClient;
            _diagnostics       = client._clientDiagnostics;
            _operationInternal = new(_diagnostics, this, rawResponse : null);
        }