internal static SearchInstancesResponsePage DeserializeSearchInstancesResponsePage(JsonElement element)
        {
            Optional <SearchInstancesResponse>      instances      = default;
            Optional <SearchHierarchyNodesResponse> hierarchyNodes = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("instances"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    instances = SearchInstancesResponse.DeserializeSearchInstancesResponse(property.Value);
                    continue;
                }
                if (property.NameEquals("hierarchyNodes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    hierarchyNodes = SearchHierarchyNodesResponse.DeserializeSearchHierarchyNodesResponse(property.Value);
                    continue;
                }
            }
            return(new SearchInstancesResponsePage(instances.Value, hierarchyNodes.Value));
        }
コード例 #2
0
        internal static HierarchyHit DeserializeHierarchyHit(JsonElement element)
        {
            Optional <string> name = default;
            Optional <int>    cumulativeInstanceCount = default;
            Optional <SearchHierarchyNodesResponse> hierarchyNodes = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("cumulativeInstanceCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    cumulativeInstanceCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("hierarchyNodes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    hierarchyNodes = SearchHierarchyNodesResponse.DeserializeSearchHierarchyNodesResponse(property.Value);
                    continue;
                }
            }
            return(new HierarchyHit(name.Value, Optional.ToNullable(cumulativeInstanceCount), hierarchyNodes.Value));
        }