internal static ApiListResultFileApiModel DeserializeApiListResultFileApiModel(JsonElement element) { Optional <long> count = default; Optional <IReadOnlyList <FileApiModel> > 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 <FileApiModel> array = new List <FileApiModel>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(FileApiModel.DeserializeFileApiModel(item)); } data = array; continue; } if (property.NameEquals("totalCount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } totalCount = property.Value.GetInt64(); continue; } } return(new ApiListResultFileApiModel(Optional.ToNullable(count), Optional.ToList(data), Optional.ToNullable(totalCount))); }
internal static ApiResultFileApiModel DeserializeApiResultFileApiModel(JsonElement element) { Optional <FileApiModel> data = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("data")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } data = FileApiModel.DeserializeFileApiModel(property.Value); continue; } } return(new ApiResultFileApiModel(data.Value)); }
internal static ApiListResultFileApiModel DeserializeApiListResultFileApiModel(XElement element) { long?count = default; long?totalCount = default; IReadOnlyList <FileApiModel> 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 <FileApiModel>(); foreach (var e in element.Elements("FileApiModel")) { array.Add(FileApiModel.DeserializeFileApiModel(e)); } data = array; return(new ApiListResultFileApiModel(count, data, totalCount)); }