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