internal static AnalyzeOperationResult DeserializeAnalyzeOperationResult(JsonElement element)
        {
            OperationStatus          status              = default;
            DateTimeOffset           createdDateTime     = default;
            DateTimeOffset           lastUpdatedDateTime = default;
            Optional <AnalyzeResult> analyzeResult       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("status"))
                {
                    status = property.Value.GetString().ToOperationStatus();
                    continue;
                }
                if (property.NameEquals("createdDateTime"))
                {
                    createdDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("lastUpdatedDateTime"))
                {
                    lastUpdatedDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("analyzeResult"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        analyzeResult = null;
                        continue;
                    }
                    analyzeResult = AnalyzeResult.DeserializeAnalyzeResult(property.Value);
                    continue;
                }
            }
            return(new AnalyzeOperationResult(status, createdDateTime, lastUpdatedDateTime, analyzeResult.Value));
        }
Exemplo n.º 2
0
 internal AnalyzeOperationResult(OperationStatus status, DateTimeOffset createdDateTime, DateTimeOffset lastUpdatedDateTime, AnalyzeResult analyzeResult)
 {
     Status              = status;
     CreatedDateTime     = createdDateTime;
     LastUpdatedDateTime = lastUpdatedDateTime;
     AnalyzeResult       = analyzeResult;
 }
Exemplo n.º 3
0
 private static RecognizedFormCollection ConvertToRecognizedForms(AnalyzeResult analyzeResult)
 {
     return(analyzeResult.DocumentResults?.Count == 0 ?
            ConvertUnsupervisedResult(analyzeResult) :
            ConvertSupervisedResult(analyzeResult));
 }