Exemple #1
0
 internal AccountingSummaryApiModel(AccountingAmortizationSummaryApiModel amortizationSummary, IReadOnlyList <AccountingMonthlyInvoicesSummaryApiModel> amortizedInvoicesSummary, IReadOnlyList <AccountingMonthlyExpensesSummaryApiModel> expensesSummary, IReadOnlyList <AccountingMonthlyInvoicesSummaryApiModel> issuedInvoicesSummary, IReadOnlyList <AccountingMonthlyInvoicesSummaryApiModel> receivedInvoicesSummary)
 {
     AmortizationSummary      = amortizationSummary;
     AmortizedInvoicesSummary = amortizedInvoicesSummary;
     ExpensesSummary          = expensesSummary;
     IssuedInvoicesSummary    = issuedInvoicesSummary;
     ReceivedInvoicesSummary  = receivedInvoicesSummary;
 }
Exemple #2
0
        internal static AccountingSummaryApiModel DeserializeAccountingSummaryApiModel(JsonElement element)
        {
            Optional <AccountingAmortizationSummaryApiModel> amortizationSummary = default;
            Optional <IReadOnlyList <AccountingMonthlyInvoicesSummaryApiModel> > amortizedInvoicesSummary = default;
            Optional <IReadOnlyList <AccountingMonthlyExpensesSummaryApiModel> > expensesSummary          = default;
            Optional <IReadOnlyList <AccountingMonthlyInvoicesSummaryApiModel> > issuedInvoicesSummary    = default;
            Optional <IReadOnlyList <AccountingMonthlyInvoicesSummaryApiModel> > receivedInvoicesSummary  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("amortizationSummary"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    amortizationSummary = AccountingAmortizationSummaryApiModel.DeserializeAccountingAmortizationSummaryApiModel(property.Value);
                    continue;
                }
                if (property.NameEquals("amortizedInvoicesSummary"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <AccountingMonthlyInvoicesSummaryApiModel> array = new List <AccountingMonthlyInvoicesSummaryApiModel>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(AccountingMonthlyInvoicesSummaryApiModel.DeserializeAccountingMonthlyInvoicesSummaryApiModel(item));
                    }
                    amortizedInvoicesSummary = array;
                    continue;
                }
                if (property.NameEquals("expensesSummary"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <AccountingMonthlyExpensesSummaryApiModel> array = new List <AccountingMonthlyExpensesSummaryApiModel>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(AccountingMonthlyExpensesSummaryApiModel.DeserializeAccountingMonthlyExpensesSummaryApiModel(item));
                    }
                    expensesSummary = array;
                    continue;
                }
                if (property.NameEquals("issuedInvoicesSummary"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <AccountingMonthlyInvoicesSummaryApiModel> array = new List <AccountingMonthlyInvoicesSummaryApiModel>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(AccountingMonthlyInvoicesSummaryApiModel.DeserializeAccountingMonthlyInvoicesSummaryApiModel(item));
                    }
                    issuedInvoicesSummary = array;
                    continue;
                }
                if (property.NameEquals("receivedInvoicesSummary"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <AccountingMonthlyInvoicesSummaryApiModel> array = new List <AccountingMonthlyInvoicesSummaryApiModel>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(AccountingMonthlyInvoicesSummaryApiModel.DeserializeAccountingMonthlyInvoicesSummaryApiModel(item));
                    }
                    receivedInvoicesSummary = array;
                    continue;
                }
            }
            return(new AccountingSummaryApiModel(amortizationSummary.Value, Optional.ToList(amortizedInvoicesSummary), Optional.ToList(expensesSummary), Optional.ToList(issuedInvoicesSummary), Optional.ToList(receivedInvoicesSummary)));
        }