From a942c7c8e17eb829ef1581c0b556665784f19e33 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 7 Nov 2019 03:57:33 -0500 Subject: update openapi spec and regenerate with newer openapi-generator the newer openapi-generator picks up fixes for optional parameters, among other things --- src/apis/accounts_api.rs | 12 +- src/apis/budgets_api.rs | 12 +- src/apis/categories_api.rs | 12 +- src/apis/client.rs | 40 ++--- src/apis/deprecated_api.rs | 4 +- src/apis/months_api.rs | 12 +- src/apis/payee_locations_api.rs | 4 +- src/apis/payees_api.rs | 12 +- src/apis/scheduled_transactions_api.rs | 12 +- src/apis/transactions_api.rs | 68 ++++++--- src/apis/user_api.rs | 4 +- src/models/account.rs | 21 +-- src/models/account_response.rs | 3 +- src/models/account_response_data.rs | 3 +- src/models/accounts_response.rs | 3 +- src/models/accounts_response_data.rs | 5 +- src/models/budget_detail.rs | 5 +- src/models/budget_detail_all_of.rs | 1 + src/models/budget_detail_response.rs | 3 +- src/models/budget_detail_response_data.rs | 5 +- src/models/budget_settings.rs | 5 +- src/models/budget_settings_response.rs | 3 +- src/models/budget_settings_response_data.rs | 3 +- src/models/budget_summary.rs | 5 +- src/models/budget_summary_response.rs | 3 +- src/models/budget_summary_response_data.rs | 3 +- src/models/bulk_response.rs | 3 +- src/models/bulk_response_data.rs | 3 +- src/models/bulk_response_data_bulk.rs | 5 +- src/models/bulk_transactions.rs | 3 +- src/models/categories_response.rs | 3 +- src/models/categories_response_data.rs | 5 +- src/models/category.rs | 25 ++-- src/models/category_group.rs | 9 +- src/models/category_group_with_categories.rs | 11 +- .../category_group_with_categories_all_of.rs | 3 +- src/models/category_response.rs | 3 +- src/models/category_response_data.rs | 3 +- src/models/currency_format.rs | 17 ++- src/models/date_format.rs | 3 +- src/models/error_detail.rs | 7 +- src/models/error_response.rs | 3 +- src/models/hybrid_transaction.rs | 51 +++++-- src/models/hybrid_transaction_all_of.rs | 5 +- src/models/hybrid_transactions_response.rs | 3 +- src/models/hybrid_transactions_response_data.rs | 3 +- src/models/mod.rs | 166 ++++++++++----------- src/models/month_detail.rs | 15 +- src/models/month_detail_all_of.rs | 3 +- src/models/month_detail_response.rs | 3 +- src/models/month_detail_response_data.rs | 3 +- src/models/month_summaries_response.rs | 3 +- src/models/month_summaries_response_data.rs | 5 +- src/models/month_summary.rs | 13 +- src/models/payee.rs | 7 +- src/models/payee_location.rs | 11 +- src/models/payee_location_response.rs | 3 +- src/models/payee_location_response_data.rs | 3 +- src/models/payee_locations_response.rs | 3 +- src/models/payee_locations_response_data.rs | 3 +- src/models/payee_response.rs | 3 +- src/models/payee_response_data.rs | 3 +- src/models/payees_response.rs | 3 +- src/models/payees_response_data.rs | 5 +- src/models/save_category_response.rs | 3 +- src/models/save_category_response_data.rs | 5 +- src/models/save_month_category.rs | 3 +- src/models/save_month_category_wrapper.rs | 3 +- src/models/save_transaction.rs | 37 ++++- src/models/save_transaction_wrapper.rs | 3 +- src/models/save_transactions_response.rs | 3 +- src/models/save_transactions_response_data.rs | 5 +- src/models/save_transactions_wrapper.rs | 1 + src/models/scheduled_sub_transaction.rs | 9 +- src/models/scheduled_transaction_detail.rs | 71 +++++++-- src/models/scheduled_transaction_detail_all_of.rs | 5 +- src/models/scheduled_transaction_response.rs | 3 +- src/models/scheduled_transaction_response_data.rs | 3 +- src/models/scheduled_transaction_summary.rs | 67 +++++++-- src/models/scheduled_transactions_response.rs | 3 +- src/models/scheduled_transactions_response_data.rs | 5 +- src/models/sub_transaction.rs | 9 +- src/models/transaction_detail.rs | 51 +++++-- src/models/transaction_detail_all_of.rs | 5 +- src/models/transaction_response.rs | 3 +- src/models/transaction_response_data.rs | 3 +- src/models/transaction_summary.rs | 47 ++++-- src/models/transactions_response.rs | 3 +- src/models/transactions_response_data.rs | 5 +- src/models/update_transaction.rs | 39 ++++- src/models/update_transaction_all_of.rs | 3 +- src/models/update_transactions_wrapper.rs | 3 +- src/models/user.rs | 3 +- src/models/user_response.rs | 3 +- src/models/user_response_data.rs | 3 +- 95 files changed, 728 insertions(+), 367 deletions(-) (limited to 'src') diff --git a/src/apis/accounts_api.rs b/src/apis/accounts_api.rs index b536e89..b0c0bf9 100644 --- a/src/apis/accounts_api.rs +++ b/src/apis/accounts_api.rs @@ -10,6 +10,8 @@ use std::rc::Rc; use std::borrow::Borrow; +#[allow(unused_imports)] +use std::option::Option; use reqwest; @@ -22,14 +24,14 @@ pub struct AccountsApiClient { impl AccountsApiClient { pub fn new(configuration: Rc) -> AccountsApiClient { AccountsApiClient { - configuration: configuration, + configuration, } } } pub trait AccountsApi { fn get_account_by_id(&self, budget_id: &str, account_id: &str) -> Result; - fn get_accounts(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result; + fn get_accounts(&self, budget_id: &str, last_knowledge_of_server: Option) -> Result; } impl AccountsApi for AccountsApiClient { @@ -58,14 +60,16 @@ impl AccountsApi for AccountsApiClient { Ok(client.execute(req)?.error_for_status()?.json()?) } - fn get_accounts(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result { + fn get_accounts(&self, budget_id: &str, last_knowledge_of_server: Option) -> Result { let configuration: &configuration::Configuration = self.configuration.borrow(); let client = &configuration.client; let uri_str = format!("{}/budgets/{budget_id}/accounts", configuration.base_path, budget_id=crate::apis::urlencode(budget_id)); let mut req_builder = client.get(uri_str.as_str()); - req_builder = req_builder.query(&[("last_knowledge_of_server", &last_knowledge_of_server.to_string())]); + if let Some(ref s) = last_knowledge_of_server { + req_builder = req_builder.query(&[("last_knowledge_of_server", &s.to_string())]); + } if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } diff --git a/src/apis/budgets_api.rs b/src/apis/budgets_api.rs index e1002ed..9ddfd9d 100644 --- a/src/apis/budgets_api.rs +++ b/src/apis/budgets_api.rs @@ -10,6 +10,8 @@ use std::rc::Rc; use std::borrow::Borrow; +#[allow(unused_imports)] +use std::option::Option; use reqwest; @@ -22,26 +24,28 @@ pub struct BudgetsApiClient { impl BudgetsApiClient { pub fn new(configuration: Rc) -> BudgetsApiClient { BudgetsApiClient { - configuration: configuration, + configuration, } } } pub trait BudgetsApi { - fn get_budget_by_id(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result; + fn get_budget_by_id(&self, budget_id: &str, last_knowledge_of_server: Option) -> Result; fn get_budget_settings_by_id(&self, budget_id: &str) -> Result; fn get_budgets(&self, ) -> Result; } impl BudgetsApi for BudgetsApiClient { - fn get_budget_by_id(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result { + fn get_budget_by_id(&self, budget_id: &str, last_knowledge_of_server: Option) -> Result { let configuration: &configuration::Configuration = self.configuration.borrow(); let client = &configuration.client; let uri_str = format!("{}/budgets/{budget_id}", configuration.base_path, budget_id=crate::apis::urlencode(budget_id)); let mut req_builder = client.get(uri_str.as_str()); - req_builder = req_builder.query(&[("last_knowledge_of_server", &last_knowledge_of_server.to_string())]); + if let Some(ref s) = last_knowledge_of_server { + req_builder = req_builder.query(&[("last_knowledge_of_server", &s.to_string())]); + } if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } diff --git a/src/apis/categories_api.rs b/src/apis/categories_api.rs index f57d38b..b6624b9 100644 --- a/src/apis/categories_api.rs +++ b/src/apis/categories_api.rs @@ -10,6 +10,8 @@ use std::rc::Rc; use std::borrow::Borrow; +#[allow(unused_imports)] +use std::option::Option; use reqwest; @@ -22,27 +24,29 @@ pub struct CategoriesApiClient { impl CategoriesApiClient { pub fn new(configuration: Rc) -> CategoriesApiClient { CategoriesApiClient { - configuration: configuration, + configuration, } } } pub trait CategoriesApi { - fn get_categories(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result; + fn get_categories(&self, budget_id: &str, last_knowledge_of_server: Option) -> Result; fn get_category_by_id(&self, budget_id: &str, category_id: &str) -> Result; fn get_month_category_by_id(&self, budget_id: &str, month: String, category_id: &str) -> Result; fn update_month_category(&self, budget_id: &str, month: String, category_id: &str, data: crate::models::SaveMonthCategoryWrapper) -> Result; } impl CategoriesApi for CategoriesApiClient { - fn get_categories(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result { + fn get_categories(&self, budget_id: &str, last_knowledge_of_server: Option) -> Result { let configuration: &configuration::Configuration = self.configuration.borrow(); let client = &configuration.client; let uri_str = format!("{}/budgets/{budget_id}/categories", configuration.base_path, budget_id=crate::apis::urlencode(budget_id)); let mut req_builder = client.get(uri_str.as_str()); - req_builder = req_builder.query(&[("last_knowledge_of_server", &last_knowledge_of_server.to_string())]); + if let Some(ref s) = last_knowledge_of_server { + req_builder = req_builder.query(&[("last_knowledge_of_server", &s.to_string())]); + } if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } diff --git a/src/apis/client.rs b/src/apis/client.rs index 387df63..d7558a7 100644 --- a/src/apis/client.rs +++ b/src/apis/client.rs @@ -3,16 +3,16 @@ use std::rc::Rc; use super::configuration::Configuration; pub struct APIClient { - accounts_api: Box, - budgets_api: Box, - categories_api: Box, - deprecated_api: Box, - months_api: Box, - payee_locations_api: Box, - payees_api: Box, - scheduled_transactions_api: Box, - transactions_api: Box, - user_api: Box, + accounts_api: Box, + budgets_api: Box, + categories_api: Box, + deprecated_api: Box, + months_api: Box, + payee_locations_api: Box, + payees_api: Box, + scheduled_transactions_api: Box, + transactions_api: Box, + user_api: Box, } impl APIClient { @@ -33,43 +33,43 @@ impl APIClient { } } - pub fn accounts_api(&self) -> &crate::apis::AccountsApi{ + pub fn accounts_api(&self) -> &dyn crate::apis::AccountsApi{ self.accounts_api.as_ref() } - pub fn budgets_api(&self) -> &crate::apis::BudgetsApi{ + pub fn budgets_api(&self) -> &dyn crate::apis::BudgetsApi{ self.budgets_api.as_ref() } - pub fn categories_api(&self) -> &crate::apis::CategoriesApi{ + pub fn categories_api(&self) -> &dyn crate::apis::CategoriesApi{ self.categories_api.as_ref() } - pub fn deprecated_api(&self) -> &crate::apis::DeprecatedApi{ + pub fn deprecated_api(&self) -> &dyn crate::apis::DeprecatedApi{ self.deprecated_api.as_ref() } - pub fn months_api(&self) -> &crate::apis::MonthsApi{ + pub fn months_api(&self) -> &dyn crate::apis::MonthsApi{ self.months_api.as_ref() } - pub fn payee_locations_api(&self) -> &crate::apis::PayeeLocationsApi{ + pub fn payee_locations_api(&self) -> &dyn crate::apis::PayeeLocationsApi{ self.payee_locations_api.as_ref() } - pub fn payees_api(&self) -> &crate::apis::PayeesApi{ + pub fn payees_api(&self) -> &dyn crate::apis::PayeesApi{ self.payees_api.as_ref() } - pub fn scheduled_transactions_api(&self) -> &crate::apis::ScheduledTransactionsApi{ + pub fn scheduled_transactions_api(&self) -> &dyn crate::apis::ScheduledTransactionsApi{ self.scheduled_transactions_api.as_ref() } - pub fn transactions_api(&self) -> &crate::apis::TransactionsApi{ + pub fn transactions_api(&self) -> &dyn crate::apis::TransactionsApi{ self.transactions_api.as_ref() } - pub fn user_api(&self) -> &crate::apis::UserApi{ + pub fn user_api(&self) -> &dyn crate::apis::UserApi{ self.user_api.as_ref() } diff --git a/src/apis/deprecated_api.rs b/src/apis/deprecated_api.rs index aab34ff..0d4fe6b 100644 --- a/src/apis/deprecated_api.rs +++ b/src/apis/deprecated_api.rs @@ -10,6 +10,8 @@ use std::rc::Rc; use std::borrow::Borrow; +#[allow(unused_imports)] +use std::option::Option; use reqwest; @@ -22,7 +24,7 @@ pub struct DeprecatedApiClient { impl DeprecatedApiClient { pub fn new(configuration: Rc) -> DeprecatedApiClient { DeprecatedApiClient { - configuration: configuration, + configuration, } } } diff --git a/src/apis/months_api.rs b/src/apis/months_api.rs index 48d586b..03c6a29 100644 --- a/src/apis/months_api.rs +++ b/src/apis/months_api.rs @@ -10,6 +10,8 @@ use std::rc::Rc; use std::borrow::Borrow; +#[allow(unused_imports)] +use std::option::Option; use reqwest; @@ -22,14 +24,14 @@ pub struct MonthsApiClient { impl MonthsApiClient { pub fn new(configuration: Rc) -> MonthsApiClient { MonthsApiClient { - configuration: configuration, + configuration, } } } pub trait MonthsApi { fn get_budget_month(&self, budget_id: &str, month: String) -> Result; - fn get_budget_months(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result; + fn get_budget_months(&self, budget_id: &str, last_knowledge_of_server: Option) -> Result; } impl MonthsApi for MonthsApiClient { @@ -58,14 +60,16 @@ impl MonthsApi for MonthsApiClient { Ok(client.execute(req)?.error_for_status()?.json()?) } - fn get_budget_months(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result { + fn get_budget_months(&self, budget_id: &str, last_knowledge_of_server: Option) -> Result { let configuration: &configuration::Configuration = self.configuration.borrow(); let client = &configuration.client; let uri_str = format!("{}/budgets/{budget_id}/months", configuration.base_path, budget_id=crate::apis::urlencode(budget_id)); let mut req_builder = client.get(uri_str.as_str()); - req_builder = req_builder.query(&[("last_knowledge_of_server", &last_knowledge_of_server.to_string())]); + if let Some(ref s) = last_knowledge_of_server { + req_builder = req_builder.query(&[("last_knowledge_of_server", &s.to_string())]); + } if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } diff --git a/src/apis/payee_locations_api.rs b/src/apis/payee_locations_api.rs index 823dea4..1a1e35d 100644 --- a/src/apis/payee_locations_api.rs +++ b/src/apis/payee_locations_api.rs @@ -10,6 +10,8 @@ use std::rc::Rc; use std::borrow::Borrow; +#[allow(unused_imports)] +use std::option::Option; use reqwest; @@ -22,7 +24,7 @@ pub struct PayeeLocationsApiClient { impl PayeeLocationsApiClient { pub fn new(configuration: Rc) -> PayeeLocationsApiClient { PayeeLocationsApiClient { - configuration: configuration, + configuration, } } } diff --git a/src/apis/payees_api.rs b/src/apis/payees_api.rs index 890920c..71f4125 100644 --- a/src/apis/payees_api.rs +++ b/src/apis/payees_api.rs @@ -10,6 +10,8 @@ use std::rc::Rc; use std::borrow::Borrow; +#[allow(unused_imports)] +use std::option::Option; use reqwest; @@ -22,14 +24,14 @@ pub struct PayeesApiClient { impl PayeesApiClient { pub fn new(configuration: Rc) -> PayeesApiClient { PayeesApiClient { - configuration: configuration, + configuration, } } } pub trait PayeesApi { fn get_payee_by_id(&self, budget_id: &str, payee_id: &str) -> Result; - fn get_payees(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result; + fn get_payees(&self, budget_id: &str, last_knowledge_of_server: Option) -> Result; } impl PayeesApi for PayeesApiClient { @@ -58,14 +60,16 @@ impl PayeesApi for PayeesApiClient { Ok(client.execute(req)?.error_for_status()?.json()?) } - fn get_payees(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result { + fn get_payees(&self, budget_id: &str, last_knowledge_of_server: Option) -> Result { let configuration: &configuration::Configuration = self.configuration.borrow(); let client = &configuration.client; let uri_str = format!("{}/budgets/{budget_id}/payees", configuration.base_path, budget_id=crate::apis::urlencode(budget_id)); let mut req_builder = client.get(uri_str.as_str()); - req_builder = req_builder.query(&[("last_knowledge_of_server", &last_knowledge_of_server.to_string())]); + if let Some(ref s) = last_knowledge_of_server { + req_builder = req_builder.query(&[("last_knowledge_of_server", &s.to_string())]); + } if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } diff --git a/src/apis/scheduled_transactions_api.rs b/src/apis/scheduled_transactions_api.rs index fe8c959..f44d782 100644 --- a/src/apis/scheduled_transactions_api.rs +++ b/src/apis/scheduled_transactions_api.rs @@ -10,6 +10,8 @@ use std::rc::Rc; use std::borrow::Borrow; +#[allow(unused_imports)] +use std::option::Option; use reqwest; @@ -22,14 +24,14 @@ pub struct ScheduledTransactionsApiClient { impl ScheduledTransactionsApiClient { pub fn new(configuration: Rc) -> ScheduledTransactionsApiClient { ScheduledTransactionsApiClient { - configuration: configuration, + configuration, } } } pub trait ScheduledTransactionsApi { fn get_scheduled_transaction_by_id(&self, budget_id: &str, scheduled_transaction_id: &str) -> Result; - fn get_scheduled_transactions(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result; + fn get_scheduled_transactions(&self, budget_id: &str, last_knowledge_of_server: Option) -> Result; } impl ScheduledTransactionsApi for ScheduledTransactionsApiClient { @@ -58,14 +60,16 @@ impl ScheduledTransactionsApi for ScheduledTransactionsApiClient { Ok(client.execute(req)?.error_for_status()?.json()?) } - fn get_scheduled_transactions(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result { + fn get_scheduled_transactions(&self, budget_id: &str, last_knowledge_of_server: Option) -> Result { let configuration: &configuration::Configuration = self.configuration.borrow(); let client = &configuration.client; let uri_str = format!("{}/budgets/{budget_id}/scheduled_transactions", configuration.base_path, budget_id=crate::apis::urlencode(budget_id)); let mut req_builder = client.get(uri_str.as_str()); - req_builder = req_builder.query(&[("last_knowledge_of_server", &last_knowledge_of_server.to_string())]); + if let Some(ref s) = last_knowledge_of_server { + req_builder = req_builder.query(&[("last_knowledge_of_server", &s.to_string())]); + } if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } diff --git a/src/apis/transactions_api.rs b/src/apis/transactions_api.rs index 9b3fcb4..138fa4d 100644 --- a/src/apis/transactions_api.rs +++ b/src/apis/transactions_api.rs @@ -10,6 +10,8 @@ use std::rc::Rc; use std::borrow::Borrow; +#[allow(unused_imports)] +use std::option::Option; use reqwest; @@ -22,7 +24,7 @@ pub struct TransactionsApiClient { impl TransactionsApiClient { pub fn new(configuration: Rc) -> TransactionsApiClient { TransactionsApiClient { - configuration: configuration, + configuration, } } } @@ -30,10 +32,10 @@ impl TransactionsApiClient { pub trait TransactionsApi { fn create_transaction(&self, budget_id: &str, data: crate::models::SaveTransactionsWrapper) -> Result; fn get_transaction_by_id(&self, budget_id: &str, transaction_id: &str) -> Result; - fn get_transactions(&self, budget_id: &str, since_date: String, _type: &str, last_knowledge_of_server: i64) -> Result; - fn get_transactions_by_account(&self, budget_id: &str, account_id: &str, since_date: String, _type: &str, last_knowledge_of_server: i64) -> Result; - fn get_transactions_by_category(&self, budget_id: &str, category_id: &str, since_date: String, _type: &str, last_knowledge_of_server: i64) -> Result; - fn get_transactions_by_payee(&self, budget_id: &str, payee_id: &str, since_date: String, _type: &str, last_knowledge_of_server: i64) -> Result; + fn get_transactions(&self, budget_id: &str, since_date: Option, _type: Option<&str>, last_knowledge_of_server: Option) -> Result; + fn get_transactions_by_account(&self, budget_id: &str, account_id: &str, since_date: Option, _type: Option<&str>, last_knowledge_of_server: Option) -> Result; + fn get_transactions_by_category(&self, budget_id: &str, category_id: &str, since_date: Option, _type: Option<&str>, last_knowledge_of_server: Option) -> Result; + fn get_transactions_by_payee(&self, budget_id: &str, payee_id: &str, since_date: Option, _type: Option<&str>, last_knowledge_of_server: Option) -> Result; fn update_transaction(&self, budget_id: &str, transaction_id: &str, data: crate::models::SaveTransactionWrapper) -> Result; fn update_transactions(&self, budget_id: &str, data: crate::models::UpdateTransactionsWrapper) -> Result; } @@ -90,16 +92,22 @@ impl TransactionsApi for TransactionsApiClient { Ok(client.execute(req)?.error_for_status()?.json()?) } - fn get_transactions(&self, budget_id: &str, since_date: String, _type: &str, last_knowledge_of_server: i64) -> Result { + fn get_transactions(&self, budget_id: &str, since_date: Option, _type: Option<&str>, last_knowledge_of_server: Option) -> Result { let configuration: &configuration::Configuration = self.configuration.borrow(); let client = &configuration.client; let uri_str = format!("{}/budgets/{budget_id}/transactions", configuration.base_path, budget_id=crate::apis::urlencode(budget_id)); let mut req_builder = client.get(uri_str.as_str()); - req_builder = req_builder.query(&[("since_date", &since_date.to_string())]); - req_builder = req_builder.query(&[("type", &_type.to_string())]); - req_builder = req_builder.query(&[("last_knowledge_of_server", &last_knowledge_of_server.to_string())]); + if let Some(ref s) = since_date { + req_builder = req_builder.query(&[("since_date", &s.to_string())]); + } + if let Some(ref s) = _type { + req_builder = req_builder.query(&[("type", &s.to_string())]); + } + if let Some(ref s) = last_knowledge_of_server { + req_builder = req_builder.query(&[("last_knowledge_of_server", &s.to_string())]); + } if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } @@ -118,16 +126,22 @@ impl TransactionsApi for TransactionsApiClient { Ok(client.execute(req)?.error_for_status()?.json()?) } - fn get_transactions_by_account(&self, budget_id: &str, account_id: &str, since_date: String, _type: &str, last_knowledge_of_server: i64) -> Result { + fn get_transactions_by_account(&self, budget_id: &str, account_id: &str, since_date: Option, _type: Option<&str>, last_knowledge_of_server: Option) -> Result { let configuration: &configuration::Configuration = self.configuration.borrow(); let client = &configuration.client; let uri_str = format!("{}/budgets/{budget_id}/accounts/{account_id}/transactions", configuration.base_path, budget_id=crate::apis::urlencode(budget_id), account_id=crate::apis::urlencode(account_id)); let mut req_builder = client.get(uri_str.as_str()); - req_builder = req_builder.query(&[("since_date", &since_date.to_string())]); - req_builder = req_builder.query(&[("type", &_type.to_string())]); - req_builder = req_builder.query(&[("last_knowledge_of_server", &last_knowledge_of_server.to_string())]); + if let Some(ref s) = since_date { + req_builder = req_builder.query(&[("since_date", &s.to_string())]); + } + if let Some(ref s) = _type { + req_builder = req_builder.query(&[("type", &s.to_string())]); + } + if let Some(ref s) = last_knowledge_of_server { + req_builder = req_builder.query(&[("last_knowledge_of_server", &s.to_string())]); + } if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } @@ -146,16 +160,22 @@ impl TransactionsApi for TransactionsApiClient { Ok(client.execute(req)?.error_for_status()?.json()?) } - fn get_transactions_by_category(&self, budget_id: &str, category_id: &str, since_date: String, _type: &str, last_knowledge_of_server: i64) -> Result { + fn get_transactions_by_category(&self, budget_id: &str, category_id: &str, since_date: Option, _type: Option<&str>, last_knowledge_of_server: Option) -> Result { let configuration: &configuration::Configuration = self.configuration.borrow(); let client = &configuration.client; let uri_str = format!("{}/budgets/{budget_id}/categories/{category_id}/transactions", configuration.base_path, budget_id=crate::apis::urlencode(budget_id), category_id=crate::apis::urlencode(category_id)); let mut req_builder = client.get(uri_str.as_str()); - req_builder = req_builder.query(&[("since_date", &since_date.to_string())]); - req_builder = req_builder.query(&[("type", &_type.to_string())]); - req_builder = req_builder.query(&[("last_knowledge_of_server", &last_knowledge_of_server.to_string())]); + if let Some(ref s) = since_date { + req_builder = req_builder.query(&[("since_date", &s.to_string())]); + } + if let Some(ref s) = _type { + req_builder = req_builder.query(&[("type", &s.to_string())]); + } + if let Some(ref s) = last_knowledge_of_server { + req_builder = req_builder.query(&[("last_knowledge_of_server", &s.to_string())]); + } if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } @@ -174,16 +194,22 @@ impl TransactionsApi for TransactionsApiClient { Ok(client.execute(req)?.error_for_status()?.json()?) } - fn get_transactions_by_payee(&self, budget_id: &str, payee_id: &str, since_date: String, _type: &str, last_knowledge_of_server: i64) -> Result { + fn get_transactions_by_payee(&self, budget_id: &str, payee_id: &str, since_date: Option, _type: Option<&str>, last_knowledge_of_server: Option) -> Result { let configuration: &configuration::Configuration = self.configuration.borrow(); let client = &configuration.client; let uri_str = format!("{}/budgets/{budget_id}/payees/{payee_id}/transactions", configuration.base_path, budget_id=crate::apis::urlencode(budget_id), payee_id=crate::apis::urlencode(payee_id)); let mut req_builder = client.get(uri_str.as_str()); - req_builder = req_builder.query(&[("since_date", &since_date.to_string())]); - req_builder = req_builder.query(&[("type", &_type.to_string())]); - req_builder = req_builder.query(&[("last_knowledge_of_server", &last_knowledge_of_server.to_string())]); + if let Some(ref s) = since_date { + req_builder = req_builder.query(&[("since_date", &s.to_string())]); + } + if let Some(ref s) = _type { + req_builder = req_builder.query(&[("type", &s.to_string())]); + } + if let Some(ref s) = last_knowledge_of_server { + req_builder = req_builder.query(&[("last_knowledge_of_server", &s.to_string())]); + } if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } diff --git a/src/apis/user_api.rs b/src/apis/user_api.rs index 870ecc4..652fb55 100644 --- a/src/apis/user_api.rs +++ b/src/apis/user_api.rs @@ -10,6 +10,8 @@ use std::rc::Rc; use std::borrow::Borrow; +#[allow(unused_imports)] +use std::option::Option; use reqwest; @@ -22,7 +24,7 @@ pub struct UserApiClient { impl UserApiClient { pub fn new(configuration: Rc) -> UserApiClient { UserApiClient { - configuration: configuration, + configuration, } } } diff --git a/src/models/account.rs b/src/models/account.rs index 44ad808..c2581f0 100644 --- a/src/models/account.rs +++ b/src/models/account.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct Account { #[serde(rename = "id")] @@ -47,17 +48,17 @@ pub struct Account { impl Account { pub fn new(id: String, name: String, _type: Type, 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, + id, + name, + _type, + on_budget, + closed, note: None, - balance: balance, - cleared_balance: cleared_balance, - uncleared_balance: uncleared_balance, - transfer_payee_id: transfer_payee_id, - deleted: deleted, + balance, + cleared_balance, + uncleared_balance, + transfer_payee_id, + deleted, } } } diff --git a/src/models/account_response.rs b/src/models/account_response.rs index 3f24283..5f90ddf 100644 --- a/src/models/account_response.rs +++ b/src/models/account_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct AccountResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct AccountResponse { impl AccountResponse { pub fn new(data: crate::models::AccountResponseData) -> AccountResponse { AccountResponse { - data: data, + data, } } } diff --git a/src/models/account_response_data.rs b/src/models/account_response_data.rs index c74e20a..f08e252 100644 --- a/src/models/account_response_data.rs +++ b/src/models/account_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct AccountResponseData { #[serde(rename = "account")] @@ -19,7 +20,7 @@ pub struct AccountResponseData { impl AccountResponseData { pub fn new(account: crate::models::Account) -> AccountResponseData { AccountResponseData { - account: account, + account, } } } diff --git a/src/models/accounts_response.rs b/src/models/accounts_response.rs index ccf8809..0d2b696 100644 --- a/src/models/accounts_response.rs +++ b/src/models/accounts_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct AccountsResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct AccountsResponse { impl AccountsResponse { pub fn new(data: crate::models::AccountsResponseData) -> AccountsResponse { AccountsResponse { - data: data, + data, } } } diff --git a/src/models/accounts_response_data.rs b/src/models/accounts_response_data.rs index 670c777..effeec4 100644 --- a/src/models/accounts_response_data.rs +++ b/src/models/accounts_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct AccountsResponseData { #[serde(rename = "accounts")] @@ -22,8 +23,8 @@ pub struct AccountsResponseData { impl AccountsResponseData { pub fn new(accounts: Vec, server_knowledge: i64) -> AccountsResponseData { AccountsResponseData { - accounts: accounts, - server_knowledge: server_knowledge, + accounts, + server_knowledge, } } } diff --git a/src/models/budget_detail.rs b/src/models/budget_detail.rs index b14f4b0..2ab61ac 100644 --- a/src/models/budget_detail.rs +++ b/src/models/budget_detail.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct BudgetDetail { #[serde(rename = "id")] @@ -54,8 +55,8 @@ pub struct BudgetDetail { impl BudgetDetail { pub fn new(id: String, name: String) -> BudgetDetail { BudgetDetail { - id: id, - name: name, + id, + name, last_modified_on: None, first_month: None, last_month: None, diff --git a/src/models/budget_detail_all_of.rs b/src/models/budget_detail_all_of.rs index 8b7da42..058494a 100644 --- a/src/models/budget_detail_all_of.rs +++ b/src/models/budget_detail_all_of.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct BudgetDetailAllOf { #[serde(rename = "accounts", skip_serializing_if = "Option::is_none")] diff --git a/src/models/budget_detail_response.rs b/src/models/budget_detail_response.rs index 3ffcdcd..f068af4 100644 --- a/src/models/budget_detail_response.rs +++ b/src/models/budget_detail_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct BudgetDetailResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct BudgetDetailResponse { impl BudgetDetailResponse { pub fn new(data: crate::models::BudgetDetailResponseData) -> BudgetDetailResponse { BudgetDetailResponse { - data: data, + data, } } } diff --git a/src/models/budget_detail_response_data.rs b/src/models/budget_detail_response_data.rs index 13dd651..e83ab1a 100644 --- a/src/models/budget_detail_response_data.rs +++ b/src/models/budget_detail_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct BudgetDetailResponseData { #[serde(rename = "budget")] @@ -22,8 +23,8 @@ pub struct BudgetDetailResponseData { impl BudgetDetailResponseData { pub fn new(budget: crate::models::BudgetDetail, server_knowledge: i64) -> BudgetDetailResponseData { BudgetDetailResponseData { - budget: budget, - server_knowledge: server_knowledge, + budget, + server_knowledge, } } } diff --git a/src/models/budget_settings.rs b/src/models/budget_settings.rs index adb2d78..c1506bf 100644 --- a/src/models/budget_settings.rs +++ b/src/models/budget_settings.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct BudgetSettings { #[serde(rename = "date_format")] @@ -21,8 +22,8 @@ pub struct BudgetSettings { impl BudgetSettings { pub fn new(date_format: crate::models::DateFormat, currency_format: crate::models::CurrencyFormat) -> BudgetSettings { BudgetSettings { - date_format: date_format, - currency_format: currency_format, + date_format, + currency_format, } } } diff --git a/src/models/budget_settings_response.rs b/src/models/budget_settings_response.rs index e6a3fb8..fe93039 100644 --- a/src/models/budget_settings_response.rs +++ b/src/models/budget_settings_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct BudgetSettingsResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct BudgetSettingsResponse { impl BudgetSettingsResponse { pub fn new(data: crate::models::BudgetSettingsResponseData) -> BudgetSettingsResponse { BudgetSettingsResponse { - data: data, + data, } } } diff --git a/src/models/budget_settings_response_data.rs b/src/models/budget_settings_response_data.rs index bc9045e..63879fb 100644 --- a/src/models/budget_settings_response_data.rs +++ b/src/models/budget_settings_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct BudgetSettingsResponseData { #[serde(rename = "settings")] @@ -19,7 +20,7 @@ pub struct BudgetSettingsResponseData { impl BudgetSettingsResponseData { pub fn new(settings: crate::models::BudgetSettings) -> BudgetSettingsResponseData { BudgetSettingsResponseData { - settings: settings, + settings, } } } diff --git a/src/models/budget_summary.rs b/src/models/budget_summary.rs index 742fcdf..a36abd8 100644 --- a/src/models/budget_summary.rs +++ b/src/models/budget_summary.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct BudgetSummary { #[serde(rename = "id")] @@ -34,8 +35,8 @@ pub struct BudgetSummary { impl BudgetSummary { pub fn new(id: String, name: String) -> BudgetSummary { BudgetSummary { - id: id, - name: name, + id, + name, last_modified_on: None, first_month: None, last_month: None, diff --git a/src/models/budget_summary_response.rs b/src/models/budget_summary_response.rs index 2327d4d..e2a0bc4 100644 --- a/src/models/budget_summary_response.rs +++ b/src/models/budget_summary_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct BudgetSummaryResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct BudgetSummaryResponse { impl BudgetSummaryResponse { pub fn new(data: crate::models::BudgetSummaryResponseData) -> BudgetSummaryResponse { BudgetSummaryResponse { - data: data, + data, } } } diff --git a/src/models/budget_summary_response_data.rs b/src/models/budget_summary_response_data.rs index 90802e7..938775d 100644 --- a/src/models/budget_summary_response_data.rs +++ b/src/models/budget_summary_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct BudgetSummaryResponseData { #[serde(rename = "budgets")] @@ -21,7 +22,7 @@ pub struct BudgetSummaryResponseData { impl BudgetSummaryResponseData { pub fn new(budgets: Vec) -> BudgetSummaryResponseData { BudgetSummaryResponseData { - budgets: budgets, + budgets, default_budget: None, } } diff --git a/src/models/bulk_response.rs b/src/models/bulk_response.rs index f40b58b..f6a9438 100644 --- a/src/models/bulk_response.rs +++ b/src/models/bulk_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct BulkResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct BulkResponse { impl BulkResponse { pub fn new(data: crate::models::BulkResponseData) -> BulkResponse { BulkResponse { - data: data, + data, } } } diff --git a/src/models/bulk_response_data.rs b/src/models/bulk_response_data.rs index 192b489..389e2c5 100644 --- a/src/models/bulk_response_data.rs +++ b/src/models/bulk_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct BulkResponseData { #[serde(rename = "bulk")] @@ -19,7 +20,7 @@ pub struct BulkResponseData { impl BulkResponseData { pub fn new(bulk: crate::models::BulkResponseDataBulk) -> BulkResponseData { BulkResponseData { - bulk: bulk, + bulk, } } } diff --git a/src/models/bulk_response_data_bulk.rs b/src/models/bulk_response_data_bulk.rs index 538f48c..4ca0e45 100644 --- a/src/models/bulk_response_data_bulk.rs +++ b/src/models/bulk_response_data_bulk.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct BulkResponseDataBulk { /// The list of Transaction ids that were created. @@ -23,8 +24,8 @@ pub struct BulkResponseDataBulk { impl BulkResponseDataBulk { pub fn new(transaction_ids: Vec, duplicate_import_ids: Vec) -> BulkResponseDataBulk { BulkResponseDataBulk { - transaction_ids: transaction_ids, - duplicate_import_ids: duplicate_import_ids, + transaction_ids, + duplicate_import_ids, } } } diff --git a/src/models/bulk_transactions.rs b/src/models/bulk_transactions.rs index b3e0466..f84874c 100644 --- a/src/models/bulk_transactions.rs +++ b/src/models/bulk_transactions.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct BulkTransactions { #[serde(rename = "transactions")] @@ -19,7 +20,7 @@ pub struct BulkTransactions { impl BulkTransactions { pub fn new(transactions: Vec) -> BulkTransactions { BulkTransactions { - transactions: transactions, + transactions, } } } diff --git a/src/models/categories_response.rs b/src/models/categories_response.rs index 8b804c0..f4d570f 100644 --- a/src/models/categories_response.rs +++ b/src/models/categories_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct CategoriesResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct CategoriesResponse { impl CategoriesResponse { pub fn new(data: crate::models::CategoriesResponseData) -> CategoriesResponse { CategoriesResponse { - data: data, + data, } } } diff --git a/src/models/categories_response_data.rs b/src/models/categories_response_data.rs index 5a1dad3..62c3002 100644 --- a/src/models/categories_response_data.rs +++ b/src/models/categories_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct CategoriesResponseData { #[serde(rename = "category_groups")] @@ -22,8 +23,8 @@ pub struct CategoriesResponseData { impl CategoriesResponseData { pub fn new(category_groups: Vec, server_knowledge: i64) -> CategoriesResponseData { CategoriesResponseData { - category_groups: category_groups, - server_knowledge: server_knowledge, + category_groups, + server_knowledge, } } } diff --git a/src/models/category.rs b/src/models/category.rs index 6677f8d..253f061 100644 --- a/src/models/category.rs +++ b/src/models/category.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct Category { #[serde(rename = "id")] @@ -42,8 +43,8 @@ pub struct Category { #[serde(rename = "goal_creation_month", skip_serializing_if = "Option::is_none")] pub goal_creation_month: Option, /// The goal target amount in milliunits - #[serde(rename = "goal_target")] - pub goal_target: i64, + #[serde(rename = "goal_target", skip_serializing_if = "Option::is_none")] + pub goal_target: Option, /// 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", skip_serializing_if = "Option::is_none")] pub goal_target_month: Option, @@ -56,23 +57,23 @@ pub struct Category { } impl 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 { + pub fn new(id: String, category_group_id: String, name: String, hidden: bool, budgeted: i64, activity: i64, balance: i64, deleted: bool) -> Category { Category { - id: id, - category_group_id: category_group_id, - name: name, - hidden: hidden, + id, + category_group_id, + name, + hidden, original_category_group_id: None, note: None, - budgeted: budgeted, - activity: activity, - balance: balance, + budgeted, + activity, + balance, goal_type: None, goal_creation_month: None, - goal_target: goal_target, + goal_target: None, goal_target_month: None, goal_percentage_complete: None, - deleted: deleted, + deleted, } } } diff --git a/src/models/category_group.rs b/src/models/category_group.rs index b4f75ee..9200d80 100644 --- a/src/models/category_group.rs +++ b/src/models/category_group.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct CategoryGroup { #[serde(rename = "id")] @@ -27,10 +28,10 @@ pub struct CategoryGroup { impl CategoryGroup { pub fn new(id: String, name: String, hidden: bool, deleted: bool) -> CategoryGroup { CategoryGroup { - id: id, - name: name, - hidden: hidden, - deleted: deleted, + id, + name, + hidden, + deleted, } } } diff --git a/src/models/category_group_with_categories.rs b/src/models/category_group_with_categories.rs index f674b4c..161294a 100644 --- a/src/models/category_group_with_categories.rs +++ b/src/models/category_group_with_categories.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct CategoryGroupWithCategories { #[serde(rename = "id")] @@ -30,11 +31,11 @@ pub struct CategoryGroupWithCategories { impl CategoryGroupWithCategories { pub fn new(id: String, name: String, hidden: bool, deleted: bool, categories: Vec) -> CategoryGroupWithCategories { CategoryGroupWithCategories { - id: id, - name: name, - hidden: hidden, - deleted: deleted, - categories: categories, + id, + name, + hidden, + deleted, + categories, } } } diff --git a/src/models/category_group_with_categories_all_of.rs b/src/models/category_group_with_categories_all_of.rs index 0820aef..83dcd00 100644 --- a/src/models/category_group_with_categories_all_of.rs +++ b/src/models/category_group_with_categories_all_of.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct CategoryGroupWithCategoriesAllOf { /// Category group categories. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). @@ -20,7 +21,7 @@ pub struct CategoryGroupWithCategoriesAllOf { impl CategoryGroupWithCategoriesAllOf { pub fn new(categories: Vec) -> CategoryGroupWithCategoriesAllOf { CategoryGroupWithCategoriesAllOf { - categories: categories, + categories, } } } diff --git a/src/models/category_response.rs b/src/models/category_response.rs index 13dff4a..179fc1b 100644 --- a/src/models/category_response.rs +++ b/src/models/category_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct CategoryResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct CategoryResponse { impl CategoryResponse { pub fn new(data: crate::models::CategoryResponseData) -> CategoryResponse { CategoryResponse { - data: data, + data, } } } diff --git a/src/models/category_response_data.rs b/src/models/category_response_data.rs index 078f720..9afeb49 100644 --- a/src/models/category_response_data.rs +++ b/src/models/category_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct CategoryResponseData { #[serde(rename = "category")] @@ -19,7 +20,7 @@ pub struct CategoryResponseData { impl CategoryResponseData { pub fn new(category: crate::models::Category) -> CategoryResponseData { CategoryResponseData { - category: category, + category, } } } diff --git a/src/models/currency_format.rs b/src/models/currency_format.rs index 8831679..44a99aa 100644 --- a/src/models/currency_format.rs +++ b/src/models/currency_format.rs @@ -11,6 +11,7 @@ /// CurrencyFormat : The currency format setting for the budget. In some cases the format will not be available and will be specified as null. + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct CurrencyFormat { #[serde(rename = "iso_code")] @@ -35,14 +36,14 @@ impl CurrencyFormat { /// The currency format setting for the budget. In some cases the format will not be available and will be specified as null. pub fn new(iso_code: String, example_format: String, decimal_digits: i32, decimal_separator: String, symbol_first: bool, group_separator: String, currency_symbol: String, display_symbol: bool) -> CurrencyFormat { CurrencyFormat { - iso_code: iso_code, - example_format: example_format, - decimal_digits: decimal_digits, - decimal_separator: decimal_separator, - symbol_first: symbol_first, - group_separator: group_separator, - currency_symbol: currency_symbol, - display_symbol: display_symbol, + iso_code, + example_format, + decimal_digits, + decimal_separator, + symbol_first, + group_separator, + currency_symbol, + display_symbol, } } } diff --git a/src/models/date_format.rs b/src/models/date_format.rs index d9259d9..9a4ce0f 100644 --- a/src/models/date_format.rs +++ b/src/models/date_format.rs @@ -11,6 +11,7 @@ /// DateFormat : The date format setting for the budget. In some cases the format will not be available and will be specified as null. + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct DateFormat { #[serde(rename = "format")] @@ -21,7 +22,7 @@ impl DateFormat { /// The date format setting for the budget. In some cases the format will not be available and will be specified as null. pub fn new(format: String) -> DateFormat { DateFormat { - format: format, + format, } } } diff --git a/src/models/error_detail.rs b/src/models/error_detail.rs index 32e0380..b8ce02a 100644 --- a/src/models/error_detail.rs +++ b/src/models/error_detail.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct ErrorDetail { #[serde(rename = "id")] @@ -23,9 +24,9 @@ pub struct ErrorDetail { impl ErrorDetail { pub fn new(id: String, name: String, detail: String) -> ErrorDetail { ErrorDetail { - id: id, - name: name, - detail: detail, + id, + name, + detail, } } } diff --git a/src/models/error_response.rs b/src/models/error_response.rs index 49760b3..7c43363 100644 --- a/src/models/error_response.rs +++ b/src/models/error_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct ErrorResponse { #[serde(rename = "error")] @@ -19,7 +20,7 @@ pub struct ErrorResponse { impl ErrorResponse { pub fn new(error: crate::models::ErrorDetail) -> ErrorResponse { ErrorResponse { - error: error, + error, } } } diff --git a/src/models/hybrid_transaction.rs b/src/models/hybrid_transaction.rs index a0b0f07..9085d6f 100644 --- a/src/models/hybrid_transaction.rs +++ b/src/models/hybrid_transaction.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct HybridTransaction { #[serde(rename = "id")] @@ -24,13 +25,13 @@ pub struct HybridTransaction { pub memo: Option, /// The cleared status of the transaction #[serde(rename = "cleared")] - pub cleared: String, + pub cleared: Cleared, /// Whether or not the transaction is approved #[serde(rename = "approved")] pub approved: bool, /// The transaction flag #[serde(rename = "flag_color", skip_serializing_if = "Option::is_none")] - pub flag_color: Option, + pub flag_color: Option, #[serde(rename = "account_id")] pub account_id: String, #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")] @@ -67,32 +68,58 @@ pub struct HybridTransaction { } impl HybridTransaction { - pub fn new(id: String, date: String, amount: i64, cleared: String, approved: bool, account_id: String, deleted: bool, _type: Type, account_name: String) -> HybridTransaction { + pub fn new(id: String, date: String, amount: i64, cleared: Cleared, approved: bool, account_id: String, deleted: bool, _type: Type, account_name: String) -> HybridTransaction { HybridTransaction { - id: id, - date: date, - amount: amount, + id, + date, + amount, memo: None, - cleared: cleared, - approved: approved, + cleared, + approved, flag_color: None, - account_id: account_id, + account_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, + deleted, + _type, parent_transaction_id: None, - account_name: account_name, + account_name, payee_name: None, category_name: None, } } } +/// The cleared status of the transaction +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum Cleared { + #[serde(rename = "cleared")] + Cleared, + #[serde(rename = "uncleared")] + Uncleared, + #[serde(rename = "reconciled")] + Reconciled, +} +/// The transaction flag +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum FlagColor { + #[serde(rename = "red")] + Red, + #[serde(rename = "orange")] + Orange, + #[serde(rename = "yellow")] + Yellow, + #[serde(rename = "green")] + Green, + #[serde(rename = "blue")] + Blue, + #[serde(rename = "purple")] + Purple, +} /// Whether the hybrid transaction represents a regular transaction or a subtransaction #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Type { diff --git a/src/models/hybrid_transaction_all_of.rs b/src/models/hybrid_transaction_all_of.rs index 7092a71..c5ff791 100644 --- a/src/models/hybrid_transaction_all_of.rs +++ b/src/models/hybrid_transaction_all_of.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct HybridTransactionAllOf { /// Whether the hybrid transaction represents a regular transaction or a subtransaction @@ -29,9 +30,9 @@ pub struct HybridTransactionAllOf { impl HybridTransactionAllOf { pub fn new(_type: Type, account_name: String) -> HybridTransactionAllOf { HybridTransactionAllOf { - _type: _type, + _type, parent_transaction_id: None, - account_name: account_name, + account_name, payee_name: None, category_name: None, } diff --git a/src/models/hybrid_transactions_response.rs b/src/models/hybrid_transactions_response.rs index 11926f7..46896dd 100644 --- a/src/models/hybrid_transactions_response.rs +++ b/src/models/hybrid_transactions_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct HybridTransactionsResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct HybridTransactionsResponse { impl HybridTransactionsResponse { pub fn new(data: crate::models::HybridTransactionsResponseData) -> HybridTransactionsResponse { HybridTransactionsResponse { - data: data, + data, } } } diff --git a/src/models/hybrid_transactions_response_data.rs b/src/models/hybrid_transactions_response_data.rs index b0b8143..a2b62d1 100644 --- a/src/models/hybrid_transactions_response_data.rs +++ b/src/models/hybrid_transactions_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct HybridTransactionsResponseData { #[serde(rename = "transactions")] @@ -19,7 +20,7 @@ pub struct HybridTransactionsResponseData { impl HybridTransactionsResponseData { pub fn new(transactions: Vec) -> HybridTransactionsResponseData { HybridTransactionsResponseData { - transactions: transactions, + transactions, } } } diff --git a/src/models/mod.rs b/src/models/mod.rs index 45b8f62..b8ec6a1 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -1,166 +1,166 @@ -mod account; +pub mod account; pub use self::account::Account; -mod account_response; +pub mod account_response; pub use self::account_response::AccountResponse; -mod account_response_data; +pub mod account_response_data; pub use self::account_response_data::AccountResponseData; -mod accounts_response; +pub mod accounts_response; pub use self::accounts_response::AccountsResponse; -mod accounts_response_data; +pub mod accounts_response_data; pub use self::accounts_response_data::AccountsResponseData; -mod budget_detail; +pub mod budget_detail; pub use self::budget_detail::BudgetDetail; -mod budget_detail_all_of; +pub mod budget_detail_all_of; pub use self::budget_detail_all_of::BudgetDetailAllOf; -mod budget_detail_response; +pub mod budget_detail_response; pub use self::budget_detail_response::BudgetDetailResponse; -mod budget_detail_response_data; +pub mod budget_detail_response_data; pub use self::budget_detail_response_data::BudgetDetailResponseData; -mod budget_settings; +pub mod budget_settings; pub use self::budget_settings::BudgetSettings; -mod budget_settings_response; +pub mod budget_settings_response; pub use self::budget_settings_response::BudgetSettingsResponse; -mod budget_settings_response_data; +pub mod budget_settings_response_data; pub use self::budget_settings_response_data::BudgetSettingsResponseData; -mod budget_summary; +pub mod budget_summary; pub use self::budget_summary::BudgetSummary; -mod budget_summary_response; +pub mod budget_summary_response; pub use self::budget_summary_response::BudgetSummaryResponse; -mod budget_summary_response_data; +pub mod budget_summary_response_data; pub use self::budget_summary_response_data::BudgetSummaryResponseData; -mod bulk_response; +pub mod bulk_response; pub use self::bulk_response::BulkResponse; -mod bulk_response_data; +pub mod bulk_response_data; pub use self::bulk_response_data::BulkResponseData; -mod bulk_response_data_bulk; +pub mod bulk_response_data_bulk; pub use self::bulk_response_data_bulk::BulkResponseDataBulk; -mod bulk_transactions; +pub mod bulk_transactions; pub use self::bulk_transactions::BulkTransactions; -mod categories_response; +pub mod categories_response; pub use self::categories_response::CategoriesResponse; -mod categories_response_data; +pub mod categories_response_data; pub use self::categories_response_data::CategoriesResponseData; -mod category; +pub mod category; pub use self::category::Category; -mod category_group; +pub mod category_group; pub use self::category_group::CategoryGroup; -mod category_group_with_categories; +pub mod category_group_with_categories; pub use self::category_group_with_categories::CategoryGroupWithCategories; -mod category_group_with_categories_all_of; +pub mod category_group_with_categories_all_of; pub use self::category_group_with_categories_all_of::CategoryGroupWithCategoriesAllOf; -mod category_response; +pub mod category_response; pub use self::category_response::CategoryResponse; -mod category_response_data; +pub mod category_response_data; pub use self::category_response_data::CategoryResponseData; -mod currency_format; +pub mod currency_format; pub use self::currency_format::CurrencyFormat; -mod date_format; +pub mod date_format; pub use self::date_format::DateFormat; -mod error_detail; +pub mod error_detail; pub use self::error_detail::ErrorDetail; -mod error_response; +pub mod error_response; pub use self::error_response::ErrorResponse; -mod hybrid_transaction; +pub mod hybrid_transaction; pub use self::hybrid_transaction::HybridTransaction; -mod hybrid_transaction_all_of; +pub mod hybrid_transaction_all_of; pub use self::hybrid_transaction_all_of::HybridTransactionAllOf; -mod hybrid_transactions_response; +pub mod hybrid_transactions_response; pub use self::hybrid_transactions_response::HybridTransactionsResponse; -mod hybrid_transactions_response_data; +pub mod hybrid_transactions_response_data; pub use self::hybrid_transactions_response_data::HybridTransactionsResponseData; -mod month_detail; +pub mod month_detail; pub use self::month_detail::MonthDetail; -mod month_detail_all_of; +pub mod month_detail_all_of; pub use self::month_detail_all_of::MonthDetailAllOf; -mod month_detail_response; +pub mod month_detail_response; pub use self::month_detail_response::MonthDetailResponse; -mod month_detail_response_data; +pub mod month_detail_response_data; pub use self::month_detail_response_data::MonthDetailResponseData; -mod month_summaries_response; +pub mod month_summaries_response; pub use self::month_summaries_response::MonthSummariesResponse; -mod month_summaries_response_data; +pub mod month_summaries_response_data; pub use self::month_summaries_response_data::MonthSummariesResponseData; -mod month_summary; +pub mod month_summary; pub use self::month_summary::MonthSummary; -mod payee; +pub mod payee; pub use self::payee::Payee; -mod payee_location; +pub mod payee_location; pub use self::payee_location::PayeeLocation; -mod payee_location_response; +pub mod payee_location_response; pub use self::payee_location_response::PayeeLocationResponse; -mod payee_location_response_data; +pub mod payee_location_response_data; pub use self::payee_location_response_data::PayeeLocationResponseData; -mod payee_locations_response; +pub mod payee_locations_response; pub use self::payee_locations_response::PayeeLocationsResponse; -mod payee_locations_response_data; +pub mod payee_locations_response_data; pub use self::payee_locations_response_data::PayeeLocationsResponseData; -mod payee_response; +pub mod payee_response; pub use self::payee_response::PayeeResponse; -mod payee_response_data; +pub mod payee_response_data; pub use self::payee_response_data::PayeeResponseData; -mod payees_response; +pub mod payees_response; pub use self::payees_response::PayeesResponse; -mod payees_response_data; +pub mod payees_response_data; pub use self::payees_response_data::PayeesResponseData; -mod save_category_response; +pub mod save_category_response; pub use self::save_category_response::SaveCategoryResponse; -mod save_category_response_data; +pub mod save_category_response_data; pub use self::save_category_response_data::SaveCategoryResponseData; -mod save_month_category; +pub mod save_month_category; pub use self::save_month_category::SaveMonthCategory; -mod save_month_category_wrapper; +pub mod save_month_category_wrapper; pub use self::save_month_category_wrapper::SaveMonthCategoryWrapper; -mod save_transaction; +pub mod save_transaction; pub use self::save_transaction::SaveTransaction; -mod save_transaction_wrapper; +pub mod save_transaction_wrapper; pub use self::save_transaction_wrapper::SaveTransactionWrapper; -mod save_transactions_response; +pub mod save_transactions_response; pub use self::save_transactions_response::SaveTransactionsResponse; -mod save_transactions_response_data; +pub mod save_transactions_response_data; pub use self::save_transactions_response_data::SaveTransactionsResponseData; -mod save_transactions_wrapper; +pub mod save_transactions_wrapper; pub use self::save_transactions_wrapper::SaveTransactionsWrapper; -mod scheduled_sub_transaction; +pub mod scheduled_sub_transaction; pub use self::scheduled_sub_transaction::ScheduledSubTransaction; -mod scheduled_transaction_detail; +pub mod scheduled_transaction_detail; pub use self::scheduled_transaction_detail::ScheduledTransactionDetail; -mod scheduled_transaction_detail_all_of; +pub mod scheduled_transaction_detail_all_of; pub use self::scheduled_transaction_detail_all_of::ScheduledTransactionDetailAllOf; -mod scheduled_transaction_response; +pub mod scheduled_transaction_response; pub use self::scheduled_transaction_response::ScheduledTransactionResponse; -mod scheduled_transaction_response_data; +pub mod scheduled_transaction_response_data; pub use self::scheduled_transaction_response_data::ScheduledTransactionResponseData; -mod scheduled_transaction_summary; +pub mod scheduled_transaction_summary; pub use self::scheduled_transaction_summary::ScheduledTransactionSummary; -mod scheduled_transactions_response; +pub mod scheduled_transactions_response; pub use self::scheduled_transactions_response::ScheduledTransactionsResponse; -mod scheduled_transactions_response_data; +pub mod scheduled_transactions_response_data; pub use self::scheduled_transactions_response_data::ScheduledTransactionsResponseData; -mod sub_transaction; +pub mod sub_transaction; pub use self::sub_transaction::SubTransaction; -mod transaction_detail; +pub mod transaction_detail; pub use self::transaction_detail::TransactionDetail; -mod transaction_detail_all_of; +pub mod transaction_detail_all_of; pub use self::transaction_detail_all_of::TransactionDetailAllOf; -mod transaction_response; +pub mod transaction_response; pub use self::transaction_response::TransactionResponse; -mod transaction_response_data; +pub mod transaction_response_data; pub use self::transaction_response_data::TransactionResponseData; -mod transaction_summary; +pub mod transaction_summary; pub use self::transaction_summary::TransactionSummary; -mod transactions_response; +pub mod transactions_response; pub use self::transactions_response::TransactionsResponse; -mod transactions_response_data; +pub mod transactions_response_data; pub use self::transactions_response_data::TransactionsResponseData; -mod update_transaction; +pub mod update_transaction; pub use self::update_transaction::UpdateTransaction; -mod update_transaction_all_of; +pub mod update_transaction_all_of; pub use self::update_transaction_all_of::UpdateTransactionAllOf; -mod update_transactions_wrapper; +pub mod update_transactions_wrapper; pub use self::update_transactions_wrapper::UpdateTransactionsWrapper; -mod user; +pub mod user; pub use self::user::User; -mod user_response; +pub mod user_response; pub use self::user_response::UserResponse; -mod user_response_data; +pub mod user_response_data; pub use self::user_response_data::UserResponseData; diff --git a/src/models/month_detail.rs b/src/models/month_detail.rs index 28b6d56..32b6f9e 100644 --- a/src/models/month_detail.rs +++ b/src/models/month_detail.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct MonthDetail { #[serde(rename = "month")] @@ -42,15 +43,15 @@ pub struct MonthDetail { impl MonthDetail { pub fn new(month: String, income: i64, budgeted: i64, activity: i64, to_be_budgeted: i64, deleted: bool, categories: Vec) -> MonthDetail { MonthDetail { - month: month, + month, note: None, - income: income, - budgeted: budgeted, - activity: activity, - to_be_budgeted: to_be_budgeted, + income, + budgeted, + activity, + to_be_budgeted, age_of_money: None, - deleted: deleted, - categories: categories, + deleted, + categories, } } } diff --git a/src/models/month_detail_all_of.rs b/src/models/month_detail_all_of.rs index a805bba..2d816a8 100644 --- a/src/models/month_detail_all_of.rs +++ b/src/models/month_detail_all_of.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct MonthDetailAllOf { /// The budget month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified. @@ -20,7 +21,7 @@ pub struct MonthDetailAllOf { impl MonthDetailAllOf { pub fn new(categories: Vec) -> MonthDetailAllOf { MonthDetailAllOf { - categories: categories, + categories, } } } diff --git a/src/models/month_detail_response.rs b/src/models/month_detail_response.rs index 9c6d3b9..a0447a4 100644 --- a/src/models/month_detail_response.rs +++ b/src/models/month_detail_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct MonthDetailResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct MonthDetailResponse { impl MonthDetailResponse { pub fn new(data: crate::models::MonthDetailResponseData) -> MonthDetailResponse { MonthDetailResponse { - data: data, + data, } } } diff --git a/src/models/month_detail_response_data.rs b/src/models/month_detail_response_data.rs index 3a60eb5..703648d 100644 --- a/src/models/month_detail_response_data.rs +++ b/src/models/month_detail_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct MonthDetailResponseData { #[serde(rename = "month")] @@ -19,7 +20,7 @@ pub struct MonthDetailResponseData { impl MonthDetailResponseData { pub fn new(month: crate::models::MonthDetail) -> MonthDetailResponseData { MonthDetailResponseData { - month: month, + month, } } } diff --git a/src/models/month_summaries_response.rs b/src/models/month_summaries_response.rs index 7158753..3f376f9 100644 --- a/src/models/month_summaries_response.rs +++ b/src/models/month_summaries_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct MonthSummariesResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct MonthSummariesResponse { impl MonthSummariesResponse { pub fn new(data: crate::models::MonthSummariesResponseData) -> MonthSummariesResponse { MonthSummariesResponse { - data: data, + data, } } } diff --git a/src/models/month_summaries_response_data.rs b/src/models/month_summaries_response_data.rs index 03ed9d5..4d32a69 100644 --- a/src/models/month_summaries_response_data.rs +++ b/src/models/month_summaries_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct MonthSummariesResponseData { #[serde(rename = "months")] @@ -22,8 +23,8 @@ pub struct MonthSummariesResponseData { impl MonthSummariesResponseData { pub fn new(months: Vec, server_knowledge: i64) -> MonthSummariesResponseData { MonthSummariesResponseData { - months: months, - server_knowledge: server_knowledge, + months, + server_knowledge, } } } diff --git a/src/models/month_summary.rs b/src/models/month_summary.rs index f1efaee..b0d67e9 100644 --- a/src/models/month_summary.rs +++ b/src/models/month_summary.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct MonthSummary { #[serde(rename = "month")] @@ -39,14 +40,14 @@ pub struct MonthSummary { impl MonthSummary { pub fn new(month: String, income: i64, budgeted: i64, activity: i64, to_be_budgeted: i64, deleted: bool) -> MonthSummary { MonthSummary { - month: month, + month, note: None, - income: income, - budgeted: budgeted, - activity: activity, - to_be_budgeted: to_be_budgeted, + income, + budgeted, + activity, + to_be_budgeted, age_of_money: None, - deleted: deleted, + deleted, } } } diff --git a/src/models/payee.rs b/src/models/payee.rs index 0f17785..5822d85 100644 --- a/src/models/payee.rs +++ b/src/models/payee.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct Payee { #[serde(rename = "id")] @@ -27,10 +28,10 @@ pub struct Payee { impl Payee { pub fn new(id: String, name: String, deleted: bool) -> Payee { Payee { - id: id, - name: name, + id, + name, transfer_account_id: None, - deleted: deleted, + deleted, } } } diff --git a/src/models/payee_location.rs b/src/models/payee_location.rs index e40eea2..eca0584 100644 --- a/src/models/payee_location.rs +++ b/src/models/payee_location.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct PayeeLocation { #[serde(rename = "id")] @@ -28,11 +29,11 @@ pub struct PayeeLocation { impl PayeeLocation { pub fn new(id: String, payee_id: String, latitude: String, longitude: String, deleted: bool) -> PayeeLocation { PayeeLocation { - id: id, - payee_id: payee_id, - latitude: latitude, - longitude: longitude, - deleted: deleted, + id, + payee_id, + latitude, + longitude, + deleted, } } } diff --git a/src/models/payee_location_response.rs b/src/models/payee_location_response.rs index 66e2698..162d6d5 100644 --- a/src/models/payee_location_response.rs +++ b/src/models/payee_location_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct PayeeLocationResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct PayeeLocationResponse { impl PayeeLocationResponse { pub fn new(data: crate::models::PayeeLocationResponseData) -> PayeeLocationResponse { PayeeLocationResponse { - data: data, + data, } } } diff --git a/src/models/payee_location_response_data.rs b/src/models/payee_location_response_data.rs index 0da3992..99101d4 100644 --- a/src/models/payee_location_response_data.rs +++ b/src/models/payee_location_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct PayeeLocationResponseData { #[serde(rename = "payee_location")] @@ -19,7 +20,7 @@ pub struct PayeeLocationResponseData { impl PayeeLocationResponseData { pub fn new(payee_location: crate::models::PayeeLocation) -> PayeeLocationResponseData { PayeeLocationResponseData { - payee_location: payee_location, + payee_location, } } } diff --git a/src/models/payee_locations_response.rs b/src/models/payee_locations_response.rs index ab05f6e..147904a 100644 --- a/src/models/payee_locations_response.rs +++ b/src/models/payee_locations_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct PayeeLocationsResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct PayeeLocationsResponse { impl PayeeLocationsResponse { pub fn new(data: crate::models::PayeeLocationsResponseData) -> PayeeLocationsResponse { PayeeLocationsResponse { - data: data, + data, } } } diff --git a/src/models/payee_locations_response_data.rs b/src/models/payee_locations_response_data.rs index 32e061d..4557fac 100644 --- a/src/models/payee_locations_response_data.rs +++ b/src/models/payee_locations_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct PayeeLocationsResponseData { #[serde(rename = "payee_locations")] @@ -19,7 +20,7 @@ pub struct PayeeLocationsResponseData { impl PayeeLocationsResponseData { pub fn new(payee_locations: Vec) -> PayeeLocationsResponseData { PayeeLocationsResponseData { - payee_locations: payee_locations, + payee_locations, } } } diff --git a/src/models/payee_response.rs b/src/models/payee_response.rs index 650c90d..911fd18 100644 --- a/src/models/payee_response.rs +++ b/src/models/payee_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct PayeeResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct PayeeResponse { impl PayeeResponse { pub fn new(data: crate::models::PayeeResponseData) -> PayeeResponse { PayeeResponse { - data: data, + data, } } } diff --git a/src/models/payee_response_data.rs b/src/models/payee_response_data.rs index ff8e342..5c09b85 100644 --- a/src/models/payee_response_data.rs +++ b/src/models/payee_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct PayeeResponseData { #[serde(rename = "payee")] @@ -19,7 +20,7 @@ pub struct PayeeResponseData { impl PayeeResponseData { pub fn new(payee: crate::models::Payee) -> PayeeResponseData { PayeeResponseData { - payee: payee, + payee, } } } diff --git a/src/models/payees_response.rs b/src/models/payees_response.rs index bd6d6e1..bbe713d 100644 --- a/src/models/payees_response.rs +++ b/src/models/payees_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct PayeesResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct PayeesResponse { impl PayeesResponse { pub fn new(data: crate::models::PayeesResponseData) -> PayeesResponse { PayeesResponse { - data: data, + data, } } } diff --git a/src/models/payees_response_data.rs b/src/models/payees_response_data.rs index efa3313..7ce35d9 100644 --- a/src/models/payees_response_data.rs +++ b/src/models/payees_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct PayeesResponseData { #[serde(rename = "payees")] @@ -22,8 +23,8 @@ pub struct PayeesResponseData { impl PayeesResponseData { pub fn new(payees: Vec, server_knowledge: i64) -> PayeesResponseData { PayeesResponseData { - payees: payees, - server_knowledge: server_knowledge, + payees, + server_knowledge, } } } diff --git a/src/models/save_category_response.rs b/src/models/save_category_response.rs index 3d33509..153501c 100644 --- a/src/models/save_category_response.rs +++ b/src/models/save_category_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct SaveCategoryResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct SaveCategoryResponse { impl SaveCategoryResponse { pub fn new(data: crate::models::SaveCategoryResponseData) -> SaveCategoryResponse { SaveCategoryResponse { - data: data, + data, } } } diff --git a/src/models/save_category_response_data.rs b/src/models/save_category_response_data.rs index 536ba30..8f84251 100644 --- a/src/models/save_category_response_data.rs +++ b/src/models/save_category_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct SaveCategoryResponseData { #[serde(rename = "category")] @@ -22,8 +23,8 @@ pub struct SaveCategoryResponseData { impl SaveCategoryResponseData { pub fn new(category: crate::models::Category, server_knowledge: i64) -> SaveCategoryResponseData { SaveCategoryResponseData { - category: category, - server_knowledge: server_knowledge, + category, + server_knowledge, } } } diff --git a/src/models/save_month_category.rs b/src/models/save_month_category.rs index e2862eb..786f8ce 100644 --- a/src/models/save_month_category.rs +++ b/src/models/save_month_category.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct SaveMonthCategory { /// Budgeted amount in milliunits format @@ -20,7 +21,7 @@ pub struct SaveMonthCategory { impl SaveMonthCategory { pub fn new(budgeted: i64) -> SaveMonthCategory { SaveMonthCategory { - budgeted: budgeted, + budgeted, } } } diff --git a/src/models/save_month_category_wrapper.rs b/src/models/save_month_category_wrapper.rs index ddd7154..9382cbf 100644 --- a/src/models/save_month_category_wrapper.rs +++ b/src/models/save_month_category_wrapper.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct SaveMonthCategoryWrapper { #[serde(rename = "category")] @@ -19,7 +20,7 @@ pub struct SaveMonthCategoryWrapper { impl SaveMonthCategoryWrapper { pub fn new(category: crate::models::SaveMonthCategory) -> SaveMonthCategoryWrapper { SaveMonthCategoryWrapper { - category: category, + category, } } } diff --git a/src/models/save_transaction.rs b/src/models/save_transaction.rs index a864007..1031aca 100644 --- a/src/models/save_transaction.rs +++ b/src/models/save_transaction.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct SaveTransaction { #[serde(rename = "account_id")] @@ -33,13 +34,13 @@ pub struct SaveTransaction { pub memo: Option, /// The cleared status of the transaction #[serde(rename = "cleared", skip_serializing_if = "Option::is_none")] - pub cleared: Option, + pub cleared: Option, /// Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default. #[serde(rename = "approved", skip_serializing_if = "Option::is_none")] pub approved: Option, /// The transaction flag #[serde(rename = "flag_color", skip_serializing_if = "Option::is_none")] - pub flag_color: Option, + pub flag_color: Option, /// If specified, the new transaction will be assigned this import_id and considered \"imported\". We will also attempt to match this imported transaction to an existing \"user-entered\" transation on the same account, with the same amount, and with a date +/-10 days from the imported transaction date.

Transactions imported through File Based Import or Direct Import (not through the API) are assigned an import_id in 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'. Using a consistent format will prevent duplicates through Direct Import and File Based Import.

If import_id is omitted or specified as null, the transaction will be treated as a \"user-entered\" transaction. As such, it will be eligible to be matched against transactions later being imported (via DI, FBI, or API). #[serde(rename = "import_id", skip_serializing_if = "Option::is_none")] pub import_id: Option, @@ -48,9 +49,9 @@ pub struct SaveTransaction { impl SaveTransaction { pub fn new(account_id: String, date: String, amount: i64) -> SaveTransaction { SaveTransaction { - account_id: account_id, - date: date, - amount: amount, + account_id, + date, + amount, payee_id: None, payee_name: None, category_id: None, @@ -63,4 +64,30 @@ impl SaveTransaction { } } +/// The cleared status of the transaction +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum Cleared { + #[serde(rename = "cleared")] + Cleared, + #[serde(rename = "uncleared")] + Uncleared, + #[serde(rename = "reconciled")] + Reconciled, +} +/// The transaction flag +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum FlagColor { + #[serde(rename = "red")] + Red, + #[serde(rename = "orange")] + Orange, + #[serde(rename = "yellow")] + Yellow, + #[serde(rename = "green")] + Green, + #[serde(rename = "blue")] + Blue, + #[serde(rename = "purple")] + Purple, +} diff --git a/src/models/save_transaction_wrapper.rs b/src/models/save_transaction_wrapper.rs index 8152229..04b683a 100644 --- a/src/models/save_transaction_wrapper.rs +++ b/src/models/save_transaction_wrapper.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct SaveTransactionWrapper { #[serde(rename = "transaction")] @@ -19,7 +20,7 @@ pub struct SaveTransactionWrapper { impl SaveTransactionWrapper { pub fn new(transaction: crate::models::SaveTransaction) -> SaveTransactionWrapper { SaveTransactionWrapper { - transaction: transaction, + transaction, } } } diff --git a/src/models/save_transactions_response.rs b/src/models/save_transactions_response.rs index 9617ee3..d8a201d 100644 --- a/src/models/save_transactions_response.rs +++ b/src/models/save_transactions_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct SaveTransactionsResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct SaveTransactionsResponse { impl SaveTransactionsResponse { pub fn new(data: crate::models::SaveTransactionsResponseData) -> SaveTransactionsResponse { SaveTransactionsResponse { - data: data, + data, } } } diff --git a/src/models/save_transactions_response_data.rs b/src/models/save_transactions_response_data.rs index 0b76b5e..737192b 100644 --- a/src/models/save_transactions_response_data.rs +++ b/src/models/save_transactions_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct SaveTransactionsResponseData { /// The transaction ids that were saved @@ -31,11 +32,11 @@ pub struct SaveTransactionsResponseData { impl SaveTransactionsResponseData { pub fn new(transaction_ids: Vec, server_knowledge: i64) -> SaveTransactionsResponseData { SaveTransactionsResponseData { - transaction_ids: transaction_ids, + transaction_ids, transaction: None, transactions: None, duplicate_import_ids: None, - server_knowledge: server_knowledge, + server_knowledge, } } } diff --git a/src/models/save_transactions_wrapper.rs b/src/models/save_transactions_wrapper.rs index cb6613f..f3ae055 100644 --- a/src/models/save_transactions_wrapper.rs +++ b/src/models/save_transactions_wrapper.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct SaveTransactionsWrapper { #[serde(rename = "transaction", skip_serializing_if = "Option::is_none")] diff --git a/src/models/scheduled_sub_transaction.rs b/src/models/scheduled_sub_transaction.rs index 31a880f..d8da7d6 100644 --- a/src/models/scheduled_sub_transaction.rs +++ b/src/models/scheduled_sub_transaction.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct ScheduledSubTransaction { #[serde(rename = "id")] @@ -36,14 +37,14 @@ pub struct ScheduledSubTransaction { impl ScheduledSubTransaction { pub fn new(id: String, scheduled_transaction_id: String, amount: i64, deleted: bool) -> ScheduledSubTransaction { ScheduledSubTransaction { - id: id, - scheduled_transaction_id: scheduled_transaction_id, - amount: amount, + id, + scheduled_transaction_id, + amount, memo: None, payee_id: None, category_id: None, transfer_account_id: None, - deleted: deleted, + deleted, } } } diff --git a/src/models/scheduled_transaction_detail.rs b/src/models/scheduled_transaction_detail.rs index d553329..5cc2e65 100644 --- a/src/models/scheduled_transaction_detail.rs +++ b/src/models/scheduled_transaction_detail.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct ScheduledTransactionDetail { #[serde(rename = "id")] @@ -21,7 +22,7 @@ pub struct ScheduledTransactionDetail { #[serde(rename = "date_next")] pub date_next: String, #[serde(rename = "frequency")] - pub frequency: String, + pub frequency: Frequency, /// The scheduled transaction amount in milliunits format #[serde(rename = "amount")] pub amount: i64, @@ -29,7 +30,7 @@ pub struct ScheduledTransactionDetail { pub memo: Option, /// The scheduled transaction flag #[serde(rename = "flag_color", skip_serializing_if = "Option::is_none")] - pub flag_color: Option, + pub flag_color: Option, #[serde(rename = "account_id")] pub account_id: String, #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")] @@ -54,26 +55,72 @@ pub struct ScheduledTransactionDetail { } impl ScheduledTransactionDetail { - pub fn new(id: String, date_first: String, date_next: String, frequency: String, amount: i64, account_id: String, deleted: bool, account_name: String, subtransactions: Vec) -> ScheduledTransactionDetail { + pub fn new(id: String, date_first: String, date_next: String, frequency: Frequency, amount: i64, account_id: String, deleted: bool, account_name: String, subtransactions: Vec) -> ScheduledTransactionDetail { ScheduledTransactionDetail { - id: id, - date_first: date_first, - date_next: date_next, - frequency: frequency, - amount: amount, + id, + date_first, + date_next, + frequency, + amount, memo: None, flag_color: None, - account_id: account_id, + account_id, payee_id: None, category_id: None, transfer_account_id: None, - deleted: deleted, - account_name: account_name, + deleted, + account_name, payee_name: None, category_name: None, - subtransactions: subtransactions, + subtransactions, } } } +/// +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum Frequency { + #[serde(rename = "never")] + Never, + #[serde(rename = "daily")] + Daily, + #[serde(rename = "weekly")] + Weekly, + #[serde(rename = "everyOtherWeek")] + EveryOtherWeek, + #[serde(rename = "twiceAMonth")] + TwiceAMonth, + #[serde(rename = "every4Weeks")] + Every4Weeks, + #[serde(rename = "monthly")] + Monthly, + #[serde(rename = "everyOtherMonth")] + EveryOtherMonth, + #[serde(rename = "every3Months")] + Every3Months, + #[serde(rename = "every4Months")] + Every4Months, + #[serde(rename = "twiceAYear")] + TwiceAYear, + #[serde(rename = "yearly")] + Yearly, + #[serde(rename = "everyOtherYear")] + EveryOtherYear, +} +/// The scheduled transaction flag +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum FlagColor { + #[serde(rename = "red")] + Red, + #[serde(rename = "orange")] + Orange, + #[serde(rename = "yellow")] + Yellow, + #[serde(rename = "green")] + Green, + #[serde(rename = "blue")] + Blue, + #[serde(rename = "purple")] + Purple, +} diff --git a/src/models/scheduled_transaction_detail_all_of.rs b/src/models/scheduled_transaction_detail_all_of.rs index b977afd..21cfca0 100644 --- a/src/models/scheduled_transaction_detail_all_of.rs +++ b/src/models/scheduled_transaction_detail_all_of.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct ScheduledTransactionDetailAllOf { #[serde(rename = "account_name")] @@ -26,10 +27,10 @@ pub struct ScheduledTransactionDetailAllOf { impl ScheduledTransactionDetailAllOf { pub fn new(account_name: String, subtransactions: Vec) -> ScheduledTransactionDetailAllOf { ScheduledTransactionDetailAllOf { - account_name: account_name, + account_name, payee_name: None, category_name: None, - subtransactions: subtransactions, + subtransactions, } } } diff --git a/src/models/scheduled_transaction_response.rs b/src/models/scheduled_transaction_response.rs index 232e09f..09720ac 100644 --- a/src/models/scheduled_transaction_response.rs +++ b/src/models/scheduled_transaction_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct ScheduledTransactionResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct ScheduledTransactionResponse { impl ScheduledTransactionResponse { pub fn new(data: crate::models::ScheduledTransactionResponseData) -> ScheduledTransactionResponse { ScheduledTransactionResponse { - data: data, + data, } } } diff --git a/src/models/scheduled_transaction_response_data.rs b/src/models/scheduled_transaction_response_data.rs index 1cd7379..418dffb 100644 --- a/src/models/scheduled_transaction_response_data.rs +++ b/src/models/scheduled_transaction_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct ScheduledTransactionResponseData { #[serde(rename = "scheduled_transaction")] @@ -19,7 +20,7 @@ pub struct ScheduledTransactionResponseData { impl ScheduledTransactionResponseData { pub fn new(scheduled_transaction: crate::models::ScheduledTransactionDetail) -> ScheduledTransactionResponseData { ScheduledTransactionResponseData { - scheduled_transaction: scheduled_transaction, + scheduled_transaction, } } } diff --git a/src/models/scheduled_transaction_summary.rs b/src/models/scheduled_transaction_summary.rs index b70d53c..d380efb 100644 --- a/src/models/scheduled_transaction_summary.rs +++ b/src/models/scheduled_transaction_summary.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct ScheduledTransactionSummary { #[serde(rename = "id")] @@ -21,7 +22,7 @@ pub struct ScheduledTransactionSummary { #[serde(rename = "date_next")] pub date_next: String, #[serde(rename = "frequency")] - pub frequency: String, + pub frequency: Frequency, /// The scheduled transaction amount in milliunits format #[serde(rename = "amount")] pub amount: i64, @@ -29,7 +30,7 @@ pub struct ScheduledTransactionSummary { pub memo: Option, /// The scheduled transaction flag #[serde(rename = "flag_color", skip_serializing_if = "Option::is_none")] - pub flag_color: Option, + pub flag_color: Option, #[serde(rename = "account_id")] pub account_id: String, #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")] @@ -45,22 +46,68 @@ pub struct ScheduledTransactionSummary { } impl ScheduledTransactionSummary { - pub fn new(id: String, date_first: String, date_next: String, frequency: String, amount: i64, account_id: String, deleted: bool) -> ScheduledTransactionSummary { + pub fn new(id: String, date_first: String, date_next: String, frequency: Frequency, amount: i64, account_id: String, deleted: bool) -> ScheduledTransactionSummary { ScheduledTransactionSummary { - id: id, - date_first: date_first, - date_next: date_next, - frequency: frequency, - amount: amount, + id, + date_first, + date_next, + frequency, + amount, memo: None, flag_color: None, - account_id: account_id, + account_id, payee_id: None, category_id: None, transfer_account_id: None, - deleted: deleted, + deleted, } } } +/// +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum Frequency { + #[serde(rename = "never")] + Never, + #[serde(rename = "daily")] + Daily, + #[serde(rename = "weekly")] + Weekly, + #[serde(rename = "everyOtherWeek")] + EveryOtherWeek, + #[serde(rename = "twiceAMonth")] + TwiceAMonth, + #[serde(rename = "every4Weeks")] + Every4Weeks, + #[serde(rename = "monthly")] + Monthly, + #[serde(rename = "everyOtherMonth")] + EveryOtherMonth, + #[serde(rename = "every3Months")] + Every3Months, + #[serde(rename = "every4Months")] + Every4Months, + #[serde(rename = "twiceAYear")] + TwiceAYear, + #[serde(rename = "yearly")] + Yearly, + #[serde(rename = "everyOtherYear")] + EveryOtherYear, +} +/// The scheduled transaction flag +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum FlagColor { + #[serde(rename = "red")] + Red, + #[serde(rename = "orange")] + Orange, + #[serde(rename = "yellow")] + Yellow, + #[serde(rename = "green")] + Green, + #[serde(rename = "blue")] + Blue, + #[serde(rename = "purple")] + Purple, +} diff --git a/src/models/scheduled_transactions_response.rs b/src/models/scheduled_transactions_response.rs index 77d4376..f9731f0 100644 --- a/src/models/scheduled_transactions_response.rs +++ b/src/models/scheduled_transactions_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct ScheduledTransactionsResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct ScheduledTransactionsResponse { impl ScheduledTransactionsResponse { pub fn new(data: crate::models::ScheduledTransactionsResponseData) -> ScheduledTransactionsResponse { ScheduledTransactionsResponse { - data: data, + data, } } } diff --git a/src/models/scheduled_transactions_response_data.rs b/src/models/scheduled_transactions_response_data.rs index a9072d4..eeac95c 100644 --- a/src/models/scheduled_transactions_response_data.rs +++ b/src/models/scheduled_transactions_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct ScheduledTransactionsResponseData { #[serde(rename = "scheduled_transactions")] @@ -22,8 +23,8 @@ pub struct ScheduledTransactionsResponseData { impl ScheduledTransactionsResponseData { pub fn new(scheduled_transactions: Vec, server_knowledge: i64) -> ScheduledTransactionsResponseData { ScheduledTransactionsResponseData { - scheduled_transactions: scheduled_transactions, - server_knowledge: server_knowledge, + scheduled_transactions, + server_knowledge, } } } diff --git a/src/models/sub_transaction.rs b/src/models/sub_transaction.rs index 639d5e7..d1d7f48 100644 --- a/src/models/sub_transaction.rs +++ b/src/models/sub_transaction.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct SubTransaction { #[serde(rename = "id")] @@ -36,14 +37,14 @@ pub struct SubTransaction { impl SubTransaction { pub fn new(id: String, transaction_id: String, amount: i64, deleted: bool) -> SubTransaction { SubTransaction { - id: id, - transaction_id: transaction_id, - amount: amount, + id, + transaction_id, + amount, memo: None, payee_id: None, category_id: None, transfer_account_id: None, - deleted: deleted, + deleted, } } } diff --git a/src/models/transaction_detail.rs b/src/models/transaction_detail.rs index ca6be2e..b363b3b 100644 --- a/src/models/transaction_detail.rs +++ b/src/models/transaction_detail.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct TransactionDetail { #[serde(rename = "id")] @@ -24,13 +25,13 @@ pub struct TransactionDetail { pub memo: Option, /// The cleared status of the transaction #[serde(rename = "cleared")] - pub cleared: String, + pub cleared: Cleared, /// Whether or not the transaction is approved #[serde(rename = "approved")] pub approved: bool, /// The transaction flag #[serde(rename = "flag_color", skip_serializing_if = "Option::is_none")] - pub flag_color: Option, + pub flag_color: Option, #[serde(rename = "account_id")] pub account_id: String, #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")] @@ -64,29 +65,55 @@ pub struct TransactionDetail { } impl TransactionDetail { - pub fn new(id: String, date: String, amount: i64, cleared: String, approved: bool, account_id: String, deleted: bool, account_name: String, subtransactions: Vec) -> TransactionDetail { + pub fn new(id: String, date: String, amount: i64, cleared: Cleared, approved: bool, account_id: String, deleted: bool, account_name: String, subtransactions: Vec) -> TransactionDetail { TransactionDetail { - id: id, - date: date, - amount: amount, + id, + date, + amount, memo: None, - cleared: cleared, - approved: approved, + cleared, + approved, flag_color: None, - account_id: account_id, + account_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, + deleted, + account_name, payee_name: None, category_name: None, - subtransactions: subtransactions, + subtransactions, } } } +/// The cleared status of the transaction +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum Cleared { + #[serde(rename = "cleared")] + Cleared, + #[serde(rename = "uncleared")] + Uncleared, + #[serde(rename = "reconciled")] + Reconciled, +} +/// The transaction flag +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum FlagColor { + #[serde(rename = "red")] + Red, + #[serde(rename = "orange")] + Orange, + #[serde(rename = "yellow")] + Yellow, + #[serde(rename = "green")] + Green, + #[serde(rename = "blue")] + Blue, + #[serde(rename = "purple")] + Purple, +} diff --git a/src/models/transaction_detail_all_of.rs b/src/models/transaction_detail_all_of.rs index 68f2ebf..3c0df98 100644 --- a/src/models/transaction_detail_all_of.rs +++ b/src/models/transaction_detail_all_of.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct TransactionDetailAllOf { #[serde(rename = "account_name")] @@ -26,10 +27,10 @@ pub struct TransactionDetailAllOf { impl TransactionDetailAllOf { pub fn new(account_name: String, subtransactions: Vec) -> TransactionDetailAllOf { TransactionDetailAllOf { - account_name: account_name, + account_name, payee_name: None, category_name: None, - subtransactions: subtransactions, + subtransactions, } } } diff --git a/src/models/transaction_response.rs b/src/models/transaction_response.rs index 63ff8f1..13e87df 100644 --- a/src/models/transaction_response.rs +++ b/src/models/transaction_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct TransactionResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct TransactionResponse { impl TransactionResponse { pub fn new(data: crate::models::TransactionResponseData) -> TransactionResponse { TransactionResponse { - data: data, + data, } } } diff --git a/src/models/transaction_response_data.rs b/src/models/transaction_response_data.rs index e9af627..a026aad 100644 --- a/src/models/transaction_response_data.rs +++ b/src/models/transaction_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct TransactionResponseData { #[serde(rename = "transaction")] @@ -19,7 +20,7 @@ pub struct TransactionResponseData { impl TransactionResponseData { pub fn new(transaction: crate::models::TransactionDetail) -> TransactionResponseData { TransactionResponseData { - transaction: transaction, + transaction, } } } diff --git a/src/models/transaction_summary.rs b/src/models/transaction_summary.rs index 9bf4cbd..715b233 100644 --- a/src/models/transaction_summary.rs +++ b/src/models/transaction_summary.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct TransactionSummary { #[serde(rename = "id")] @@ -24,13 +25,13 @@ pub struct TransactionSummary { pub memo: Option, /// The cleared status of the transaction #[serde(rename = "cleared")] - pub cleared: String, + pub cleared: Cleared, /// Whether or not the transaction is approved #[serde(rename = "approved")] pub approved: bool, /// The transaction flag #[serde(rename = "flag_color", skip_serializing_if = "Option::is_none")] - pub flag_color: Option, + pub flag_color: Option, #[serde(rename = "account_id")] pub account_id: String, #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")] @@ -55,25 +56,51 @@ pub struct TransactionSummary { } impl TransactionSummary { - pub fn new(id: String, date: String, amount: i64, cleared: String, approved: bool, account_id: String, deleted: bool) -> TransactionSummary { + pub fn new(id: String, date: String, amount: i64, cleared: Cleared, approved: bool, account_id: String, deleted: bool) -> TransactionSummary { TransactionSummary { - id: id, - date: date, - amount: amount, + id, + date, + amount, memo: None, - cleared: cleared, - approved: approved, + cleared, + approved, flag_color: None, - account_id: account_id, + account_id, payee_id: None, category_id: None, transfer_account_id: None, transfer_transaction_id: None, matched_transaction_id: None, import_id: None, - deleted: deleted, + deleted, } } } +/// The cleared status of the transaction +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum Cleared { + #[serde(rename = "cleared")] + Cleared, + #[serde(rename = "uncleared")] + Uncleared, + #[serde(rename = "reconciled")] + Reconciled, +} +/// The transaction flag +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum FlagColor { + #[serde(rename = "red")] + Red, + #[serde(rename = "orange")] + Orange, + #[serde(rename = "yellow")] + Yellow, + #[serde(rename = "green")] + Green, + #[serde(rename = "blue")] + Blue, + #[serde(rename = "purple")] + Purple, +} diff --git a/src/models/transactions_response.rs b/src/models/transactions_response.rs index d3da899..33abb8e 100644 --- a/src/models/transactions_response.rs +++ b/src/models/transactions_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct TransactionsResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct TransactionsResponse { impl TransactionsResponse { pub fn new(data: crate::models::TransactionsResponseData) -> TransactionsResponse { TransactionsResponse { - data: data, + data, } } } diff --git a/src/models/transactions_response_data.rs b/src/models/transactions_response_data.rs index 7c10090..da50e85 100644 --- a/src/models/transactions_response_data.rs +++ b/src/models/transactions_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct TransactionsResponseData { #[serde(rename = "transactions")] @@ -22,8 +23,8 @@ pub struct TransactionsResponseData { impl TransactionsResponseData { pub fn new(transactions: Vec, server_knowledge: i64) -> TransactionsResponseData { TransactionsResponseData { - transactions: transactions, - server_knowledge: server_knowledge, + transactions, + server_knowledge, } } } diff --git a/src/models/update_transaction.rs b/src/models/update_transaction.rs index d14c8d4..00b8f9b 100644 --- a/src/models/update_transaction.rs +++ b/src/models/update_transaction.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateTransaction { #[serde(rename = "id")] @@ -35,13 +36,13 @@ pub struct UpdateTransaction { pub memo: Option, /// The cleared status of the transaction #[serde(rename = "cleared", skip_serializing_if = "Option::is_none")] - pub cleared: Option, + pub cleared: Option, /// Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default. #[serde(rename = "approved", skip_serializing_if = "Option::is_none")] pub approved: Option, /// The transaction flag #[serde(rename = "flag_color", skip_serializing_if = "Option::is_none")] - pub flag_color: Option, + pub flag_color: Option, /// If specified, the new transaction will be assigned this import_id and considered \"imported\". We will also attempt to match this imported transaction to an existing \"user-entered\" transation on the same account, with the same amount, and with a date +/-10 days from the imported transaction date.

Transactions imported through File Based Import or Direct Import (not through the API) are assigned an import_id in 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'. Using a consistent format will prevent duplicates through Direct Import and File Based Import.

If import_id is omitted or specified as null, the transaction will be treated as a \"user-entered\" transaction. As such, it will be eligible to be matched against transactions later being imported (via DI, FBI, or API). #[serde(rename = "import_id", skip_serializing_if = "Option::is_none")] pub import_id: Option, @@ -50,10 +51,10 @@ pub struct UpdateTransaction { impl UpdateTransaction { pub fn new(id: String, account_id: String, date: String, amount: i64) -> UpdateTransaction { UpdateTransaction { - id: id, - account_id: account_id, - date: date, - amount: amount, + id, + account_id, + date, + amount, payee_id: None, payee_name: None, category_id: None, @@ -66,4 +67,30 @@ impl UpdateTransaction { } } +/// The cleared status of the transaction +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum Cleared { + #[serde(rename = "cleared")] + Cleared, + #[serde(rename = "uncleared")] + Uncleared, + #[serde(rename = "reconciled")] + Reconciled, +} +/// The transaction flag +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum FlagColor { + #[serde(rename = "red")] + Red, + #[serde(rename = "orange")] + Orange, + #[serde(rename = "yellow")] + Yellow, + #[serde(rename = "green")] + Green, + #[serde(rename = "blue")] + Blue, + #[serde(rename = "purple")] + Purple, +} diff --git a/src/models/update_transaction_all_of.rs b/src/models/update_transaction_all_of.rs index 774cc3f..2e3e0a7 100644 --- a/src/models/update_transaction_all_of.rs +++ b/src/models/update_transaction_all_of.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateTransactionAllOf { #[serde(rename = "id")] @@ -19,7 +20,7 @@ pub struct UpdateTransactionAllOf { impl UpdateTransactionAllOf { pub fn new(id: String) -> UpdateTransactionAllOf { UpdateTransactionAllOf { - id: id, + id, } } } diff --git a/src/models/update_transactions_wrapper.rs b/src/models/update_transactions_wrapper.rs index fde9957..6c04f35 100644 --- a/src/models/update_transactions_wrapper.rs +++ b/src/models/update_transactions_wrapper.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateTransactionsWrapper { #[serde(rename = "transactions")] @@ -19,7 +20,7 @@ pub struct UpdateTransactionsWrapper { impl UpdateTransactionsWrapper { pub fn new(transactions: Vec) -> UpdateTransactionsWrapper { UpdateTransactionsWrapper { - transactions: transactions, + transactions, } } } diff --git a/src/models/user.rs b/src/models/user.rs index 6ff89bb..fc16aa0 100644 --- a/src/models/user.rs +++ b/src/models/user.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct User { #[serde(rename = "id")] @@ -19,7 +20,7 @@ pub struct User { impl User { pub fn new(id: String) -> User { User { - id: id, + id, } } } diff --git a/src/models/user_response.rs b/src/models/user_response.rs index cfa6be1..29d3986 100644 --- a/src/models/user_response.rs +++ b/src/models/user_response.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct UserResponse { #[serde(rename = "data")] @@ -19,7 +20,7 @@ pub struct UserResponse { impl UserResponse { pub fn new(data: crate::models::UserResponseData) -> UserResponse { UserResponse { - data: data, + data, } } } diff --git a/src/models/user_response_data.rs b/src/models/user_response_data.rs index 90c300f..c784409 100644 --- a/src/models/user_response_data.rs +++ b/src/models/user_response_data.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct UserResponseData { #[serde(rename = "user")] @@ -19,7 +20,7 @@ pub struct UserResponseData { impl UserResponseData { pub fn new(user: crate::models::User) -> UserResponseData { UserResponseData { - user: user, + user, } } } -- cgit v1.2.3-54-g00ecf