internal static SharingStatus DeserializeSharingStatus(JsonElement element) { Optional <SharingState> aggregatedState = default; Optional <IReadOnlyList <RegionalSharingStatus> > summary = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("aggregatedState")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } aggregatedState = new SharingState(property.Value.GetString()); continue; } if (property.NameEquals("summary")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <RegionalSharingStatus> array = new List <RegionalSharingStatus>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(RegionalSharingStatus.DeserializeRegionalSharingStatus(item)); } summary = array; continue; } } return(new SharingStatus(Optional.ToNullable(aggregatedState), Optional.ToList(summary))); }
internal static RegionalSharingStatus DeserializeRegionalSharingStatus(JsonElement element) { Optional <string> region = default; Optional <SharingState> state = default; Optional <string> details = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("region")) { region = property.Value.GetString(); continue; } if (property.NameEquals("state")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } state = new SharingState(property.Value.GetString()); continue; } if (property.NameEquals("details")) { details = property.Value.GetString(); continue; } } return(new RegionalSharingStatus(region.Value, Optional.ToNullable(state), details.Value)); }