Beispiel #1
0
        internal static LegalHoldProperties DeserializeLegalHoldProperties(JsonElement element)
        {
            Optional <bool> hasLegalHold = default;
            Optional <IReadOnlyList <TagProperty> > tags = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("hasLegalHold"))
                {
                    hasLegalHold = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    List <TagProperty> array = new List <TagProperty>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TagProperty.DeserializeTagProperty(item));
                    }
                    tags = array;
                    continue;
                }
            }
            return(new LegalHoldProperties(Optional.ToNullable(hasLegalHold), Optional.ToList(tags)));
        }
        internal static LegalHoldProperties DeserializeLegalHoldProperties(JsonElement element)
        {
            Optional <bool> hasLegalHold = default;
            Optional <IReadOnlyList <TagProperty> > tags = default;
            Optional <ProtectedAppendWritesHistory> protectedAppendWritesHistory = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("hasLegalHold"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    hasLegalHold = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <TagProperty> array = new List <TagProperty>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TagProperty.DeserializeTagProperty(item));
                    }
                    tags = array;
                    continue;
                }
                if (property.NameEquals("protectedAppendWritesHistory"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    protectedAppendWritesHistory = ProtectedAppendWritesHistory.DeserializeProtectedAppendWritesHistory(property.Value);
                    continue;
                }
            }
            return(new LegalHoldProperties(Optional.ToNullable(hasLegalHold), Optional.ToList(tags), protectedAppendWritesHistory.Value));
        }
        internal static LegalHoldProperties DeserializeLegalHoldProperties(JsonElement element)
        {
            bool?hasLegalHold        = default;
            IList <TagProperty> tags = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("hasLegalHold"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    hasLegalHold = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <TagProperty> array = new List <TagProperty>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(TagProperty.DeserializeTagProperty(item));
                        }
                    }
                    tags = array;
                    continue;
                }
            }
            return(new LegalHoldProperties(hasLegalHold, tags));
        }