internal static ApiListResultPushToken DeserializeApiListResultPushToken(JsonElement element) { Optional <long> count = default; Optional <IReadOnlyList <PushToken> > data = default; Optional <long> totalCount = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("count")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } count = property.Value.GetInt64(); continue; } if (property.NameEquals("data")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <PushToken> array = new List <PushToken>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(PushToken.DeserializePushToken(item)); } data = array; continue; } if (property.NameEquals("totalCount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } totalCount = property.Value.GetInt64(); continue; } } return(new ApiListResultPushToken(Optional.ToNullable(count), Optional.ToList(data), Optional.ToNullable(totalCount))); }
internal static ApiListResultPushToken DeserializeApiListResultPushToken(XElement element) { long?count = default; long?totalCount = default; IReadOnlyList <PushToken> data = default; if (element.Element("count") is XElement countElement) { count = (long?)countElement; } if (element.Element("totalCount") is XElement totalCountElement) { totalCount = (long?)totalCountElement; } var array = new List <PushToken>(); foreach (var e in element.Elements("PushToken")) { array.Add(PushToken.DeserializePushToken(e)); } data = array; return(new ApiListResultPushToken(count, data, totalCount)); }