aboutsummaryrefslogtreecommitdiffstats
path: root/ynab-api/src/models
diff options
context:
space:
mode:
Diffstat (limited to 'ynab-api/src/models')
-rw-r--r--ynab-api/src/models/account.rs8
-rw-r--r--ynab-api/src/models/budget_summary_response_data.rs8
-rw-r--r--ynab-api/src/models/category.rs32
-rw-r--r--ynab-api/src/models/hybrid_transaction.rs50
-rw-r--r--ynab-api/src/models/month_detail.rs14
-rw-r--r--ynab-api/src/models/month_summary.rs14
-rw-r--r--ynab-api/src/models/payee.rs8
-rw-r--r--ynab-api/src/models/scheduled_sub_transaction.rs20
-rw-r--r--ynab-api/src/models/scheduled_transaction_detail.rs20
-rw-r--r--ynab-api/src/models/scheduled_transaction_summary.rs20
-rw-r--r--ynab-api/src/models/sub_transaction.rs26
-rw-r--r--ynab-api/src/models/transaction_detail.rs50
-rw-r--r--ynab-api/src/models/transaction_summary.rs50
13 files changed, 160 insertions, 160 deletions
diff --git a/ynab-api/src/models/account.rs b/ynab-api/src/models/account.rs
index 88f0353..6ffa1d5 100644
--- a/ynab-api/src/models/account.rs
+++ b/ynab-api/src/models/account.rs
@@ -28,8 +28,8 @@ pub struct Account {
/// Whether this account is closed or not
#[serde(rename = "closed")]
pub closed: bool,
- #[serde(rename = "note")]
- pub note: String,
+ #[serde(rename = "note", skip_serializing_if = "Option::is_none")]
+ pub note: Option<String>,
/// The current balance of the account in milliunits format
#[serde(rename = "balance")]
pub balance: i64,
@@ -48,14 +48,14 @@ pub struct Account {
}
impl Account {
- pub fn new(id: String, name: String, _type: String, on_budget: bool, closed: bool, note: String, balance: i64, cleared_balance: i64, uncleared_balance: i64, transfer_payee_id: String, deleted: bool) -> Account {
+ pub fn new(id: String, name: String, _type: String, on_budget: bool, closed: bool, balance: i64, cleared_balance: i64, uncleared_balance: i64, transfer_payee_id: String, deleted: bool) -> Account {
Account {
id: id,
name: name,
_type: _type,
on_budget: on_budget,
closed: closed,
- note: note,
+ note: None,
balance: balance,
cleared_balance: cleared_balance,
uncleared_balance: uncleared_balance,
diff --git a/ynab-api/src/models/budget_summary_response_data.rs b/ynab-api/src/models/budget_summary_response_data.rs
index 35f3840..f6bec05 100644
--- a/ynab-api/src/models/budget_summary_response_data.rs
+++ b/ynab-api/src/models/budget_summary_response_data.rs
@@ -17,15 +17,15 @@ use serde_json::Value;
pub struct BudgetSummaryResponseData {
#[serde(rename = "budgets")]
pub budgets: Vec<::models::BudgetSummary>,
- #[serde(rename = "default_budget")]
- pub default_budget: ::models::BudgetSummary,
+ #[serde(rename = "default_budget", skip_serializing_if = "Option::is_none")]
+ pub default_budget: Option<::models::BudgetSummary>,
}
impl BudgetSummaryResponseData {
- pub fn new(budgets: Vec<::models::BudgetSummary>, default_budget: ::models::BudgetSummary) -> BudgetSummaryResponseData {
+ pub fn new(budgets: Vec<::models::BudgetSummary>) -> BudgetSummaryResponseData {
BudgetSummaryResponseData {
budgets: budgets,
- default_budget: default_budget,
+ default_budget: None,
}
}
}
diff --git a/ynab-api/src/models/category.rs b/ynab-api/src/models/category.rs
index 1662f64..1a62c6a 100644
--- a/ynab-api/src/models/category.rs
+++ b/ynab-api/src/models/category.rs
@@ -27,8 +27,8 @@ pub struct Category {
/// If category is hidden this is the id of the category group it originally belonged to before it was hidden.
#[serde(rename = "original_category_group_id", skip_serializing_if = "Option::is_none")]
pub original_category_group_id: Option<String>,
- #[serde(rename = "note")]
- pub note: String,
+ #[serde(rename = "note", skip_serializing_if = "Option::is_none")]
+ pub note: Option<String>,
/// Budgeted amount in milliunits format
#[serde(rename = "budgeted")]
pub budgeted: i64,
@@ -39,42 +39,42 @@ pub struct Category {
#[serde(rename = "balance")]
pub balance: i64,
/// The type of goal, if the cagegory has a goal (TB=Target Category Balance, TBD=Target Category Balance by Date, MF=Monthly Funding)
- #[serde(rename = "goal_type")]
- pub goal_type: String,
+ #[serde(rename = "goal_type", skip_serializing_if = "Option::is_none")]
+ pub goal_type: Option<String>,
/// The month a goal was created
- #[serde(rename = "goal_creation_month")]
- pub goal_creation_month: String,
+ #[serde(rename = "goal_creation_month", skip_serializing_if = "Option::is_none")]
+ pub goal_creation_month: Option<String>,
/// The goal target amount in milliunits
#[serde(rename = "goal_target")]
pub goal_target: i64,
/// If the goal type is 'TBD' (Target Category Balance by Date), this is the target month for the goal to be completed
- #[serde(rename = "goal_target_month")]
- pub goal_target_month: String,
+ #[serde(rename = "goal_target_month", skip_serializing_if = "Option::is_none")]
+ pub goal_target_month: Option<String>,
/// The percentage completion of the goal
- #[serde(rename = "goal_percentage_complete")]
- pub goal_percentage_complete: i32,
+ #[serde(rename = "goal_percentage_complete", skip_serializing_if = "Option::is_none")]
+ pub goal_percentage_complete: Option<i32>,
/// Whether or not the category has been deleted. Deleted categories will only be included in delta requests.
#[serde(rename = "deleted")]
pub deleted: bool,
}
impl Category {
- pub fn new(id: String, category_group_id: String, name: String, hidden: bool, note: String, budgeted: i64, activity: i64, balance: i64, goal_type: String, goal_creation_month: String, goal_target: i64, goal_target_month: String, goal_percentage_complete: i32, deleted: bool) -> Category {
+ pub fn new(id: String, category_group_id: String, name: String, hidden: bool, budgeted: i64, activity: i64, balance: i64, goal_target: i64, deleted: bool) -> Category {
Category {
id: id,
category_group_id: category_group_id,
name: name,
hidden: hidden,
original_category_group_id: None,
- note: note,
+ note: None,
budgeted: budgeted,
activity: activity,
balance: balance,
- goal_type: goal_type,
- goal_creation_month: goal_creation_month,
+ goal_type: None,
+ goal_creation_month: None,
goal_target: goal_target,
- goal_target_month: goal_target_month,
- goal_percentage_complete: goal_percentage_complete,
+ goal_target_month: None,
+ goal_percentage_complete: None,
deleted: deleted,
}
}
diff --git a/ynab-api/src/models/hybrid_transaction.rs b/ynab-api/src/models/hybrid_transaction.rs
index 240f49d..488872e 100644
--- a/ynab-api/src/models/hybrid_transaction.rs
+++ b/ynab-api/src/models/hybrid_transaction.rs
@@ -23,8 +23,8 @@ pub struct HybridTransaction {
/// The transaction amount in milliunits format
#[serde(rename = "amount")]
pub amount: i64,
- #[serde(rename = "memo")]
- pub memo: String,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
/// The cleared status of the transaction
#[serde(rename = "cleared")]
pub cleared: String,
@@ -32,26 +32,26 @@ pub struct HybridTransaction {
#[serde(rename = "approved")]
pub approved: bool,
/// The transaction flag
- #[serde(rename = "flag_color")]
- pub flag_color: String,
+ #[serde(rename = "flag_color", skip_serializing_if = "Option::is_none")]
+ pub flag_color: Option<String>,
#[serde(rename = "account_id")]
pub account_id: String,
- #[serde(rename = "payee_id")]
- pub payee_id: String,
- #[serde(rename = "category_id")]
- pub category_id: String,
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
+ #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
+ pub category_id: Option<String>,
/// If a transfer transaction, the account to which it transfers
- #[serde(rename = "transfer_account_id")]
- pub transfer_account_id: String,
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
/// If a transfer transaction, the id of transaction on the other side of the transfer
- #[serde(rename = "transfer_transaction_id")]
- pub transfer_transaction_id: String,
+ #[serde(rename = "transfer_transaction_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_transaction_id: Option<String>,
/// If transaction is matched, the id of the matched transaction
- #[serde(rename = "matched_transaction_id")]
- pub matched_transaction_id: String,
+ #[serde(rename = "matched_transaction_id", skip_serializing_if = "Option::is_none")]
+ pub matched_transaction_id: Option<String>,
/// If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'.
- #[serde(rename = "import_id")]
- pub import_id: String,
+ #[serde(rename = "import_id", skip_serializing_if = "Option::is_none")]
+ pub import_id: Option<String>,
/// Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests.
#[serde(rename = "deleted")]
pub deleted: bool,
@@ -70,22 +70,22 @@ pub struct HybridTransaction {
}
impl HybridTransaction {
- pub fn new(id: String, date: String, amount: i64, memo: String, cleared: String, approved: bool, flag_color: String, account_id: String, payee_id: String, category_id: String, transfer_account_id: String, transfer_transaction_id: String, matched_transaction_id: String, import_id: String, deleted: bool, _type: String, parent_transaction_id: String, account_name: String, payee_name: String, category_name: String) -> HybridTransaction {
+ pub fn new(id: String, date: String, amount: i64, cleared: String, approved: bool, account_id: String, deleted: bool, _type: String, parent_transaction_id: String, account_name: String, payee_name: String, category_name: String) -> HybridTransaction {
HybridTransaction {
id: id,
date: date,
amount: amount,
- memo: memo,
+ memo: None,
cleared: cleared,
approved: approved,
- flag_color: flag_color,
+ flag_color: None,
account_id: account_id,
- payee_id: payee_id,
- category_id: category_id,
- transfer_account_id: transfer_account_id,
- transfer_transaction_id: transfer_transaction_id,
- matched_transaction_id: matched_transaction_id,
- import_id: import_id,
+ payee_id: None,
+ category_id: None,
+ transfer_account_id: None,
+ transfer_transaction_id: None,
+ matched_transaction_id: None,
+ import_id: None,
deleted: deleted,
_type: _type,
parent_transaction_id: parent_transaction_id,
diff --git a/ynab-api/src/models/month_detail.rs b/ynab-api/src/models/month_detail.rs
index 9a2b1c2..a6f55d4 100644
--- a/ynab-api/src/models/month_detail.rs
+++ b/ynab-api/src/models/month_detail.rs
@@ -17,8 +17,8 @@ use serde_json::Value;
pub struct MonthDetail {
#[serde(rename = "month")]
pub month: String,
- #[serde(rename = "note")]
- pub note: String,
+ #[serde(rename = "note", skip_serializing_if = "Option::is_none")]
+ pub note: Option<String>,
/// The total amount in transactions categorized to 'Inflow: To be Budgeted' in the month
#[serde(rename = "income")]
pub income: i64,
@@ -32,8 +32,8 @@ pub struct MonthDetail {
#[serde(rename = "to_be_budgeted")]
pub to_be_budgeted: i64,
/// The Age of Money as of the month
- #[serde(rename = "age_of_money")]
- pub age_of_money: i32,
+ #[serde(rename = "age_of_money", skip_serializing_if = "Option::is_none")]
+ pub age_of_money: Option<i32>,
/// Whether or not the month has been deleted. Deleted months will only be included in delta requests.
#[serde(rename = "deleted")]
pub deleted: bool,
@@ -43,15 +43,15 @@ pub struct MonthDetail {
}
impl MonthDetail {
- pub fn new(month: String, note: String, income: i64, budgeted: i64, activity: i64, to_be_budgeted: i64, age_of_money: i32, deleted: bool, categories: Vec<::models::Category>) -> MonthDetail {
+ pub fn new(month: String, income: i64, budgeted: i64, activity: i64, to_be_budgeted: i64, deleted: bool, categories: Vec<::models::Category>) -> MonthDetail {
MonthDetail {
month: month,
- note: note,
+ note: None,
income: income,
budgeted: budgeted,
activity: activity,
to_be_budgeted: to_be_budgeted,
- age_of_money: age_of_money,
+ age_of_money: None,
deleted: deleted,
categories: categories,
}
diff --git a/ynab-api/src/models/month_summary.rs b/ynab-api/src/models/month_summary.rs
index c7e980a..3c705d3 100644
--- a/ynab-api/src/models/month_summary.rs
+++ b/ynab-api/src/models/month_summary.rs
@@ -17,8 +17,8 @@ use serde_json::Value;
pub struct MonthSummary {
#[serde(rename = "month")]
pub month: String,
- #[serde(rename = "note")]
- pub note: String,
+ #[serde(rename = "note", skip_serializing_if = "Option::is_none")]
+ pub note: Option<String>,
/// The total amount in transactions categorized to 'Inflow: To be Budgeted' in the month
#[serde(rename = "income")]
pub income: i64,
@@ -32,23 +32,23 @@ pub struct MonthSummary {
#[serde(rename = "to_be_budgeted")]
pub to_be_budgeted: i64,
/// The Age of Money as of the month
- #[serde(rename = "age_of_money")]
- pub age_of_money: i32,
+ #[serde(rename = "age_of_money", skip_serializing_if = "Option::is_none")]
+ pub age_of_money: Option<i32>,
/// Whether or not the month has been deleted. Deleted months will only be included in delta requests.
#[serde(rename = "deleted")]
pub deleted: bool,
}
impl MonthSummary {
- pub fn new(month: String, note: String, income: i64, budgeted: i64, activity: i64, to_be_budgeted: i64, age_of_money: i32, deleted: bool) -> MonthSummary {
+ pub fn new(month: String, income: i64, budgeted: i64, activity: i64, to_be_budgeted: i64, deleted: bool) -> MonthSummary {
MonthSummary {
month: month,
- note: note,
+ note: None,
income: income,
budgeted: budgeted,
activity: activity,
to_be_budgeted: to_be_budgeted,
- age_of_money: age_of_money,
+ age_of_money: None,
deleted: deleted,
}
}
diff --git a/ynab-api/src/models/payee.rs b/ynab-api/src/models/payee.rs
index 2508b31..13ad103 100644
--- a/ynab-api/src/models/payee.rs
+++ b/ynab-api/src/models/payee.rs
@@ -20,19 +20,19 @@ pub struct Payee {
#[serde(rename = "name")]
pub name: String,
/// If a transfer payee, the account_id to which this payee transfers to
- #[serde(rename = "transfer_account_id")]
- pub transfer_account_id: String,
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
/// Whether or not the payee has been deleted. Deleted payees will only be included in delta requests.
#[serde(rename = "deleted")]
pub deleted: bool,
}
impl Payee {
- pub fn new(id: String, name: String, transfer_account_id: String, deleted: bool) -> Payee {
+ pub fn new(id: String, name: String, deleted: bool) -> Payee {
Payee {
id: id,
name: name,
- transfer_account_id: transfer_account_id,
+ transfer_account_id: None,
deleted: deleted,
}
}
diff --git a/ynab-api/src/models/scheduled_sub_transaction.rs b/ynab-api/src/models/scheduled_sub_transaction.rs
index 760fa78..dfc0aca 100644
--- a/ynab-api/src/models/scheduled_sub_transaction.rs
+++ b/ynab-api/src/models/scheduled_sub_transaction.rs
@@ -22,30 +22,30 @@ pub struct ScheduledSubTransaction {
/// The scheduled subtransaction amount in milliunits format
#[serde(rename = "amount")]
pub amount: i64,
- #[serde(rename = "memo")]
- pub memo: String,
- #[serde(rename = "payee_id")]
- pub payee_id: String,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
#[serde(rename = "category_id")]
pub category_id: String,
/// If a transfer, the account_id which the scheduled subtransaction transfers to
- #[serde(rename = "transfer_account_id")]
- pub transfer_account_id: String,
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
/// Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests.
#[serde(rename = "deleted")]
pub deleted: bool,
}
impl ScheduledSubTransaction {
- pub fn new(id: String, scheduled_transaction_id: String, amount: i64, memo: String, payee_id: String, category_id: String, transfer_account_id: String, deleted: bool) -> ScheduledSubTransaction {
+ pub fn new(id: String, scheduled_transaction_id: String, amount: i64, category_id: String, deleted: bool) -> ScheduledSubTransaction {
ScheduledSubTransaction {
id: id,
scheduled_transaction_id: scheduled_transaction_id,
amount: amount,
- memo: memo,
- payee_id: payee_id,
+ memo: None,
+ payee_id: None,
category_id: category_id,
- transfer_account_id: transfer_account_id,
+ transfer_account_id: None,
deleted: deleted,
}
}
diff --git a/ynab-api/src/models/scheduled_transaction_detail.rs b/ynab-api/src/models/scheduled_transaction_detail.rs
index 65c2473..d86ef25 100644
--- a/ynab-api/src/models/scheduled_transaction_detail.rs
+++ b/ynab-api/src/models/scheduled_transaction_detail.rs
@@ -28,20 +28,20 @@ pub struct ScheduledTransactionDetail {
/// The scheduled transaction amount in milliunits format
#[serde(rename = "amount")]
pub amount: i64,
- #[serde(rename = "memo")]
- pub memo: String,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
/// The scheduled transaction flag
#[serde(rename = "flag_color")]
pub flag_color: String,
#[serde(rename = "account_id")]
pub account_id: String,
- #[serde(rename = "payee_id")]
- pub payee_id: String,
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
#[serde(rename = "category_id")]
pub category_id: String,
/// If a transfer, the account_id which the scheduled transaction transfers to
- #[serde(rename = "transfer_account_id")]
- pub transfer_account_id: String,
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
/// Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests.
#[serde(rename = "deleted")]
pub deleted: bool,
@@ -57,19 +57,19 @@ pub struct ScheduledTransactionDetail {
}
impl ScheduledTransactionDetail {
- pub fn new(id: String, date_first: String, date_next: String, frequency: String, amount: i64, memo: String, flag_color: String, account_id: String, payee_id: String, category_id: String, transfer_account_id: String, deleted: bool, account_name: String, payee_name: String, category_name: String, subtransactions: Vec<::models::ScheduledSubTransaction>) -> ScheduledTransactionDetail {
+ pub fn new(id: String, date_first: String, date_next: String, frequency: String, amount: i64, flag_color: String, account_id: String, category_id: String, deleted: bool, account_name: String, payee_name: String, category_name: String, subtransactions: Vec<::models::ScheduledSubTransaction>) -> ScheduledTransactionDetail {
ScheduledTransactionDetail {
id: id,
date_first: date_first,
date_next: date_next,
frequency: frequency,
amount: amount,
- memo: memo,
+ memo: None,
flag_color: flag_color,
account_id: account_id,
- payee_id: payee_id,
+ payee_id: None,
category_id: category_id,
- transfer_account_id: transfer_account_id,
+ transfer_account_id: None,
deleted: deleted,
account_name: account_name,
payee_name: payee_name,
diff --git a/ynab-api/src/models/scheduled_transaction_summary.rs b/ynab-api/src/models/scheduled_transaction_summary.rs
index dfd6f1f..7966d2c 100644
--- a/ynab-api/src/models/scheduled_transaction_summary.rs
+++ b/ynab-api/src/models/scheduled_transaction_summary.rs
@@ -28,39 +28,39 @@ pub struct ScheduledTransactionSummary {
/// The scheduled transaction amount in milliunits format
#[serde(rename = "amount")]
pub amount: i64,
- #[serde(rename = "memo")]
- pub memo: String,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
/// The scheduled transaction flag
#[serde(rename = "flag_color")]
pub flag_color: String,
#[serde(rename = "account_id")]
pub account_id: String,
- #[serde(rename = "payee_id")]
- pub payee_id: String,
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
#[serde(rename = "category_id")]
pub category_id: String,
/// If a transfer, the account_id which the scheduled transaction transfers to
- #[serde(rename = "transfer_account_id")]
- pub transfer_account_id: String,
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
/// Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests.
#[serde(rename = "deleted")]
pub deleted: bool,
}
impl ScheduledTransactionSummary {
- pub fn new(id: String, date_first: String, date_next: String, frequency: String, amount: i64, memo: String, flag_color: String, account_id: String, payee_id: String, category_id: String, transfer_account_id: String, deleted: bool) -> ScheduledTransactionSummary {
+ pub fn new(id: String, date_first: String, date_next: String, frequency: String, amount: i64, flag_color: String, account_id: String, category_id: String, deleted: bool) -> ScheduledTransactionSummary {
ScheduledTransactionSummary {
id: id,
date_first: date_first,
date_next: date_next,
frequency: frequency,
amount: amount,
- memo: memo,
+ memo: None,
flag_color: flag_color,
account_id: account_id,
- payee_id: payee_id,
+ payee_id: None,
category_id: category_id,
- transfer_account_id: transfer_account_id,
+ transfer_account_id: None,
deleted: deleted,
}
}
diff --git a/ynab-api/src/models/sub_transaction.rs b/ynab-api/src/models/sub_transaction.rs
index aa7ed37..633ae38 100644
--- a/ynab-api/src/models/sub_transaction.rs
+++ b/ynab-api/src/models/sub_transaction.rs
@@ -22,30 +22,30 @@ pub struct SubTransaction {
/// The subtransaction amount in milliunits format
#[serde(rename = "amount")]
pub amount: i64,
- #[serde(rename = "memo")]
- pub memo: String,
- #[serde(rename = "payee_id")]
- pub payee_id: String,
- #[serde(rename = "category_id")]
- pub category_id: String,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
+ #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
+ pub category_id: Option<String>,
/// If a transfer, the account_id which the subtransaction transfers to
- #[serde(rename = "transfer_account_id")]
- pub transfer_account_id: String,
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
/// Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests.
#[serde(rename = "deleted")]
pub deleted: bool,
}
impl SubTransaction {
- pub fn new(id: String, transaction_id: String, amount: i64, memo: String, payee_id: String, category_id: String, transfer_account_id: String, deleted: bool) -> SubTransaction {
+ pub fn new(id: String, transaction_id: String, amount: i64, deleted: bool) -> SubTransaction {
SubTransaction {
id: id,
transaction_id: transaction_id,
amount: amount,
- memo: memo,
- payee_id: payee_id,
- category_id: category_id,
- transfer_account_id: transfer_account_id,
+ memo: None,
+ payee_id: None,
+ category_id: None,
+ transfer_account_id: None,
deleted: deleted,
}
}
diff --git a/ynab-api/src/models/transaction_detail.rs b/ynab-api/src/models/transaction_detail.rs
index 1558c7c..361813b 100644
--- a/ynab-api/src/models/transaction_detail.rs
+++ b/ynab-api/src/models/transaction_detail.rs
@@ -23,8 +23,8 @@ pub struct TransactionDetail {
/// The transaction amount in milliunits format
#[serde(rename = "amount")]
pub amount: i64,
- #[serde(rename = "memo")]
- pub memo: String,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
/// The cleared status of the transaction
#[serde(rename = "cleared")]
pub cleared: String,
@@ -32,26 +32,26 @@ pub struct TransactionDetail {
#[serde(rename = "approved")]
pub approved: bool,
/// The transaction flag
- #[serde(rename = "flag_color")]
- pub flag_color: String,
+ #[serde(rename = "flag_color", skip_serializing_if = "Option::is_none")]
+ pub flag_color: Option<String>,
#[serde(rename = "account_id")]
pub account_id: String,
- #[serde(rename = "payee_id")]
- pub payee_id: String,
- #[serde(rename = "category_id")]
- pub category_id: String,
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
+ #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
+ pub category_id: Option<String>,
/// If a transfer transaction, the account to which it transfers
- #[serde(rename = "transfer_account_id")]
- pub transfer_account_id: String,
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
/// If a transfer transaction, the id of transaction on the other side of the transfer
- #[serde(rename = "transfer_transaction_id")]
- pub transfer_transaction_id: String,
+ #[serde(rename = "transfer_transaction_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_transaction_id: Option<String>,
/// If transaction is matched, the id of the matched transaction
- #[serde(rename = "matched_transaction_id")]
- pub matched_transaction_id: String,
+ #[serde(rename = "matched_transaction_id", skip_serializing_if = "Option::is_none")]
+ pub matched_transaction_id: Option<String>,
/// If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'.
- #[serde(rename = "import_id")]
- pub import_id: String,
+ #[serde(rename = "import_id", skip_serializing_if = "Option::is_none")]
+ pub import_id: Option<String>,
/// Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests.
#[serde(rename = "deleted")]
pub deleted: bool,
@@ -67,22 +67,22 @@ pub struct TransactionDetail {
}
impl TransactionDetail {
- pub fn new(id: String, date: String, amount: i64, memo: String, cleared: String, approved: bool, flag_color: String, account_id: String, payee_id: String, category_id: String, transfer_account_id: String, transfer_transaction_id: String, matched_transaction_id: String, import_id: String, deleted: bool, account_name: String, payee_name: String, category_name: String, subtransactions: Vec<::models::SubTransaction>) -> TransactionDetail {
+ pub fn new(id: String, date: String, amount: i64, cleared: String, approved: bool, account_id: String, deleted: bool, account_name: String, payee_name: String, category_name: String, subtransactions: Vec<::models::SubTransaction>) -> TransactionDetail {
TransactionDetail {
id: id,
date: date,
amount: amount,
- memo: memo,
+ memo: None,
cleared: cleared,
approved: approved,
- flag_color: flag_color,
+ flag_color: None,
account_id: account_id,
- payee_id: payee_id,
- category_id: category_id,
- transfer_account_id: transfer_account_id,
- transfer_transaction_id: transfer_transaction_id,
- matched_transaction_id: matched_transaction_id,
- import_id: import_id,
+ payee_id: None,
+ category_id: None,
+ transfer_account_id: None,
+ transfer_transaction_id: None,
+ matched_transaction_id: None,
+ import_id: None,
deleted: deleted,
account_name: account_name,
payee_name: payee_name,
diff --git a/ynab-api/src/models/transaction_summary.rs b/ynab-api/src/models/transaction_summary.rs
index 31ef1c5..94ce164 100644
--- a/ynab-api/src/models/transaction_summary.rs
+++ b/ynab-api/src/models/transaction_summary.rs
@@ -23,8 +23,8 @@ pub struct TransactionSummary {
/// The transaction amount in milliunits format
#[serde(rename = "amount")]
pub amount: i64,
- #[serde(rename = "memo")]
- pub memo: String,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
/// The cleared status of the transaction
#[serde(rename = "cleared")]
pub cleared: String,
@@ -32,48 +32,48 @@ pub struct TransactionSummary {
#[serde(rename = "approved")]
pub approved: bool,
/// The transaction flag
- #[serde(rename = "flag_color")]
- pub flag_color: String,
+ #[serde(rename = "flag_color", skip_serializing_if = "Option::is_none")]
+ pub flag_color: Option<String>,
#[serde(rename = "account_id")]
pub account_id: String,
- #[serde(rename = "payee_id")]
- pub payee_id: String,
- #[serde(rename = "category_id")]
- pub category_id: String,
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
+ #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
+ pub category_id: Option<String>,
/// If a transfer transaction, the account to which it transfers
- #[serde(rename = "transfer_account_id")]
- pub transfer_account_id: String,
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
/// If a transfer transaction, the id of transaction on the other side of the transfer
- #[serde(rename = "transfer_transaction_id")]
- pub transfer_transaction_id: String,
+ #[serde(rename = "transfer_transaction_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_transaction_id: Option<String>,
/// If transaction is matched, the id of the matched transaction
- #[serde(rename = "matched_transaction_id")]
- pub matched_transaction_id: String,
+ #[serde(rename = "matched_transaction_id", skip_serializing_if = "Option::is_none")]
+ pub matched_transaction_id: Option<String>,
/// If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'.
- #[serde(rename = "import_id")]
- pub import_id: String,
+ #[serde(rename = "import_id", skip_serializing_if = "Option::is_none")]
+ pub import_id: Option<String>,
/// Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests.
#[serde(rename = "deleted")]
pub deleted: bool,
}
impl TransactionSummary {
- pub fn new(id: String, date: String, amount: i64, memo: String, cleared: String, approved: bool, flag_color: String, account_id: String, payee_id: String, category_id: String, transfer_account_id: String, transfer_transaction_id: String, matched_transaction_id: String, import_id: String, deleted: bool) -> TransactionSummary {
+ pub fn new(id: String, date: String, amount: i64, cleared: String, approved: bool, account_id: String, deleted: bool) -> TransactionSummary {
TransactionSummary {
id: id,
date: date,
amount: amount,
- memo: memo,
+ memo: None,
cleared: cleared,
approved: approved,
- flag_color: flag_color,
+ flag_color: None,
account_id: account_id,
- payee_id: payee_id,
- category_id: category_id,
- transfer_account_id: transfer_account_id,
- transfer_transaction_id: transfer_transaction_id,
- matched_transaction_id: matched_transaction_id,
- import_id: import_id,
+ payee_id: None,
+ category_id: None,
+ transfer_account_id: None,
+ transfer_transaction_id: None,
+ matched_transaction_id: None,
+ import_id: None,
deleted: deleted,
}
}