Exemple #1
0
        internal static IndexingResult DeserializeIndexingResult(JsonElement element)
        {
            IndexingResult result = new IndexingResult();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("key"))
                {
                    result.Key = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("errorMessage"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.ErrorMessage = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    result.Succeeded = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("statusCode"))
                {
                    result.Status = property.Value.GetInt32();
                    continue;
                }
            }
            return(result);
        }
Exemple #2
0
        internal static IndexDocumentsResult DeserializeIndexDocumentsResult(JsonElement element)
        {
            IndexDocumentsResult result = new IndexDocumentsResult();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        result.Results.Add(IndexingResult.DeserializeIndexingResult(item));
                    }
                    continue;
                }
            }
            return(result);
        }