aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/apis/accounts_api.rs87
-rw-r--r--src/apis/budgets_api.rs113
-rw-r--r--src/apis/categories_api.rs140
-rw-r--r--src/apis/client.rs78
-rw-r--r--src/apis/configuration.rs50
-rw-r--r--src/apis/deprecated_api.rs61
-rw-r--r--src/apis/mod.rs57
-rw-r--r--src/apis/months_api.rs87
-rw-r--r--src/apis/payee_locations_api.rs112
-rw-r--r--src/apis/payees_api.rs87
-rw-r--r--src/apis/scheduled_transactions_api.rs87
-rw-r--r--src/apis/transactions_api.rs257
-rw-r--r--src/apis/user_api.rs60
-rw-r--r--src/app.rs46
-rw-r--r--src/lib.rs10
-rw-r--r--src/main.rs37
-rw-r--r--src/models/account.rs94
-rw-r--r--src/models/account_response.rs30
-rw-r--r--src/models/account_response_data.rs30
-rw-r--r--src/models/accounts_response.rs30
-rw-r--r--src/models/accounts_response_data.rs34
-rw-r--r--src/models/budget_detail.rs81
-rw-r--r--src/models/budget_detail_all_of.rs57
-rw-r--r--src/models/budget_detail_response.rs30
-rw-r--r--src/models/budget_detail_response_data.rs34
-rw-r--r--src/models/budget_settings.rs33
-rw-r--r--src/models/budget_settings_response.rs30
-rw-r--r--src/models/budget_settings_response_data.rs30
-rw-r--r--src/models/budget_summary.rs51
-rw-r--r--src/models/budget_summary_response.rs30
-rw-r--r--src/models/budget_summary_response_data.rs33
-rw-r--r--src/models/bulk_response.rs30
-rw-r--r--src/models/bulk_response_data.rs30
-rw-r--r--src/models/bulk_response_data_bulk.rs35
-rw-r--r--src/models/bulk_transactions.rs30
-rw-r--r--src/models/categories_response.rs30
-rw-r--r--src/models/categories_response_data.rs34
-rw-r--r--src/models/category.rs93
-rw-r--r--src/models/category_group.rs41
-rw-r--r--src/models/category_group_with_categories.rs45
-rw-r--r--src/models/category_group_with_categories_all_of.rs31
-rw-r--r--src/models/category_response.rs30
-rw-r--r--src/models/category_response_data.rs30
-rw-r--r--src/models/currency_format.rs53
-rw-r--r--src/models/date_format.rs32
-rw-r--r--src/models/error_detail.rs36
-rw-r--r--src/models/error_response.rs30
-rw-r--r--src/models/hybrid_transaction.rs133
-rw-r--r--src/models/hybrid_transaction_all_of.rs52
-rw-r--r--src/models/hybrid_transactions_response.rs30
-rw-r--r--src/models/hybrid_transactions_response_data.rs30
-rw-r--r--src/models/mod.rs168
-rw-r--r--src/models/month_detail.rs61
-rw-r--r--src/models/month_detail_all_of.rs31
-rw-r--r--src/models/month_detail_response.rs30
-rw-r--r--src/models/month_detail_response_data.rs30
-rw-r--r--src/models/month_summaries_response.rs30
-rw-r--r--src/models/month_summaries_response_data.rs34
-rw-r--r--src/models/month_summary.rs57
-rw-r--r--src/models/payee.rs41
-rw-r--r--src/models/payee_location.rs43
-rw-r--r--src/models/payee_location_response.rs30
-rw-r--r--src/models/payee_location_response_data.rs30
-rw-r--r--src/models/payee_locations_response.rs30
-rw-r--r--src/models/payee_locations_response_data.rs30
-rw-r--r--src/models/payee_response.rs30
-rw-r--r--src/models/payee_response_data.rs30
-rw-r--r--src/models/payees_response.rs30
-rw-r--r--src/models/payees_response_data.rs34
-rw-r--r--src/models/save_category_response.rs30
-rw-r--r--src/models/save_category_response_data.rs34
-rw-r--r--src/models/save_month_category.rs31
-rw-r--r--src/models/save_month_category_wrapper.rs30
-rw-r--r--src/models/save_transaction.rs95
-rw-r--r--src/models/save_transaction_wrapper.rs30
-rw-r--r--src/models/save_transactions_response.rs30
-rw-r--r--src/models/save_transactions_response_data.rs46
-rw-r--r--src/models/save_transactions_wrapper.rs33
-rw-r--r--src/models/scheduled_sub_transaction.rs54
-rw-r--r--src/models/scheduled_transaction_detail.rs128
-rw-r--r--src/models/scheduled_transaction_detail_all_of.rs40
-rw-r--r--src/models/scheduled_transaction_response.rs30
-rw-r--r--src/models/scheduled_transaction_response_data.rs30
-rw-r--r--src/models/scheduled_transaction_summary.rs115
-rw-r--r--src/models/scheduled_transactions_response.rs30
-rw-r--r--src/models/scheduled_transactions_response_data.rs34
-rw-r--r--src/models/sub_transaction.rs54
-rw-r--r--src/models/transaction_detail.rs121
-rw-r--r--src/models/transaction_detail_all_of.rs40
-rw-r--r--src/models/transaction_response.rs30
-rw-r--r--src/models/transaction_response_data.rs30
-rw-r--r--src/models/transaction_summary.rs108
-rw-r--r--src/models/transactions_response.rs30
-rw-r--r--src/models/transactions_response_data.rs34
-rw-r--r--src/models/update_transaction.rs98
-rw-r--r--src/models/update_transaction_wrapper.rs30
-rw-r--r--src/models/update_transactions_response.rs30
-rw-r--r--src/models/update_transactions_wrapper.rs33
-rw-r--r--src/models/user.rs30
-rw-r--r--src/models/user_response.rs30
-rw-r--r--src/models/user_response_data.rs30
-rw-r--r--src/paths.rs56
-rw-r--r--src/views.rs5
-rw-r--r--src/views/txn_table.rs151
-rw-r--r--src/views/txn_tables.rs353
-rw-r--r--src/views/util.rs5
-rw-r--r--src/ynab.rs10
-rw-r--r--src/ynab/budget.rs216
-rw-r--r--src/ynab/client.rs76
-rw-r--r--src/ynab/transaction.rs101
-rw-r--r--src/ynab/util.rs6
111 files changed, 5085 insertions, 1062 deletions
diff --git a/src/apis/accounts_api.rs b/src/apis/accounts_api.rs
new file mode 100644
index 0000000..616476e
--- /dev/null
+++ b/src/apis/accounts_api.rs
@@ -0,0 +1,87 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+use std::rc::Rc;
+use std::borrow::Borrow;
+
+use reqwest;
+
+use super::{Error, configuration, urlencode};
+
+pub struct AccountsApiClient {
+ configuration: Rc<configuration::Configuration>,
+}
+
+impl AccountsApiClient {
+ pub fn new(configuration: Rc<configuration::Configuration>) -> AccountsApiClient {
+ AccountsApiClient {
+ configuration: configuration,
+ }
+ }
+}
+
+pub trait AccountsApi {
+ fn get_account_by_id(&self, budget_id: &str, account_id: &str) -> Result<::models::AccountResponse, Error>;
+ fn get_accounts(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result<::models::AccountsResponse, Error>;
+}
+
+impl AccountsApi for AccountsApiClient {
+ fn get_account_by_id(&self, budget_id: &str, account_id: &str) -> Result<::models::AccountResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/accounts/{account_id}", configuration.base_path, budget_id=urlencode(budget_id), account_id=account_id);
+ let mut req_builder = client.get(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+ fn get_accounts(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result<::models::AccountsResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/accounts", configuration.base_path, budget_id=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 user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+}
diff --git a/src/apis/budgets_api.rs b/src/apis/budgets_api.rs
new file mode 100644
index 0000000..663dc59
--- /dev/null
+++ b/src/apis/budgets_api.rs
@@ -0,0 +1,113 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+use std::rc::Rc;
+use std::borrow::Borrow;
+
+use reqwest;
+
+use super::{Error, configuration, urlencode};
+
+pub struct BudgetsApiClient {
+ configuration: Rc<configuration::Configuration>,
+}
+
+impl BudgetsApiClient {
+ pub fn new(configuration: Rc<configuration::Configuration>) -> BudgetsApiClient {
+ BudgetsApiClient {
+ configuration: configuration,
+ }
+ }
+}
+
+pub trait BudgetsApi {
+ fn get_budget_by_id(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result<::models::BudgetDetailResponse, Error>;
+ fn get_budget_settings_by_id(&self, budget_id: &str) -> Result<::models::BudgetSettingsResponse, Error>;
+ fn get_budgets(&self, ) -> Result<::models::BudgetSummaryResponse, Error>;
+}
+
+impl BudgetsApi for BudgetsApiClient {
+ fn get_budget_by_id(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result<::models::BudgetDetailResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}", configuration.base_path, budget_id=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 user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+ fn get_budget_settings_by_id(&self, budget_id: &str) -> Result<::models::BudgetSettingsResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/settings", configuration.base_path, budget_id=urlencode(budget_id));
+ let mut req_builder = client.get(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+ fn get_budgets(&self, ) -> Result<::models::BudgetSummaryResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets", configuration.base_path);
+ let mut req_builder = client.get(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+}
diff --git a/src/apis/categories_api.rs b/src/apis/categories_api.rs
new file mode 100644
index 0000000..417a2d9
--- /dev/null
+++ b/src/apis/categories_api.rs
@@ -0,0 +1,140 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+use std::rc::Rc;
+use std::borrow::Borrow;
+
+use reqwest;
+
+use super::{Error, configuration, urlencode};
+
+pub struct CategoriesApiClient {
+ configuration: Rc<configuration::Configuration>,
+}
+
+impl CategoriesApiClient {
+ pub fn new(configuration: Rc<configuration::Configuration>) -> CategoriesApiClient {
+ CategoriesApiClient {
+ configuration: configuration,
+ }
+ }
+}
+
+pub trait CategoriesApi {
+ fn get_categories(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result<::models::CategoriesResponse, Error>;
+ fn get_category_by_id(&self, budget_id: &str, category_id: &str) -> Result<::models::CategoryResponse, Error>;
+ fn get_month_category_by_id(&self, budget_id: &str, month: String, category_id: &str) -> Result<::models::CategoryResponse, Error>;
+ fn update_month_category(&self, budget_id: &str, month: String, category_id: &str, data: ::models::SaveMonthCategoryWrapper) -> Result<::models::SaveCategoryResponse, Error>;
+}
+
+impl CategoriesApi for CategoriesApiClient {
+ fn get_categories(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result<::models::CategoriesResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/categories", configuration.base_path, budget_id=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 user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+ fn get_category_by_id(&self, budget_id: &str, category_id: &str) -> Result<::models::CategoryResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/categories/{category_id}", configuration.base_path, budget_id=urlencode(budget_id), category_id=urlencode(category_id));
+ let mut req_builder = client.get(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+ fn get_month_category_by_id(&self, budget_id: &str, month: String, category_id: &str) -> Result<::models::CategoryResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/months/{month}/categories/{category_id}", configuration.base_path, budget_id=urlencode(budget_id), month=month, category_id=urlencode(category_id));
+ let mut req_builder = client.get(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+ fn update_month_category(&self, budget_id: &str, month: String, category_id: &str, data: ::models::SaveMonthCategoryWrapper) -> Result<::models::SaveCategoryResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/months/{month}/categories/{category_id}", configuration.base_path, budget_id=urlencode(budget_id), month=month, category_id=urlencode(category_id));
+ let mut req_builder = client.patch(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+ req_builder = req_builder.json(&data);
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+}
diff --git a/src/apis/client.rs b/src/apis/client.rs
new file mode 100644
index 0000000..2776f11
--- /dev/null
+++ b/src/apis/client.rs
@@ -0,0 +1,78 @@
+use std::rc::Rc;
+
+use super::configuration::Configuration;
+
+pub struct APIClient {
+ configuration: Rc<Configuration>,
+ accounts_api: Box<::apis::AccountsApi>,
+ budgets_api: Box<::apis::BudgetsApi>,
+ categories_api: Box<::apis::CategoriesApi>,
+ deprecated_api: Box<::apis::DeprecatedApi>,
+ months_api: Box<::apis::MonthsApi>,
+ payee_locations_api: Box<::apis::PayeeLocationsApi>,
+ payees_api: Box<::apis::PayeesApi>,
+ scheduled_transactions_api: Box<::apis::ScheduledTransactionsApi>,
+ transactions_api: Box<::apis::TransactionsApi>,
+ user_api: Box<::apis::UserApi>,
+}
+
+impl APIClient {
+ pub fn new(configuration: Configuration) -> APIClient {
+ let rc = Rc::new(configuration);
+
+ APIClient {
+ configuration: rc.clone(),
+ accounts_api: Box::new(::apis::AccountsApiClient::new(rc.clone())),
+ budgets_api: Box::new(::apis::BudgetsApiClient::new(rc.clone())),
+ categories_api: Box::new(::apis::CategoriesApiClient::new(rc.clone())),
+ deprecated_api: Box::new(::apis::DeprecatedApiClient::new(rc.clone())),
+ months_api: Box::new(::apis::MonthsApiClient::new(rc.clone())),
+ payee_locations_api: Box::new(::apis::PayeeLocationsApiClient::new(rc.clone())),
+ payees_api: Box::new(::apis::PayeesApiClient::new(rc.clone())),
+ scheduled_transactions_api: Box::new(::apis::ScheduledTransactionsApiClient::new(rc.clone())),
+ transactions_api: Box::new(::apis::TransactionsApiClient::new(rc.clone())),
+ user_api: Box::new(::apis::UserApiClient::new(rc.clone())),
+ }
+ }
+
+ pub fn accounts_api(&self) -> &::apis::AccountsApi{
+ self.accounts_api.as_ref()
+ }
+
+ pub fn budgets_api(&self) -> &::apis::BudgetsApi{
+ self.budgets_api.as_ref()
+ }
+
+ pub fn categories_api(&self) -> &::apis::CategoriesApi{
+ self.categories_api.as_ref()
+ }
+
+ pub fn deprecated_api(&self) -> &::apis::DeprecatedApi{
+ self.deprecated_api.as_ref()
+ }
+
+ pub fn months_api(&self) -> &::apis::MonthsApi{
+ self.months_api.as_ref()
+ }
+
+ pub fn payee_locations_api(&self) -> &::apis::PayeeLocationsApi{
+ self.payee_locations_api.as_ref()
+ }
+
+ pub fn payees_api(&self) -> &::apis::PayeesApi{
+ self.payees_api.as_ref()
+ }
+
+ pub fn scheduled_transactions_api(&self) -> &::apis::ScheduledTransactionsApi{
+ self.scheduled_transactions_api.as_ref()
+ }
+
+ pub fn transactions_api(&self) -> &::apis::TransactionsApi{
+ self.transactions_api.as_ref()
+ }
+
+ pub fn user_api(&self) -> &::apis::UserApi{
+ self.user_api.as_ref()
+ }
+
+}
diff --git a/src/apis/configuration.rs b/src/apis/configuration.rs
new file mode 100644
index 0000000..4378dfa
--- /dev/null
+++ b/src/apis/configuration.rs
@@ -0,0 +1,50 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+use reqwest;
+
+pub struct Configuration {
+ pub base_path: String,
+ pub user_agent: Option<String>,
+ pub client: reqwest::Client,
+ pub basic_auth: Option<BasicAuth>,
+ pub oauth_access_token: Option<String>,
+ pub bearer_access_token: Option<String>,
+ pub api_key: Option<ApiKey>,
+ // TODO: take an oauth2 token source, similar to the go one
+}
+
+pub type BasicAuth = (String, Option<String>);
+
+pub struct ApiKey {
+ pub prefix: Option<String>,
+ pub key: String,
+}
+
+impl Configuration {
+ pub fn new() -> Configuration {
+ Configuration::default()
+ }
+}
+
+impl Default for Configuration {
+ fn default() -> Self {
+ Configuration {
+ base_path: "https://api.youneedabudget.com/v1".to_owned(),
+ user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()),
+ client: reqwest::Client::new(),
+ basic_auth: None,
+ oauth_access_token: None,
+ bearer_access_token: None,
+ api_key: None,
+ }
+ }
+}
diff --git a/src/apis/deprecated_api.rs b/src/apis/deprecated_api.rs
new file mode 100644
index 0000000..a148248
--- /dev/null
+++ b/src/apis/deprecated_api.rs
@@ -0,0 +1,61 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+use std::rc::Rc;
+use std::borrow::Borrow;
+
+use reqwest;
+
+use super::{Error, configuration, urlencode};
+
+pub struct DeprecatedApiClient {
+ configuration: Rc<configuration::Configuration>,
+}
+
+impl DeprecatedApiClient {
+ pub fn new(configuration: Rc<configuration::Configuration>) -> DeprecatedApiClient {
+ DeprecatedApiClient {
+ configuration: configuration,
+ }
+ }
+}
+
+pub trait DeprecatedApi {
+ fn bulk_create_transactions(&self, budget_id: &str, transactions: ::models::BulkTransactions) -> Result<::models::BulkResponse, Error>;
+}
+
+impl DeprecatedApi for DeprecatedApiClient {
+ fn bulk_create_transactions(&self, budget_id: &str, transactions: ::models::BulkTransactions) -> Result<::models::BulkResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/transactions/bulk", configuration.base_path, budget_id=urlencode(budget_id));
+ let mut req_builder = client.post(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+ req_builder = req_builder.json(&transactions);
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+}
diff --git a/src/apis/mod.rs b/src/apis/mod.rs
new file mode 100644
index 0000000..910bd7e
--- /dev/null
+++ b/src/apis/mod.rs
@@ -0,0 +1,57 @@
+use reqwest;
+use serde_json;
+
+#[derive(Debug)]
+pub enum Error {
+ Reqwest(reqwest::Error),
+ Serde(serde_json::Error),
+ Io(std::io::Error),
+}
+
+impl From<reqwest::Error> for Error {
+ fn from(e: reqwest::Error) -> Self {
+ Error::Reqwest(e)
+ }
+}
+
+impl From<serde_json::Error> for Error {
+ fn from(e: serde_json::Error) -> Self {
+ Error::Serde(e)
+ }
+}
+
+impl From<std::io::Error> for Error {
+ fn from(e: std::io::Error) -> Self {
+ Error::Io(e)
+ }
+}
+
+pub fn urlencode<T: AsRef<str>>(s: T) -> String {
+ ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect()
+}
+
+use super::models::*;
+
+mod accounts_api;
+pub use self::accounts_api::{ AccountsApi, AccountsApiClient };
+mod budgets_api;
+pub use self::budgets_api::{ BudgetsApi, BudgetsApiClient };
+mod categories_api;
+pub use self::categories_api::{ CategoriesApi, CategoriesApiClient };
+mod deprecated_api;
+pub use self::deprecated_api::{ DeprecatedApi, DeprecatedApiClient };
+mod months_api;
+pub use self::months_api::{ MonthsApi, MonthsApiClient };
+mod payee_locations_api;
+pub use self::payee_locations_api::{ PayeeLocationsApi, PayeeLocationsApiClient };
+mod payees_api;
+pub use self::payees_api::{ PayeesApi, PayeesApiClient };
+mod scheduled_transactions_api;
+pub use self::scheduled_transactions_api::{ ScheduledTransactionsApi, ScheduledTransactionsApiClient };
+mod transactions_api;
+pub use self::transactions_api::{ TransactionsApi, TransactionsApiClient };
+mod user_api;
+pub use self::user_api::{ UserApi, UserApiClient };
+
+pub mod configuration;
+pub mod client;
diff --git a/src/apis/months_api.rs b/src/apis/months_api.rs
new file mode 100644
index 0000000..3bee3fe
--- /dev/null
+++ b/src/apis/months_api.rs
@@ -0,0 +1,87 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+use std::rc::Rc;
+use std::borrow::Borrow;
+
+use reqwest;
+
+use super::{Error, configuration, urlencode};
+
+pub struct MonthsApiClient {
+ configuration: Rc<configuration::Configuration>,
+}
+
+impl MonthsApiClient {
+ pub fn new(configuration: Rc<configuration::Configuration>) -> MonthsApiClient {
+ MonthsApiClient {
+ configuration: configuration,
+ }
+ }
+}
+
+pub trait MonthsApi {
+ fn get_budget_month(&self, budget_id: &str, month: String) -> Result<::models::MonthDetailResponse, Error>;
+ fn get_budget_months(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result<::models::MonthSummariesResponse, Error>;
+}
+
+impl MonthsApi for MonthsApiClient {
+ fn get_budget_month(&self, budget_id: &str, month: String) -> Result<::models::MonthDetailResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/months/{month}", configuration.base_path, budget_id=urlencode(budget_id), month=month);
+ let mut req_builder = client.get(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+ fn get_budget_months(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result<::models::MonthSummariesResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/months", configuration.base_path, budget_id=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 user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+}
diff --git a/src/apis/payee_locations_api.rs b/src/apis/payee_locations_api.rs
new file mode 100644
index 0000000..88f12e1
--- /dev/null
+++ b/src/apis/payee_locations_api.rs
@@ -0,0 +1,112 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+use std::rc::Rc;
+use std::borrow::Borrow;
+
+use reqwest;
+
+use super::{Error, configuration, urlencode};
+
+pub struct PayeeLocationsApiClient {
+ configuration: Rc<configuration::Configuration>,
+}
+
+impl PayeeLocationsApiClient {
+ pub fn new(configuration: Rc<configuration::Configuration>) -> PayeeLocationsApiClient {
+ PayeeLocationsApiClient {
+ configuration: configuration,
+ }
+ }
+}
+
+pub trait PayeeLocationsApi {
+ fn get_payee_location_by_id(&self, budget_id: &str, payee_location_id: &str) -> Result<::models::PayeeLocationResponse, Error>;
+ fn get_payee_locations(&self, budget_id: &str) -> Result<::models::PayeeLocationsResponse, Error>;
+ fn get_payee_locations_by_payee(&self, budget_id: &str, payee_id: &str) -> Result<::models::PayeeLocationsResponse, Error>;
+}
+
+impl PayeeLocationsApi for PayeeLocationsApiClient {
+ fn get_payee_location_by_id(&self, budget_id: &str, payee_location_id: &str) -> Result<::models::PayeeLocationResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/payee_locations/{payee_location_id}", configuration.base_path, budget_id=urlencode(budget_id), payee_location_id=urlencode(payee_location_id));
+ let mut req_builder = client.get(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+ fn get_payee_locations(&self, budget_id: &str) -> Result<::models::PayeeLocationsResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/payee_locations", configuration.base_path, budget_id=urlencode(budget_id));
+ let mut req_builder = client.get(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+ fn get_payee_locations_by_payee(&self, budget_id: &str, payee_id: &str) -> Result<::models::PayeeLocationsResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/payees/{payee_id}/payee_locations", configuration.base_path, budget_id=urlencode(budget_id), payee_id=urlencode(payee_id));
+ let mut req_builder = client.get(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+}
diff --git a/src/apis/payees_api.rs b/src/apis/payees_api.rs
new file mode 100644
index 0000000..77db5bb
--- /dev/null
+++ b/src/apis/payees_api.rs
@@ -0,0 +1,87 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+use std::rc::Rc;
+use std::borrow::Borrow;
+
+use reqwest;
+
+use super::{Error, configuration, urlencode};
+
+pub struct PayeesApiClient {
+ configuration: Rc<configuration::Configuration>,
+}
+
+impl PayeesApiClient {
+ pub fn new(configuration: Rc<configuration::Configuration>) -> PayeesApiClient {
+ PayeesApiClient {
+ configuration: configuration,
+ }
+ }
+}
+
+pub trait PayeesApi {
+ fn get_payee_by_id(&self, budget_id: &str, payee_id: &str) -> Result<::models::PayeeResponse, Error>;
+ fn get_payees(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result<::models::PayeesResponse, Error>;
+}
+
+impl PayeesApi for PayeesApiClient {
+ fn get_payee_by_id(&self, budget_id: &str, payee_id: &str) -> Result<::models::PayeeResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/payees/{payee_id}", configuration.base_path, budget_id=urlencode(budget_id), payee_id=urlencode(payee_id));
+ let mut req_builder = client.get(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+ fn get_payees(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result<::models::PayeesResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/payees", configuration.base_path, budget_id=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 user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+}
diff --git a/src/apis/scheduled_transactions_api.rs b/src/apis/scheduled_transactions_api.rs
new file mode 100644
index 0000000..8ab30a8
--- /dev/null
+++ b/src/apis/scheduled_transactions_api.rs
@@ -0,0 +1,87 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+use std::rc::Rc;
+use std::borrow::Borrow;
+
+use reqwest;
+
+use super::{Error, configuration, urlencode};
+
+pub struct ScheduledTransactionsApiClient {
+ configuration: Rc<configuration::Configuration>,
+}
+
+impl ScheduledTransactionsApiClient {
+ pub fn new(configuration: Rc<configuration::Configuration>) -> ScheduledTransactionsApiClient {
+ ScheduledTransactionsApiClient {
+ configuration: configuration,
+ }
+ }
+}
+
+pub trait ScheduledTransactionsApi {
+ fn get_scheduled_transaction_by_id(&self, budget_id: &str, scheduled_transaction_id: &str) -> Result<::models::ScheduledTransactionResponse, Error>;
+ fn get_scheduled_transactions(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result<::models::ScheduledTransactionsResponse, Error>;
+}
+
+impl ScheduledTransactionsApi for ScheduledTransactionsApiClient {
+ fn get_scheduled_transaction_by_id(&self, budget_id: &str, scheduled_transaction_id: &str) -> Result<::models::ScheduledTransactionResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id}", configuration.base_path, budget_id=urlencode(budget_id), scheduled_transaction_id=urlencode(scheduled_transaction_id));
+ let mut req_builder = client.get(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+ fn get_scheduled_transactions(&self, budget_id: &str, last_knowledge_of_server: i64) -> Result<::models::ScheduledTransactionsResponse, Error> {
+ 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=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 user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+}
diff --git a/src/apis/transactions_api.rs b/src/apis/transactions_api.rs
new file mode 100644
index 0000000..a6386a0
--- /dev/null
+++ b/src/apis/transactions_api.rs
@@ -0,0 +1,257 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+use std::rc::Rc;
+use std::borrow::Borrow;
+
+use reqwest;
+
+use super::{Error, configuration, urlencode};
+
+pub struct TransactionsApiClient {
+ configuration: Rc<configuration::Configuration>,
+}
+
+impl TransactionsApiClient {
+ pub fn new(configuration: Rc<configuration::Configuration>) -> TransactionsApiClient {
+ TransactionsApiClient {
+ configuration: configuration,
+ }
+ }
+}
+
+pub trait TransactionsApi {
+ fn create_transaction(&self, budget_id: &str, data: ::models::SaveTransactionsWrapper) -> Result<::models::SaveTransactionsResponse, Error>;
+ fn get_transaction_by_id(&self, budget_id: &str, transaction_id: &str) -> Result<::models::TransactionResponse, Error>;
+ fn get_transactions(&self, budget_id: &str, since_date: String, _type: &str, last_knowledge_of_server: i64) -> Result<::models::TransactionsResponse, Error>;
+ fn get_transactions_by_account(&self, budget_id: &str, account_id: &str, since_date: String, _type: &str, last_knowledge_of_server: i64) -> Result<::models::TransactionsResponse, Error>;
+ fn get_transactions_by_category(&self, budget_id: &str, category_id: &str, since_date: String, _type: &str, last_knowledge_of_server: i64) -> Result<::models::HybridTransactionsResponse, Error>;
+ fn get_transactions_by_payee(&self, budget_id: &str, payee_id: &str, since_date: String, _type: &str, last_knowledge_of_server: i64) -> Result<::models::HybridTransactionsResponse, Error>;
+ fn update_transaction(&self, budget_id: &str, transaction_id: &str, data: ::models::UpdateTransactionWrapper) -> Result<::models::TransactionResponse, Error>;
+ fn update_transactions(&self, budget_id: &str, data: ::models::UpdateTransactionsWrapper) -> Result<::models::UpdateTransactionsResponse, Error>;
+}
+
+impl TransactionsApi for TransactionsApiClient {
+ fn create_transaction(&self, budget_id: &str, data: ::models::SaveTransactionsWrapper) -> Result<::models::SaveTransactionsResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/transactions", configuration.base_path, budget_id=urlencode(budget_id));
+ let mut req_builder = client.post(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+ req_builder = req_builder.json(&data);
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+ fn get_transaction_by_id(&self, budget_id: &str, transaction_id: &str) -> Result<::models::TransactionResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/transactions/{transaction_id}", configuration.base_path, budget_id=urlencode(budget_id), transaction_id=urlencode(transaction_id));
+ let mut req_builder = client.get(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ 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<::models::TransactionsResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/transactions", configuration.base_path, budget_id=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 user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ 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<::models::TransactionsResponse, Error> {
+ 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=urlencode(budget_id), account_id=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 user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ 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<::models::HybridTransactionsResponse, Error> {
+ 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=urlencode(budget_id), category_id=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 user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ 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<::models::HybridTransactionsResponse, Error> {
+ 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=urlencode(budget_id), payee_id=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 user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+ fn update_transaction(&self, budget_id: &str, transaction_id: &str, data: ::models::UpdateTransactionWrapper) -> Result<::models::TransactionResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/transactions/{transaction_id}", configuration.base_path, budget_id=urlencode(budget_id), transaction_id=urlencode(transaction_id));
+ let mut req_builder = client.put(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+ req_builder = req_builder.json(&data);
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+ fn update_transactions(&self, budget_id: &str, data: ::models::UpdateTransactionsWrapper) -> Result<::models::UpdateTransactionsResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/budgets/{budget_id}/transactions", configuration.base_path, budget_id=urlencode(budget_id));
+ let mut req_builder = client.patch(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+ req_builder = req_builder.json(&data);
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+}
diff --git a/src/apis/user_api.rs b/src/apis/user_api.rs
new file mode 100644
index 0000000..50c243e
--- /dev/null
+++ b/src/apis/user_api.rs
@@ -0,0 +1,60 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+use std::rc::Rc;
+use std::borrow::Borrow;
+
+use reqwest;
+
+use super::{Error, configuration, urlencode};
+
+pub struct UserApiClient {
+ configuration: Rc<configuration::Configuration>,
+}
+
+impl UserApiClient {
+ pub fn new(configuration: Rc<configuration::Configuration>) -> UserApiClient {
+ UserApiClient {
+ configuration: configuration,
+ }
+ }
+}
+
+pub trait UserApi {
+ fn get_user(&self, ) -> Result<::models::UserResponse, Error>;
+}
+
+impl UserApi for UserApiClient {
+ fn get_user(&self, ) -> Result<::models::UserResponse, Error> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/user", configuration.base_path);
+ let mut req_builder = client.get(uri_str.as_str());
+
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("Authorization", val);
+ };
+
+ // send request
+ let req = req_builder.build()?;
+
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ }
+
+}
diff --git a/src/app.rs b/src/app.rs
deleted file mode 100644
index 22bf543..0000000
--- a/src/app.rs
+++ /dev/null
@@ -1,46 +0,0 @@
-pub struct App {
- cursive: cursive::Cursive,
-}
-
-impl App {
- pub fn new(budget: crate::ynab::Budget) -> Self {
- let mut app = cursive::Cursive::default();
- let term_width = app.screen_size().x;
- app.set_theme(Self::theme());
- app.add_global_callback('q', |s| s.quit());
-
- let mut layout = cursive::views::LinearLayout::vertical();
- layout.add_child(cursive::views::TextView::new(format!(
- "Budget: {} ({})\n{}",
- budget.name(),
- budget.id(),
- "=".repeat(term_width),
- )));
-
- layout.add_child(crate::views::TxnTables::new("txn_tables", &budget));
-
- app.set_user_data(budget);
- app.add_fullscreen_layer(layout);
-
- Self { cursive: app }
- }
-
- pub fn run(&mut self) {
- self.cursive.run();
- }
-
- fn theme() -> cursive::theme::Theme {
- let mut palette = cursive::theme::Palette::default();
- palette[cursive::theme::PaletteColor::Background] =
- cursive::theme::Color::TerminalDefault;
- palette[cursive::theme::PaletteColor::View] =
- cursive::theme::Color::TerminalDefault;
- palette[cursive::theme::PaletteColor::Primary] =
- cursive::theme::Color::TerminalDefault;
- cursive::theme::Theme {
- shadow: false,
- borders: cursive::theme::BorderStyle::Simple,
- palette,
- }
- }
-}
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..c1dd666
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,10 @@
+#[macro_use]
+extern crate serde_derive;
+
+extern crate serde;
+extern crate serde_json;
+extern crate url;
+extern crate reqwest;
+
+pub mod apis;
+pub mod models;
diff --git a/src/main.rs b/src/main.rs
deleted file mode 100644
index d53ce1c..0000000
--- a/src/main.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-mod app;
-mod paths;
-mod views;
-mod ynab;
-
-use snafu::ResultExt;
-
-#[derive(Debug, snafu::Snafu)]
-pub enum Error {
- #[snafu(display("failed to get api key: {}", source))]
- GetApiKey { source: crate::paths::Error },
-
- #[snafu(display("failed to load budget: {}", source))]
- LoadBudget { source: crate::ynab::BudgetError },
-}
-
-pub type Result<T> = std::result::Result<T, Error>;
-
-fn run() -> Result<()> {
- let key = paths::read_api_key().context(GetApiKey)?;
- let budget = ynab::Budget::new(&key).context(LoadBudget)?;
-
- let mut app = app::App::new(budget);
- app.run();
-
- Ok(())
-}
-
-fn main() {
- match run() {
- Ok(_) => {}
- Err(e) => {
- eprintln!("ynab-reimbursements: {}", e);
- std::process::exit(1);
- }
- }
-}
diff --git a/src/models/account.rs b/src/models/account.rs
new file mode 100644
index 0000000..6ffa1d5
--- /dev/null
+++ b/src/models/account.rs
@@ -0,0 +1,94 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct Account {
+ #[serde(rename = "id")]
+ pub id: String,
+ #[serde(rename = "name")]
+ pub name: String,
+ /// The type of account. Note: payPal, merchantAccount, investmentAccount, and mortgage types have been deprecated and will be removed in the future.
+ #[serde(rename = "type")]
+ pub _type: String,
+ /// Whether this account is on budget or not
+ #[serde(rename = "on_budget")]
+ pub on_budget: bool,
+ /// Whether this account is closed or not
+ #[serde(rename = "closed")]
+ pub closed: bool,
+ #[serde(rename = "note", skip_serializing_if = "Option::is_none")]
+ pub note: Option<String>,
+ /// The current balance of the account in milliunits format
+ #[serde(rename = "balance")]
+ pub balance: i64,
+ /// The current cleared balance of the account in milliunits format
+ #[serde(rename = "cleared_balance")]
+ pub cleared_balance: i64,
+ /// The current uncleared balance of the account in milliunits format
+ #[serde(rename = "uncleared_balance")]
+ pub uncleared_balance: i64,
+ /// The payee id which should be used when transferring to this account
+ #[serde(rename = "transfer_payee_id")]
+ pub transfer_payee_id: String,
+ /// Whether or not the account has been deleted. Deleted accounts will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+}
+
+impl Account {
+ pub fn new(id: String, name: String, _type: String, on_budget: bool, closed: bool, balance: i64, cleared_balance: i64, uncleared_balance: i64, transfer_payee_id: String, deleted: bool) -> Account {
+ Account {
+ id: id,
+ name: name,
+ _type: _type,
+ on_budget: on_budget,
+ closed: closed,
+ note: None,
+ balance: balance,
+ cleared_balance: cleared_balance,
+ uncleared_balance: uncleared_balance,
+ transfer_payee_id: transfer_payee_id,
+ deleted: deleted,
+ }
+ }
+}
+
+/// The type of account. Note: payPal, merchantAccount, investmentAccount, and mortgage types have been deprecated and will be removed in the future.
+#[derive(Debug, Serialize, Deserialize)]
+pub enum Type {
+ #[serde(rename = "checking")]
+ Checking,
+ #[serde(rename = "savings")]
+ Savings,
+ #[serde(rename = "cash")]
+ Cash,
+ #[serde(rename = "creditCard")]
+ CreditCard,
+ #[serde(rename = "lineOfCredit")]
+ LineOfCredit,
+ #[serde(rename = "otherAsset")]
+ OtherAsset,
+ #[serde(rename = "otherLiability")]
+ OtherLiability,
+ #[serde(rename = "payPal")]
+ PayPal,
+ #[serde(rename = "merchantAccount")]
+ MerchantAccount,
+ #[serde(rename = "investmentAccount")]
+ InvestmentAccount,
+ #[serde(rename = "mortgage")]
+ Mortgage,
+}
+
diff --git a/src/models/account_response.rs b/src/models/account_response.rs
new file mode 100644
index 0000000..633bacb
--- /dev/null
+++ b/src/models/account_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct AccountResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::AccountResponseData,
+}
+
+impl AccountResponse {
+ pub fn new(data: ::models::AccountResponseData) -> AccountResponse {
+ AccountResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/account_response_data.rs b/src/models/account_response_data.rs
new file mode 100644
index 0000000..9340a0f
--- /dev/null
+++ b/src/models/account_response_data.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct AccountResponseData {
+ #[serde(rename = "account")]
+ pub account: ::models::Account,
+}
+
+impl AccountResponseData {
+ pub fn new(account: ::models::Account) -> AccountResponseData {
+ AccountResponseData {
+ account: account,
+ }
+ }
+}
+
+
diff --git a/src/models/accounts_response.rs b/src/models/accounts_response.rs
new file mode 100644
index 0000000..d2bd25d
--- /dev/null
+++ b/src/models/accounts_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct AccountsResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::AccountsResponseData,
+}
+
+impl AccountsResponse {
+ pub fn new(data: ::models::AccountsResponseData) -> AccountsResponse {
+ AccountsResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/accounts_response_data.rs b/src/models/accounts_response_data.rs
new file mode 100644
index 0000000..1324953
--- /dev/null
+++ b/src/models/accounts_response_data.rs
@@ -0,0 +1,34 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct AccountsResponseData {
+ #[serde(rename = "accounts")]
+ pub accounts: Vec<::models::Account>,
+ /// The knowledge of the server
+ #[serde(rename = "server_knowledge")]
+ pub server_knowledge: i64,
+}
+
+impl AccountsResponseData {
+ pub fn new(accounts: Vec<::models::Account>, server_knowledge: i64) -> AccountsResponseData {
+ AccountsResponseData {
+ accounts: accounts,
+ server_knowledge: server_knowledge,
+ }
+ }
+}
+
+
diff --git a/src/models/budget_detail.rs b/src/models/budget_detail.rs
new file mode 100644
index 0000000..8553aad
--- /dev/null
+++ b/src/models/budget_detail.rs
@@ -0,0 +1,81 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct BudgetDetail {
+ #[serde(rename = "id")]
+ pub id: String,
+ #[serde(rename = "name")]
+ pub name: String,
+ /// The last time any changes were made to the budget from either a web or mobile client
+ #[serde(rename = "last_modified_on", skip_serializing_if = "Option::is_none")]
+ pub last_modified_on: Option<String>,
+ /// The earliest budget month
+ #[serde(rename = "first_month", skip_serializing_if = "Option::is_none")]
+ pub first_month: Option<String>,
+ /// The latest budget month
+ #[serde(rename = "last_month", skip_serializing_if = "Option::is_none")]
+ pub last_month: Option<String>,
+ #[serde(rename = "date_format", skip_serializing_if = "Option::is_none")]
+ pub date_format: Option<::models::DateFormat>,
+ #[serde(rename = "currency_format", skip_serializing_if = "Option::is_none")]
+ pub currency_format: Option<::models::CurrencyFormat>,
+ #[serde(rename = "accounts", skip_serializing_if = "Option::is_none")]
+ pub accounts: Option<Vec<::models::Account>>,
+ #[serde(rename = "payees", skip_serializing_if = "Option::is_none")]
+ pub payees: Option<Vec<::models::Payee>>,
+ #[serde(rename = "payee_locations", skip_serializing_if = "Option::is_none")]
+ pub payee_locations: Option<Vec<::models::PayeeLocation>>,
+ #[serde(rename = "category_groups", skip_serializing_if = "Option::is_none")]
+ pub category_groups: Option<Vec<::models::CategoryGroup>>,
+ #[serde(rename = "categories", skip_serializing_if = "Option::is_none")]
+ pub categories: Option<Vec<::models::Category>>,
+ #[serde(rename = "months", skip_serializing_if = "Option::is_none")]
+ pub months: Option<Vec<::models::MonthDetail>>,
+ #[serde(rename = "transactions", skip_serializing_if = "Option::is_none")]
+ pub transactions: Option<Vec<::models::TransactionSummary>>,
+ #[serde(rename = "subtransactions", skip_serializing_if = "Option::is_none")]
+ pub subtransactions: Option<Vec<::models::SubTransaction>>,
+ #[serde(rename = "scheduled_transactions", skip_serializing_if = "Option::is_none")]
+ pub scheduled_transactions: Option<Vec<::models::ScheduledTransactionSummary>>,
+ #[serde(rename = "scheduled_subtransactions", skip_serializing_if = "Option::is_none")]
+ pub scheduled_subtransactions: Option<Vec<::models::ScheduledSubTransaction>>,
+}
+
+impl BudgetDetail {
+ pub fn new(id: String, name: String) -> BudgetDetail {
+ BudgetDetail {
+ id: id,
+ name: name,
+ last_modified_on: None,
+ first_month: None,
+ last_month: None,
+ date_format: None,
+ currency_format: None,
+ accounts: None,
+ payees: None,
+ payee_locations: None,
+ category_groups: None,
+ categories: None,
+ months: None,
+ transactions: None,
+ subtransactions: None,
+ scheduled_transactions: None,
+ scheduled_subtransactions: None,
+ }
+ }
+}
+
+
diff --git a/src/models/budget_detail_all_of.rs b/src/models/budget_detail_all_of.rs
new file mode 100644
index 0000000..90a621e
--- /dev/null
+++ b/src/models/budget_detail_all_of.rs
@@ -0,0 +1,57 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct BudgetDetailAllOf {
+ #[serde(rename = "accounts", skip_serializing_if = "Option::is_none")]
+ pub accounts: Option<Vec<::models::Account>>,
+ #[serde(rename = "payees", skip_serializing_if = "Option::is_none")]
+ pub payees: Option<Vec<::models::Payee>>,
+ #[serde(rename = "payee_locations", skip_serializing_if = "Option::is_none")]
+ pub payee_locations: Option<Vec<::models::PayeeLocation>>,
+ #[serde(rename = "category_groups", skip_serializing_if = "Option::is_none")]
+ pub category_groups: Option<Vec<::models::CategoryGroup>>,
+ #[serde(rename = "categories", skip_serializing_if = "Option::is_none")]
+ pub categories: Option<Vec<::models::Category>>,
+ #[serde(rename = "months", skip_serializing_if = "Option::is_none")]
+ pub months: Option<Vec<::models::MonthDetail>>,
+ #[serde(rename = "transactions", skip_serializing_if = "Option::is_none")]
+ pub transactions: Option<Vec<::models::TransactionSummary>>,
+ #[serde(rename = "subtransactions", skip_serializing_if = "Option::is_none")]
+ pub subtransactions: Option<Vec<::models::SubTransaction>>,
+ #[serde(rename = "scheduled_transactions", skip_serializing_if = "Option::is_none")]
+ pub scheduled_transactions: Option<Vec<::models::ScheduledTransactionSummary>>,
+ #[serde(rename = "scheduled_subtransactions", skip_serializing_if = "Option::is_none")]
+ pub scheduled_subtransactions: Option<Vec<::models::ScheduledSubTransaction>>,
+}
+
+impl BudgetDetailAllOf {
+ pub fn new() -> BudgetDetailAllOf {
+ BudgetDetailAllOf {
+ accounts: None,
+ payees: None,
+ payee_locations: None,
+ category_groups: None,
+ categories: None,
+ months: None,
+ transactions: None,
+ subtransactions: None,
+ scheduled_transactions: None,
+ scheduled_subtransactions: None,
+ }
+ }
+}
+
+
diff --git a/src/models/budget_detail_response.rs b/src/models/budget_detail_response.rs
new file mode 100644
index 0000000..5fe15c9
--- /dev/null
+++ b/src/models/budget_detail_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct BudgetDetailResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::BudgetDetailResponseData,
+}
+
+impl BudgetDetailResponse {
+ pub fn new(data: ::models::BudgetDetailResponseData) -> BudgetDetailResponse {
+ BudgetDetailResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/budget_detail_response_data.rs b/src/models/budget_detail_response_data.rs
new file mode 100644
index 0000000..301479d
--- /dev/null
+++ b/src/models/budget_detail_response_data.rs
@@ -0,0 +1,34 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct BudgetDetailResponseData {
+ #[serde(rename = "budget")]
+ pub budget: ::models::BudgetDetail,
+ /// The knowledge of the server
+ #[serde(rename = "server_knowledge")]
+ pub server_knowledge: i64,
+}
+
+impl BudgetDetailResponseData {
+ pub fn new(budget: ::models::BudgetDetail, server_knowledge: i64) -> BudgetDetailResponseData {
+ BudgetDetailResponseData {
+ budget: budget,
+ server_knowledge: server_knowledge,
+ }
+ }
+}
+
+
diff --git a/src/models/budget_settings.rs b/src/models/budget_settings.rs
new file mode 100644
index 0000000..25985b5
--- /dev/null
+++ b/src/models/budget_settings.rs
@@ -0,0 +1,33 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct BudgetSettings {
+ #[serde(rename = "date_format")]
+ pub date_format: ::models::DateFormat,
+ #[serde(rename = "currency_format")]
+ pub currency_format: ::models::CurrencyFormat,
+}
+
+impl BudgetSettings {
+ pub fn new(date_format: ::models::DateFormat, currency_format: ::models::CurrencyFormat) -> BudgetSettings {
+ BudgetSettings {
+ date_format: date_format,
+ currency_format: currency_format,
+ }
+ }
+}
+
+
diff --git a/src/models/budget_settings_response.rs b/src/models/budget_settings_response.rs
new file mode 100644
index 0000000..c5c0ee3
--- /dev/null
+++ b/src/models/budget_settings_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct BudgetSettingsResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::BudgetSettingsResponseData,
+}
+
+impl BudgetSettingsResponse {
+ pub fn new(data: ::models::BudgetSettingsResponseData) -> BudgetSettingsResponse {
+ BudgetSettingsResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/budget_settings_response_data.rs b/src/models/budget_settings_response_data.rs
new file mode 100644
index 0000000..e484234
--- /dev/null
+++ b/src/models/budget_settings_response_data.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct BudgetSettingsResponseData {
+ #[serde(rename = "settings")]
+ pub settings: ::models::BudgetSettings,
+}
+
+impl BudgetSettingsResponseData {
+ pub fn new(settings: ::models::BudgetSettings) -> BudgetSettingsResponseData {
+ BudgetSettingsResponseData {
+ settings: settings,
+ }
+ }
+}
+
+
diff --git a/src/models/budget_summary.rs b/src/models/budget_summary.rs
new file mode 100644
index 0000000..b380593
--- /dev/null
+++ b/src/models/budget_summary.rs
@@ -0,0 +1,51 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct BudgetSummary {
+ #[serde(rename = "id")]
+ pub id: String,
+ #[serde(rename = "name")]
+ pub name: String,
+ /// The last time any changes were made to the budget from either a web or mobile client
+ #[serde(rename = "last_modified_on", skip_serializing_if = "Option::is_none")]
+ pub last_modified_on: Option<String>,
+ /// The earliest budget month
+ #[serde(rename = "first_month", skip_serializing_if = "Option::is_none")]
+ pub first_month: Option<String>,
+ /// The latest budget month
+ #[serde(rename = "last_month", skip_serializing_if = "Option::is_none")]
+ pub last_month: Option<String>,
+ #[serde(rename = "date_format", skip_serializing_if = "Option::is_none")]
+ pub date_format: Option<::models::DateFormat>,
+ #[serde(rename = "currency_format", skip_serializing_if = "Option::is_none")]
+ pub currency_format: Option<::models::CurrencyFormat>,
+}
+
+impl BudgetSummary {
+ pub fn new(id: String, name: String) -> BudgetSummary {
+ BudgetSummary {
+ id: id,
+ name: name,
+ last_modified_on: None,
+ first_month: None,
+ last_month: None,
+ date_format: None,
+ currency_format: None,
+ }
+ }
+}
+
+
diff --git a/src/models/budget_summary_response.rs b/src/models/budget_summary_response.rs
new file mode 100644
index 0000000..422dfae
--- /dev/null
+++ b/src/models/budget_summary_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct BudgetSummaryResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::BudgetSummaryResponseData,
+}
+
+impl BudgetSummaryResponse {
+ pub fn new(data: ::models::BudgetSummaryResponseData) -> BudgetSummaryResponse {
+ BudgetSummaryResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/budget_summary_response_data.rs b/src/models/budget_summary_response_data.rs
new file mode 100644
index 0000000..f6bec05
--- /dev/null
+++ b/src/models/budget_summary_response_data.rs
@@ -0,0 +1,33 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct BudgetSummaryResponseData {
+ #[serde(rename = "budgets")]
+ pub budgets: Vec<::models::BudgetSummary>,
+ #[serde(rename = "default_budget", skip_serializing_if = "Option::is_none")]
+ pub default_budget: Option<::models::BudgetSummary>,
+}
+
+impl BudgetSummaryResponseData {
+ pub fn new(budgets: Vec<::models::BudgetSummary>) -> BudgetSummaryResponseData {
+ BudgetSummaryResponseData {
+ budgets: budgets,
+ default_budget: None,
+ }
+ }
+}
+
+
diff --git a/src/models/bulk_response.rs b/src/models/bulk_response.rs
new file mode 100644
index 0000000..bf98b29
--- /dev/null
+++ b/src/models/bulk_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct BulkResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::BulkResponseData,
+}
+
+impl BulkResponse {
+ pub fn new(data: ::models::BulkResponseData) -> BulkResponse {
+ BulkResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/bulk_response_data.rs b/src/models/bulk_response_data.rs
new file mode 100644
index 0000000..e347af0
--- /dev/null
+++ b/src/models/bulk_response_data.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct BulkResponseData {
+ #[serde(rename = "bulk")]
+ pub bulk: ::models::BulkResponseDataBulk,
+}
+
+impl BulkResponseData {
+ pub fn new(bulk: ::models::BulkResponseDataBulk) -> BulkResponseData {
+ BulkResponseData {
+ bulk: bulk,
+ }
+ }
+}
+
+
diff --git a/src/models/bulk_response_data_bulk.rs b/src/models/bulk_response_data_bulk.rs
new file mode 100644
index 0000000..3993078
--- /dev/null
+++ b/src/models/bulk_response_data_bulk.rs
@@ -0,0 +1,35 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct BulkResponseDataBulk {
+ /// The list of Transaction ids that were created.
+ #[serde(rename = "transaction_ids")]
+ pub transaction_ids: Vec<String>,
+ /// If any Transactions were not created because they had an import_id matching a transaction already on the same account, the specified import_id(s) will be included in this list.
+ #[serde(rename = "duplicate_import_ids")]
+ pub duplicate_import_ids: Vec<String>,
+}
+
+impl BulkResponseDataBulk {
+ pub fn new(transaction_ids: Vec<String>, duplicate_import_ids: Vec<String>) -> BulkResponseDataBulk {
+ BulkResponseDataBulk {
+ transaction_ids: transaction_ids,
+ duplicate_import_ids: duplicate_import_ids,
+ }
+ }
+}
+
+
diff --git a/src/models/bulk_transactions.rs b/src/models/bulk_transactions.rs
new file mode 100644
index 0000000..e80c1c3
--- /dev/null
+++ b/src/models/bulk_transactions.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct BulkTransactions {
+ #[serde(rename = "transactions")]
+ pub transactions: Vec<::models::SaveTransaction>,
+}
+
+impl BulkTransactions {
+ pub fn new(transactions: Vec<::models::SaveTransaction>) -> BulkTransactions {
+ BulkTransactions {
+ transactions: transactions,
+ }
+ }
+}
+
+
diff --git a/src/models/categories_response.rs b/src/models/categories_response.rs
new file mode 100644
index 0000000..08fbafd
--- /dev/null
+++ b/src/models/categories_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CategoriesResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::CategoriesResponseData,
+}
+
+impl CategoriesResponse {
+ pub fn new(data: ::models::CategoriesResponseData) -> CategoriesResponse {
+ CategoriesResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/categories_response_data.rs b/src/models/categories_response_data.rs
new file mode 100644
index 0000000..980505e
--- /dev/null
+++ b/src/models/categories_response_data.rs
@@ -0,0 +1,34 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CategoriesResponseData {
+ #[serde(rename = "category_groups")]
+ pub category_groups: Vec<::models::CategoryGroupWithCategories>,
+ /// The knowledge of the server
+ #[serde(rename = "server_knowledge")]
+ pub server_knowledge: i64,
+}
+
+impl CategoriesResponseData {
+ pub fn new(category_groups: Vec<::models::CategoryGroupWithCategories>, server_knowledge: i64) -> CategoriesResponseData {
+ CategoriesResponseData {
+ category_groups: category_groups,
+ server_knowledge: server_knowledge,
+ }
+ }
+}
+
+
diff --git a/src/models/category.rs b/src/models/category.rs
new file mode 100644
index 0000000..1a62c6a
--- /dev/null
+++ b/src/models/category.rs
@@ -0,0 +1,93 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct Category {
+ #[serde(rename = "id")]
+ pub id: String,
+ #[serde(rename = "category_group_id")]
+ pub category_group_id: String,
+ #[serde(rename = "name")]
+ pub name: String,
+ /// Whether or not the category is hidden
+ #[serde(rename = "hidden")]
+ pub hidden: bool,
+ /// If category is hidden this is the id of the category group it originally belonged to before it was hidden.
+ #[serde(rename = "original_category_group_id", skip_serializing_if = "Option::is_none")]
+ pub original_category_group_id: Option<String>,
+ #[serde(rename = "note", skip_serializing_if = "Option::is_none")]
+ pub note: Option<String>,
+ /// Budgeted amount in milliunits format
+ #[serde(rename = "budgeted")]
+ pub budgeted: i64,
+ /// Activity amount in milliunits format
+ #[serde(rename = "activity")]
+ pub activity: i64,
+ /// Balance in milliunits format
+ #[serde(rename = "balance")]
+ pub balance: i64,
+ /// The type of goal, if the cagegory has a goal (TB=Target Category Balance, TBD=Target Category Balance by Date, MF=Monthly Funding)
+ #[serde(rename = "goal_type", skip_serializing_if = "Option::is_none")]
+ pub goal_type: Option<String>,
+ /// The month a goal was created
+ #[serde(rename = "goal_creation_month", skip_serializing_if = "Option::is_none")]
+ pub goal_creation_month: Option<String>,
+ /// The goal target amount in milliunits
+ #[serde(rename = "goal_target")]
+ pub goal_target: i64,
+ /// If the goal type is 'TBD' (Target Category Balance by Date), this is the target month for the goal to be completed
+ #[serde(rename = "goal_target_month", skip_serializing_if = "Option::is_none")]
+ pub goal_target_month: Option<String>,
+ /// The percentage completion of the goal
+ #[serde(rename = "goal_percentage_complete", skip_serializing_if = "Option::is_none")]
+ pub goal_percentage_complete: Option<i32>,
+ /// Whether or not the category has been deleted. Deleted categories will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+}
+
+impl Category {
+ pub fn new(id: String, category_group_id: String, name: String, hidden: bool, budgeted: i64, activity: i64, balance: i64, goal_target: i64, deleted: bool) -> Category {
+ Category {
+ id: id,
+ category_group_id: category_group_id,
+ name: name,
+ hidden: hidden,
+ original_category_group_id: None,
+ note: None,
+ budgeted: budgeted,
+ activity: activity,
+ balance: balance,
+ goal_type: None,
+ goal_creation_month: None,
+ goal_target: goal_target,
+ goal_target_month: None,
+ goal_percentage_complete: None,
+ deleted: deleted,
+ }
+ }
+}
+
+/// The type of goal, if the cagegory has a goal (TB=Target Category Balance, TBD=Target Category Balance by Date, MF=Monthly Funding)
+#[derive(Debug, Serialize, Deserialize)]
+pub enum GoalType {
+ #[serde(rename = "TB")]
+ TB,
+ #[serde(rename = "TBD")]
+ TBD,
+ #[serde(rename = "MF")]
+ MF,
+}
+
diff --git a/src/models/category_group.rs b/src/models/category_group.rs
new file mode 100644
index 0000000..2f674e2
--- /dev/null
+++ b/src/models/category_group.rs
@@ -0,0 +1,41 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CategoryGroup {
+ #[serde(rename = "id")]
+ pub id: String,
+ #[serde(rename = "name")]
+ pub name: String,
+ /// Whether or not the category group is hidden
+ #[serde(rename = "hidden")]
+ pub hidden: bool,
+ /// Whether or not the category group has been deleted. Deleted category groups will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+}
+
+impl CategoryGroup {
+ pub fn new(id: String, name: String, hidden: bool, deleted: bool) -> CategoryGroup {
+ CategoryGroup {
+ id: id,
+ name: name,
+ hidden: hidden,
+ deleted: deleted,
+ }
+ }
+}
+
+
diff --git a/src/models/category_group_with_categories.rs b/src/models/category_group_with_categories.rs
new file mode 100644
index 0000000..38cfd88
--- /dev/null
+++ b/src/models/category_group_with_categories.rs
@@ -0,0 +1,45 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CategoryGroupWithCategories {
+ #[serde(rename = "id")]
+ pub id: String,
+ #[serde(rename = "name")]
+ pub name: String,
+ /// Whether or not the category group is hidden
+ #[serde(rename = "hidden")]
+ pub hidden: bool,
+ /// Whether or not the category group has been deleted. Deleted category groups will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+ /// Category group categories. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC).
+ #[serde(rename = "categories")]
+ pub categories: Vec<::models::Category>,
+}
+
+impl CategoryGroupWithCategories {
+ pub fn new(id: String, name: String, hidden: bool, deleted: bool, categories: Vec<::models::Category>) -> CategoryGroupWithCategories {
+ CategoryGroupWithCategories {
+ id: id,
+ name: name,
+ hidden: hidden,
+ deleted: deleted,
+ categories: categories,
+ }
+ }
+}
+
+
diff --git a/src/models/category_group_with_categories_all_of.rs b/src/models/category_group_with_categories_all_of.rs
new file mode 100644
index 0000000..f34d3bb
--- /dev/null
+++ b/src/models/category_group_with_categories_all_of.rs
@@ -0,0 +1,31 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CategoryGroupWithCategoriesAllOf {
+ /// Category group categories. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC).
+ #[serde(rename = "categories")]
+ pub categories: Vec<::models::Category>,
+}
+
+impl CategoryGroupWithCategoriesAllOf {
+ pub fn new(categories: Vec<::models::Category>) -> CategoryGroupWithCategoriesAllOf {
+ CategoryGroupWithCategoriesAllOf {
+ categories: categories,
+ }
+ }
+}
+
+
diff --git a/src/models/category_response.rs b/src/models/category_response.rs
new file mode 100644
index 0000000..35f2f40
--- /dev/null
+++ b/src/models/category_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CategoryResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::CategoryResponseData,
+}
+
+impl CategoryResponse {
+ pub fn new(data: ::models::CategoryResponseData) -> CategoryResponse {
+ CategoryResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/category_response_data.rs b/src/models/category_response_data.rs
new file mode 100644
index 0000000..4e81fbb
--- /dev/null
+++ b/src/models/category_response_data.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CategoryResponseData {
+ #[serde(rename = "category")]
+ pub category: ::models::Category,
+}
+
+impl CategoryResponseData {
+ pub fn new(category: ::models::Category) -> CategoryResponseData {
+ CategoryResponseData {
+ category: category,
+ }
+ }
+}
+
+
diff --git a/src/models/currency_format.rs b/src/models/currency_format.rs
new file mode 100644
index 0000000..476856a
--- /dev/null
+++ b/src/models/currency_format.rs
@@ -0,0 +1,53 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+/// CurrencyFormat : The currency format setting for the budget. In some cases the format will not be available and will be specified as null.
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CurrencyFormat {
+ #[serde(rename = "iso_code")]
+ pub iso_code: String,
+ #[serde(rename = "example_format")]
+ pub example_format: String,
+ #[serde(rename = "decimal_digits")]
+ pub decimal_digits: i32,
+ #[serde(rename = "decimal_separator")]
+ pub decimal_separator: String,
+ #[serde(rename = "symbol_first")]
+ pub symbol_first: bool,
+ #[serde(rename = "group_separator")]
+ pub group_separator: String,
+ #[serde(rename = "currency_symbol")]
+ pub currency_symbol: String,
+ #[serde(rename = "display_symbol")]
+ pub display_symbol: bool,
+}
+
+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,
+ }
+ }
+}
+
+
diff --git a/src/models/date_format.rs b/src/models/date_format.rs
new file mode 100644
index 0000000..cf88395
--- /dev/null
+++ b/src/models/date_format.rs
@@ -0,0 +1,32 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+/// DateFormat : The date format setting for the budget. In some cases the format will not be available and will be specified as null.
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct DateFormat {
+ #[serde(rename = "format")]
+ pub format: String,
+}
+
+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,
+ }
+ }
+}
+
+
diff --git a/src/models/error_detail.rs b/src/models/error_detail.rs
new file mode 100644
index 0000000..4745cf3
--- /dev/null
+++ b/src/models/error_detail.rs
@@ -0,0 +1,36 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct ErrorDetail {
+ #[serde(rename = "id")]
+ pub id: String,
+ #[serde(rename = "name")]
+ pub name: String,
+ #[serde(rename = "detail")]
+ pub detail: String,
+}
+
+impl ErrorDetail {
+ pub fn new(id: String, name: String, detail: String) -> ErrorDetail {
+ ErrorDetail {
+ id: id,
+ name: name,
+ detail: detail,
+ }
+ }
+}
+
+
diff --git a/src/models/error_response.rs b/src/models/error_response.rs
new file mode 100644
index 0000000..c321726
--- /dev/null
+++ b/src/models/error_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct ErrorResponse {
+ #[serde(rename = "error")]
+ pub error: ::models::ErrorDetail,
+}
+
+impl ErrorResponse {
+ pub fn new(error: ::models::ErrorDetail) -> ErrorResponse {
+ ErrorResponse {
+ error: error,
+ }
+ }
+}
+
+
diff --git a/src/models/hybrid_transaction.rs b/src/models/hybrid_transaction.rs
new file mode 100644
index 0000000..802813b
--- /dev/null
+++ b/src/models/hybrid_transaction.rs
@@ -0,0 +1,133 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct HybridTransaction {
+ #[serde(rename = "id")]
+ pub id: String,
+ /// The transaction date in ISO format (e.g. 2016-12-01)
+ #[serde(rename = "date")]
+ pub date: String,
+ /// The transaction amount in milliunits format
+ #[serde(rename = "amount")]
+ pub amount: i64,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
+ /// The cleared status of the transaction
+ #[serde(rename = "cleared")]
+ pub cleared: String,
+ /// 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<String>,
+ #[serde(rename = "account_id")]
+ pub account_id: String,
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
+ #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
+ pub category_id: Option<String>,
+ /// If a transfer transaction, the account to which it transfers
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
+ /// If a transfer transaction, the id of transaction on the other side of the transfer
+ #[serde(rename = "transfer_transaction_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_transaction_id: Option<String>,
+ /// If transaction is matched, the id of the matched transaction
+ #[serde(rename = "matched_transaction_id", skip_serializing_if = "Option::is_none")]
+ pub matched_transaction_id: Option<String>,
+ /// If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'.
+ #[serde(rename = "import_id", skip_serializing_if = "Option::is_none")]
+ pub import_id: Option<String>,
+ /// Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+ /// Whether the hybrid transaction represents a regular transaction or a subtransaction
+ #[serde(rename = "type")]
+ pub _type: String,
+ /// For subtransaction types, this is the id of the pararent transaction. For transaction types, this id will be always be null.
+ #[serde(rename = "parent_transaction_id", skip_serializing_if = "Option::is_none")]
+ pub parent_transaction_id: Option<String>,
+ #[serde(rename = "account_name")]
+ pub account_name: String,
+ #[serde(rename = "payee_name", skip_serializing_if = "Option::is_none")]
+ pub payee_name: Option<String>,
+ #[serde(rename = "category_name")]
+ pub category_name: String,
+}
+
+impl HybridTransaction {
+ pub fn new(id: String, date: String, amount: i64, cleared: String, approved: bool, account_id: String, deleted: bool, _type: String, account_name: String, category_name: String) -> HybridTransaction {
+ HybridTransaction {
+ id: id,
+ date: date,
+ amount: amount,
+ memo: None,
+ cleared: cleared,
+ approved: approved,
+ flag_color: None,
+ 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,
+ parent_transaction_id: None,
+ account_name: account_name,
+ payee_name: None,
+ category_name: category_name,
+ }
+ }
+}
+
+/// The cleared status of the transaction
+#[derive(Debug, Serialize, Deserialize)]
+pub enum Cleared {
+ #[serde(rename = "cleared")]
+ Cleared,
+ #[serde(rename = "uncleared")]
+ Uncleared,
+ #[serde(rename = "reconciled")]
+ Reconciled,
+}
+/// The transaction flag
+#[derive(Debug, 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, Serialize, Deserialize)]
+pub enum Type {
+ #[serde(rename = "transaction")]
+ Transaction,
+ #[serde(rename = "subtransaction")]
+ Subtransaction,
+}
+
diff --git a/src/models/hybrid_transaction_all_of.rs b/src/models/hybrid_transaction_all_of.rs
new file mode 100644
index 0000000..42fd515
--- /dev/null
+++ b/src/models/hybrid_transaction_all_of.rs
@@ -0,0 +1,52 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct HybridTransactionAllOf {
+ /// Whether the hybrid transaction represents a regular transaction or a subtransaction
+ #[serde(rename = "type")]
+ pub _type: String,
+ /// For subtransaction types, this is the id of the pararent transaction. For transaction types, this id will be always be null.
+ #[serde(rename = "parent_transaction_id", skip_serializing_if = "Option::is_none")]
+ pub parent_transaction_id: Option<String>,
+ #[serde(rename = "account_name")]
+ pub account_name: String,
+ #[serde(rename = "payee_name", skip_serializing_if = "Option::is_none")]
+ pub payee_name: Option<String>,
+ #[serde(rename = "category_name")]
+ pub category_name: String,
+}
+
+impl HybridTransactionAllOf {
+ pub fn new(_type: String, account_name: String, category_name: String) -> HybridTransactionAllOf {
+ HybridTransactionAllOf {
+ _type: _type,
+ parent_transaction_id: None,
+ account_name: account_name,
+ payee_name: None,
+ category_name: category_name,
+ }
+ }
+}
+
+/// Whether the hybrid transaction represents a regular transaction or a subtransaction
+#[derive(Debug, Serialize, Deserialize)]
+pub enum Type {
+ #[serde(rename = "transaction")]
+ Transaction,
+ #[serde(rename = "subtransaction")]
+ Subtransaction,
+}
+
diff --git a/src/models/hybrid_transactions_response.rs b/src/models/hybrid_transactions_response.rs
new file mode 100644
index 0000000..493582e
--- /dev/null
+++ b/src/models/hybrid_transactions_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct HybridTransactionsResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::HybridTransactionsResponseData,
+}
+
+impl HybridTransactionsResponse {
+ pub fn new(data: ::models::HybridTransactionsResponseData) -> HybridTransactionsResponse {
+ HybridTransactionsResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/hybrid_transactions_response_data.rs b/src/models/hybrid_transactions_response_data.rs
new file mode 100644
index 0000000..8e329e4
--- /dev/null
+++ b/src/models/hybrid_transactions_response_data.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct HybridTransactionsResponseData {
+ #[serde(rename = "transactions")]
+ pub transactions: Vec<::models::HybridTransaction>,
+}
+
+impl HybridTransactionsResponseData {
+ pub fn new(transactions: Vec<::models::HybridTransaction>) -> HybridTransactionsResponseData {
+ HybridTransactionsResponseData {
+ transactions: transactions,
+ }
+ }
+}
+
+
diff --git a/src/models/mod.rs b/src/models/mod.rs
new file mode 100644
index 0000000..ba8b351
--- /dev/null
+++ b/src/models/mod.rs
@@ -0,0 +1,168 @@
+mod account;
+pub use self::account::Account;
+mod account_response;
+pub use self::account_response::AccountResponse;
+mod account_response_data;
+pub use self::account_response_data::AccountResponseData;
+mod accounts_response;
+pub use self::accounts_response::AccountsResponse;
+mod accounts_response_data;
+pub use self::accounts_response_data::AccountsResponseData;
+mod budget_detail;
+pub use self::budget_detail::BudgetDetail;
+mod budget_detail_all_of;
+pub use self::budget_detail_all_of::BudgetDetailAllOf;
+mod budget_detail_response;
+pub use self::budget_detail_response::BudgetDetailResponse;
+mod budget_detail_response_data;
+pub use self::budget_detail_response_data::BudgetDetailResponseData;
+mod budget_settings;
+pub use self::budget_settings::BudgetSettings;
+mod budget_settings_response;
+pub use self::budget_settings_response::BudgetSettingsResponse;
+mod budget_settings_response_data;
+pub use self::budget_settings_response_data::BudgetSettingsResponseData;
+mod budget_summary;
+pub use self::budget_summary::BudgetSummary;
+mod budget_summary_response;
+pub use self::budget_summary_response::BudgetSummaryResponse;
+mod budget_summary_response_data;
+pub use self::budget_summary_response_data::BudgetSummaryResponseData;
+mod bulk_response;
+pub use self::bulk_response::BulkResponse;
+mod bulk_response_data;
+pub use self::bulk_response_data::BulkResponseData;
+mod bulk_response_data_bulk;
+pub use self::bulk_response_data_bulk::BulkResponseDataBulk;
+mod bulk_transactions;
+pub use self::bulk_transactions::BulkTransactions;
+mod categories_response;
+pub use self::categories_response::CategoriesResponse;
+mod categories_response_data;
+pub use self::categories_response_data::CategoriesResponseData;
+mod category;
+pub use self::category::Category;
+mod category_group;
+pub use self::category_group::CategoryGroup;
+mod category_group_with_categories;
+pub use self::category_group_with_categories::CategoryGroupWithCategories;
+mod category_group_with_categories_all_of;
+pub use self::category_group_with_categories_all_of::CategoryGroupWithCategoriesAllOf;
+mod category_response;
+pub use self::category_response::CategoryResponse;
+mod category_response_data;
+pub use self::category_response_data::CategoryResponseData;
+mod currency_format;
+pub use self::currency_format::CurrencyFormat;
+mod date_format;
+pub use self::date_format::DateFormat;
+mod error_detail;
+pub use self::error_detail::ErrorDetail;
+mod error_response;
+pub use self::error_response::ErrorResponse;
+mod hybrid_transaction;
+pub use self::hybrid_transaction::HybridTransaction;
+mod hybrid_transaction_all_of;
+pub use self::hybrid_transaction_all_of::HybridTransactionAllOf;
+mod hybrid_transactions_response;
+pub use self::hybrid_transactions_response::HybridTransactionsResponse;
+mod hybrid_transactions_response_data;
+pub use self::hybrid_transactions_response_data::HybridTransactionsResponseData;
+mod month_detail;
+pub use self::month_detail::MonthDetail;
+mod month_detail_all_of;
+pub use self::month_detail_all_of::MonthDetailAllOf;
+mod month_detail_response;
+pub use self::month_detail_response::MonthDetailResponse;
+mod month_detail_response_data;
+pub use self::month_detail_response_data::MonthDetailResponseData;
+mod month_summaries_response;
+pub use self::month_summaries_response::MonthSummariesResponse;
+mod month_summaries_response_data;
+pub use self::month_summaries_response_data::MonthSummariesResponseData;
+mod month_summary;
+pub use self::month_summary::MonthSummary;
+mod payee;
+pub use self::payee::Payee;
+mod payee_location;
+pub use self::payee_location::PayeeLocation;
+mod payee_location_response;
+pub use self::payee_location_response::PayeeLocationResponse;
+mod payee_location_response_data;
+pub use self::payee_location_response_data::PayeeLocationResponseData;
+mod payee_locations_response;
+pub use self::payee_locations_response::PayeeLocationsResponse;
+mod payee_locations_response_data;
+pub use self::payee_locations_response_data::PayeeLocationsResponseData;
+mod payee_response;
+pub use self::payee_response::PayeeResponse;
+mod payee_response_data;
+pub use self::payee_response_data::PayeeResponseData;
+mod payees_response;
+pub use self::payees_response::PayeesResponse;
+mod payees_response_data;
+pub use self::payees_response_data::PayeesResponseData;
+mod save_category_response;
+pub use self::save_category_response::SaveCategoryResponse;
+mod save_category_response_data;
+pub use self::save_category_response_data::SaveCategoryResponseData;
+mod save_month_category;
+pub use self::save_month_category::SaveMonthCategory;
+mod save_month_category_wrapper;
+pub use self::save_month_category_wrapper::SaveMonthCategoryWrapper;
+mod save_transaction;
+pub use self::save_transaction::SaveTransaction;
+mod save_transaction_wrapper;
+pub use self::save_transaction_wrapper::SaveTransactionWrapper;
+mod save_transactions_response;
+pub use self::save_transactions_response::SaveTransactionsResponse;
+mod save_transactions_response_data;
+pub use self::save_transactions_response_data::SaveTransactionsResponseData;
+mod save_transactions_wrapper;
+pub use self::save_transactions_wrapper::SaveTransactionsWrapper;
+mod scheduled_sub_transaction;
+pub use self::scheduled_sub_transaction::ScheduledSubTransaction;
+mod scheduled_transaction_detail;
+pub use self::scheduled_transaction_detail::ScheduledTransactionDetail;
+mod scheduled_transaction_detail_all_of;
+pub use self::scheduled_transaction_detail_all_of::ScheduledTransactionDetailAllOf;
+mod scheduled_transaction_response;
+pub use self::scheduled_transaction_response::ScheduledTransactionResponse;
+mod scheduled_transaction_response_data;
+pub use self::scheduled_transaction_response_data::ScheduledTransactionResponseData;
+mod scheduled_transaction_summary;
+pub use self::scheduled_transaction_summary::ScheduledTransactionSummary;
+mod scheduled_transactions_response;
+pub use self::scheduled_transactions_response::ScheduledTransactionsResponse;
+mod scheduled_transactions_response_data;
+pub use self::scheduled_transactions_response_data::ScheduledTransactionsResponseData;
+mod sub_transaction;
+pub use self::sub_transaction::SubTransaction;
+mod transaction_detail;
+pub use self::transaction_detail::TransactionDetail;
+mod transaction_detail_all_of;
+pub use self::transaction_detail_all_of::TransactionDetailAllOf;
+mod transaction_response;
+pub use self::transaction_response::TransactionResponse;
+mod transaction_response_data;
+pub use self::transaction_response_data::TransactionResponseData;
+mod transaction_summary;
+pub use self::transaction_summary::TransactionSummary;
+mod transactions_response;
+pub use self::transactions_response::TransactionsResponse;
+mod transactions_response_data;
+pub use self::transactions_response_data::TransactionsResponseData;
+mod update_transaction;
+pub use self::update_transaction::UpdateTransaction;
+mod update_transaction_wrapper;
+pub use self::update_transaction_wrapper::UpdateTransactionWrapper;
+mod update_transactions_response;
+pub use self::update_transactions_response::UpdateTransactionsResponse;
+mod update_transactions_wrapper;
+pub use self::update_transactions_wrapper::UpdateTransactionsWrapper;
+mod user;
+pub use self::user::User;
+mod user_response;
+pub use self::user_response::UserResponse;
+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
new file mode 100644
index 0000000..a6f55d4
--- /dev/null
+++ b/src/models/month_detail.rs
@@ -0,0 +1,61 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct MonthDetail {
+ #[serde(rename = "month")]
+ pub month: String,
+ #[serde(rename = "note", skip_serializing_if = "Option::is_none")]
+ pub note: Option<String>,
+ /// The total amount in transactions categorized to 'Inflow: To be Budgeted' in the month
+ #[serde(rename = "income")]
+ pub income: i64,
+ /// The total amount budgeted in the month
+ #[serde(rename = "budgeted")]
+ pub budgeted: i64,
+ /// The total amount in transactions in the month, excluding those categorized to 'Inflow: To be Budgeted'
+ #[serde(rename = "activity")]
+ pub activity: i64,
+ /// The available amount for 'To be Budgeted'
+ #[serde(rename = "to_be_budgeted")]
+ pub to_be_budgeted: i64,
+ /// The Age of Money as of the month
+ #[serde(rename = "age_of_money", skip_serializing_if = "Option::is_none")]
+ pub age_of_money: Option<i32>,
+ /// Whether or not the month has been deleted. Deleted months will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+ /// The budget month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified.
+ #[serde(rename = "categories")]
+ pub categories: Vec<::models::Category>,
+}
+
+impl MonthDetail {
+ pub fn new(month: String, income: i64, budgeted: i64, activity: i64, to_be_budgeted: i64, deleted: bool, categories: Vec<::models::Category>) -> MonthDetail {
+ MonthDetail {
+ month: month,
+ note: None,
+ income: income,
+ budgeted: budgeted,
+ activity: activity,
+ to_be_budgeted: to_be_budgeted,
+ age_of_money: None,
+ deleted: deleted,
+ categories: categories,
+ }
+ }
+}
+
+
diff --git a/src/models/month_detail_all_of.rs b/src/models/month_detail_all_of.rs
new file mode 100644
index 0000000..0f07326
--- /dev/null
+++ b/src/models/month_detail_all_of.rs
@@ -0,0 +1,31 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct MonthDetailAllOf {
+ /// The budget month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified.
+ #[serde(rename = "categories")]
+ pub categories: Vec<::models::Category>,
+}
+
+impl MonthDetailAllOf {
+ pub fn new(categories: Vec<::models::Category>) -> MonthDetailAllOf {
+ MonthDetailAllOf {
+ categories: categories,
+ }
+ }
+}
+
+
diff --git a/src/models/month_detail_response.rs b/src/models/month_detail_response.rs
new file mode 100644
index 0000000..c144afb
--- /dev/null
+++ b/src/models/month_detail_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct MonthDetailResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::MonthDetailResponseData,
+}
+
+impl MonthDetailResponse {
+ pub fn new(data: ::models::MonthDetailResponseData) -> MonthDetailResponse {
+ MonthDetailResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/month_detail_response_data.rs b/src/models/month_detail_response_data.rs
new file mode 100644
index 0000000..0948763
--- /dev/null
+++ b/src/models/month_detail_response_data.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct MonthDetailResponseData {
+ #[serde(rename = "month")]
+ pub month: ::models::MonthDetail,
+}
+
+impl MonthDetailResponseData {
+ pub fn new(month: ::models::MonthDetail) -> MonthDetailResponseData {
+ MonthDetailResponseData {
+ month: month,
+ }
+ }
+}
+
+
diff --git a/src/models/month_summaries_response.rs b/src/models/month_summaries_response.rs
new file mode 100644
index 0000000..44d5d66
--- /dev/null
+++ b/src/models/month_summaries_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct MonthSummariesResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::MonthSummariesResponseData,
+}
+
+impl MonthSummariesResponse {
+ pub fn new(data: ::models::MonthSummariesResponseData) -> MonthSummariesResponse {
+ MonthSummariesResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/month_summaries_response_data.rs b/src/models/month_summaries_response_data.rs
new file mode 100644
index 0000000..6237601
--- /dev/null
+++ b/src/models/month_summaries_response_data.rs
@@ -0,0 +1,34 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct MonthSummariesResponseData {
+ #[serde(rename = "months")]
+ pub months: Vec<::models::MonthSummary>,
+ /// The knowledge of the server
+ #[serde(rename = "server_knowledge")]
+ pub server_knowledge: i64,
+}
+
+impl MonthSummariesResponseData {
+ pub fn new(months: Vec<::models::MonthSummary>, server_knowledge: i64) -> MonthSummariesResponseData {
+ MonthSummariesResponseData {
+ months: months,
+ server_knowledge: server_knowledge,
+ }
+ }
+}
+
+
diff --git a/src/models/month_summary.rs b/src/models/month_summary.rs
new file mode 100644
index 0000000..3c705d3
--- /dev/null
+++ b/src/models/month_summary.rs
@@ -0,0 +1,57 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct MonthSummary {
+ #[serde(rename = "month")]
+ pub month: String,
+ #[serde(rename = "note", skip_serializing_if = "Option::is_none")]
+ pub note: Option<String>,
+ /// The total amount in transactions categorized to 'Inflow: To be Budgeted' in the month
+ #[serde(rename = "income")]
+ pub income: i64,
+ /// The total amount budgeted in the month
+ #[serde(rename = "budgeted")]
+ pub budgeted: i64,
+ /// The total amount in transactions in the month, excluding those categorized to 'Inflow: To be Budgeted'
+ #[serde(rename = "activity")]
+ pub activity: i64,
+ /// The available amount for 'To be Budgeted'
+ #[serde(rename = "to_be_budgeted")]
+ pub to_be_budgeted: i64,
+ /// The Age of Money as of the month
+ #[serde(rename = "age_of_money", skip_serializing_if = "Option::is_none")]
+ pub age_of_money: Option<i32>,
+ /// Whether or not the month has been deleted. Deleted months will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+}
+
+impl MonthSummary {
+ pub fn new(month: String, income: i64, budgeted: i64, activity: i64, to_be_budgeted: i64, deleted: bool) -> MonthSummary {
+ MonthSummary {
+ month: month,
+ note: None,
+ income: income,
+ budgeted: budgeted,
+ activity: activity,
+ to_be_budgeted: to_be_budgeted,
+ age_of_money: None,
+ deleted: deleted,
+ }
+ }
+}
+
+
diff --git a/src/models/payee.rs b/src/models/payee.rs
new file mode 100644
index 0000000..13ad103
--- /dev/null
+++ b/src/models/payee.rs
@@ -0,0 +1,41 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct Payee {
+ #[serde(rename = "id")]
+ pub id: String,
+ #[serde(rename = "name")]
+ pub name: String,
+ /// If a transfer payee, the account_id to which this payee transfers to
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
+ /// Whether or not the payee has been deleted. Deleted payees will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+}
+
+impl Payee {
+ pub fn new(id: String, name: String, deleted: bool) -> Payee {
+ Payee {
+ id: id,
+ name: name,
+ transfer_account_id: None,
+ deleted: deleted,
+ }
+ }
+}
+
+
diff --git a/src/models/payee_location.rs b/src/models/payee_location.rs
new file mode 100644
index 0000000..afb050e
--- /dev/null
+++ b/src/models/payee_location.rs
@@ -0,0 +1,43 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct PayeeLocation {
+ #[serde(rename = "id")]
+ pub id: String,
+ #[serde(rename = "payee_id")]
+ pub payee_id: String,
+ #[serde(rename = "latitude")]
+ pub latitude: String,
+ #[serde(rename = "longitude")]
+ pub longitude: String,
+ /// Whether or not the payee location has been deleted. Deleted payee locations will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+}
+
+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,
+ }
+ }
+}
+
+
diff --git a/src/models/payee_location_response.rs b/src/models/payee_location_response.rs
new file mode 100644
index 0000000..e6d2608
--- /dev/null
+++ b/src/models/payee_location_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct PayeeLocationResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::PayeeLocationResponseData,
+}
+
+impl PayeeLocationResponse {
+ pub fn new(data: ::models::PayeeLocationResponseData) -> PayeeLocationResponse {
+ PayeeLocationResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/payee_location_response_data.rs b/src/models/payee_location_response_data.rs
new file mode 100644
index 0000000..869c4ea
--- /dev/null
+++ b/src/models/payee_location_response_data.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct PayeeLocationResponseData {
+ #[serde(rename = "payee_location")]
+ pub payee_location: ::models::PayeeLocation,
+}
+
+impl PayeeLocationResponseData {
+ pub fn new(payee_location: ::models::PayeeLocation) -> PayeeLocationResponseData {
+ PayeeLocationResponseData {
+ payee_location: payee_location,
+ }
+ }
+}
+
+
diff --git a/src/models/payee_locations_response.rs b/src/models/payee_locations_response.rs
new file mode 100644
index 0000000..916a19e
--- /dev/null
+++ b/src/models/payee_locations_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct PayeeLocationsResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::PayeeLocationsResponseData,
+}
+
+impl PayeeLocationsResponse {
+ pub fn new(data: ::models::PayeeLocationsResponseData) -> PayeeLocationsResponse {
+ PayeeLocationsResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/payee_locations_response_data.rs b/src/models/payee_locations_response_data.rs
new file mode 100644
index 0000000..ea46038
--- /dev/null
+++ b/src/models/payee_locations_response_data.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct PayeeLocationsResponseData {
+ #[serde(rename = "payee_locations")]
+ pub payee_locations: Vec<::models::PayeeLocation>,
+}
+
+impl PayeeLocationsResponseData {
+ pub fn new(payee_locations: Vec<::models::PayeeLocation>) -> PayeeLocationsResponseData {
+ PayeeLocationsResponseData {
+ payee_locations: payee_locations,
+ }
+ }
+}
+
+
diff --git a/src/models/payee_response.rs b/src/models/payee_response.rs
new file mode 100644
index 0000000..690913a
--- /dev/null
+++ b/src/models/payee_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct PayeeResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::PayeeResponseData,
+}
+
+impl PayeeResponse {
+ pub fn new(data: ::models::PayeeResponseData) -> PayeeResponse {
+ PayeeResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/payee_response_data.rs b/src/models/payee_response_data.rs
new file mode 100644
index 0000000..f19f7ea
--- /dev/null
+++ b/src/models/payee_response_data.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct PayeeResponseData {
+ #[serde(rename = "payee")]
+ pub payee: ::models::Payee,
+}
+
+impl PayeeResponseData {
+ pub fn new(payee: ::models::Payee) -> PayeeResponseData {
+ PayeeResponseData {
+ payee: payee,
+ }
+ }
+}
+
+
diff --git a/src/models/payees_response.rs b/src/models/payees_response.rs
new file mode 100644
index 0000000..dba96f3
--- /dev/null
+++ b/src/models/payees_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct PayeesResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::PayeesResponseData,
+}
+
+impl PayeesResponse {
+ pub fn new(data: ::models::PayeesResponseData) -> PayeesResponse {
+ PayeesResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/payees_response_data.rs b/src/models/payees_response_data.rs
new file mode 100644
index 0000000..4897b15
--- /dev/null
+++ b/src/models/payees_response_data.rs
@@ -0,0 +1,34 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct PayeesResponseData {
+ #[serde(rename = "payees")]
+ pub payees: Vec<::models::Payee>,
+ /// The knowledge of the server
+ #[serde(rename = "server_knowledge")]
+ pub server_knowledge: i64,
+}
+
+impl PayeesResponseData {
+ pub fn new(payees: Vec<::models::Payee>, server_knowledge: i64) -> PayeesResponseData {
+ PayeesResponseData {
+ payees: payees,
+ server_knowledge: server_knowledge,
+ }
+ }
+}
+
+
diff --git a/src/models/save_category_response.rs b/src/models/save_category_response.rs
new file mode 100644
index 0000000..37744c1
--- /dev/null
+++ b/src/models/save_category_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct SaveCategoryResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::SaveCategoryResponseData,
+}
+
+impl SaveCategoryResponse {
+ pub fn new(data: ::models::SaveCategoryResponseData) -> SaveCategoryResponse {
+ SaveCategoryResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/save_category_response_data.rs b/src/models/save_category_response_data.rs
new file mode 100644
index 0000000..b61b206
--- /dev/null
+++ b/src/models/save_category_response_data.rs
@@ -0,0 +1,34 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct SaveCategoryResponseData {
+ #[serde(rename = "category")]
+ pub category: ::models::Category,
+ /// The knowledge of the server
+ #[serde(rename = "server_knowledge")]
+ pub server_knowledge: i64,
+}
+
+impl SaveCategoryResponseData {
+ pub fn new(category: ::models::Category, server_knowledge: i64) -> SaveCategoryResponseData {
+ SaveCategoryResponseData {
+ category: category,
+ server_knowledge: server_knowledge,
+ }
+ }
+}
+
+
diff --git a/src/models/save_month_category.rs b/src/models/save_month_category.rs
new file mode 100644
index 0000000..40d1b2e
--- /dev/null
+++ b/src/models/save_month_category.rs
@@ -0,0 +1,31 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct SaveMonthCategory {
+ /// Budgeted amount in milliunits format
+ #[serde(rename = "budgeted")]
+ pub budgeted: i64,
+}
+
+impl SaveMonthCategory {
+ pub fn new(budgeted: i64) -> SaveMonthCategory {
+ SaveMonthCategory {
+ budgeted: budgeted,
+ }
+ }
+}
+
+
diff --git a/src/models/save_month_category_wrapper.rs b/src/models/save_month_category_wrapper.rs
new file mode 100644
index 0000000..ef67116
--- /dev/null
+++ b/src/models/save_month_category_wrapper.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct SaveMonthCategoryWrapper {
+ #[serde(rename = "category")]
+ pub category: ::models::SaveMonthCategory,
+}
+
+impl SaveMonthCategoryWrapper {
+ pub fn new(category: ::models::SaveMonthCategory) -> SaveMonthCategoryWrapper {
+ SaveMonthCategoryWrapper {
+ category: category,
+ }
+ }
+}
+
+
diff --git a/src/models/save_transaction.rs b/src/models/save_transaction.rs
new file mode 100644
index 0000000..c2fc6b7
--- /dev/null
+++ b/src/models/save_transaction.rs
@@ -0,0 +1,95 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct SaveTransaction {
+ #[serde(rename = "account_id")]
+ pub account_id: String,
+ /// The transaction date in ISO format (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored.
+ #[serde(rename = "date")]
+ pub date: String,
+ /// The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored.
+ #[serde(rename = "amount")]
+ pub amount: i64,
+ /// The payee for the transaction
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
+ /// The payee name. If a payee_name value is provided and payee_id has a null value, the payee_name value will be used to resolve the payee by either (1) a matching payee rename rule (only if import_id is also specified) or (2) a payee with the same name or (3) creation of a new payee.
+ #[serde(rename = "payee_name", skip_serializing_if = "Option::is_none")]
+ pub payee_name: Option<String>,
+ /// The category for the transaction. Split and Credit Card Payment categories are not permitted and will be ignored if supplied. If an existing transaction has a Split category it cannot be changed.
+ #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
+ pub category_id: Option<String>,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
+ /// The cleared status of the transaction
+ #[serde(rename = "cleared", skip_serializing_if = "Option::is_none")]
+ pub cleared: Option<String>,
+ /// 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<bool>,
+ /// The transaction flag
+ #[serde(rename = "flag_color", skip_serializing_if = "Option::is_none")]
+ pub flag_color: Option<String>,
+ /// If specified, the new transaction will be assigned this import_id and considered \"imported\". *At the time of import* we will attempt to match \"imported\" transactions with non-imported (i.e. \"user-entered\") transactions.<br><br>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.<br><br>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<String>,
+}
+
+impl SaveTransaction {
+ pub fn new(account_id: String, date: String, amount: i64) -> SaveTransaction {
+ SaveTransaction {
+ account_id: account_id,
+ date: date,
+ amount: amount,
+ payee_id: None,
+ payee_name: None,
+ category_id: None,
+ memo: None,
+ cleared: None,
+ approved: None,
+ flag_color: None,
+ import_id: None,
+ }
+ }
+}
+
+/// The cleared status of the transaction
+#[derive(Debug, Serialize, Deserialize)]
+pub enum Cleared {
+ #[serde(rename = "cleared")]
+ Cleared,
+ #[serde(rename = "uncleared")]
+ Uncleared,
+ #[serde(rename = "reconciled")]
+ Reconciled,
+}
+/// The transaction flag
+#[derive(Debug, 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
new file mode 100644
index 0000000..71bc7cd
--- /dev/null
+++ b/src/models/save_transaction_wrapper.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct SaveTransactionWrapper {
+ #[serde(rename = "transaction")]
+ pub transaction: ::models::SaveTransaction,
+}
+
+impl SaveTransactionWrapper {
+ pub fn new(transaction: ::models::SaveTransaction) -> SaveTransactionWrapper {
+ SaveTransactionWrapper {
+ transaction: transaction,
+ }
+ }
+}
+
+
diff --git a/src/models/save_transactions_response.rs b/src/models/save_transactions_response.rs
new file mode 100644
index 0000000..be0782c
--- /dev/null
+++ b/src/models/save_transactions_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct SaveTransactionsResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::SaveTransactionsResponseData,
+}
+
+impl SaveTransactionsResponse {
+ pub fn new(data: ::models::SaveTransactionsResponseData) -> SaveTransactionsResponse {
+ SaveTransactionsResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/save_transactions_response_data.rs b/src/models/save_transactions_response_data.rs
new file mode 100644
index 0000000..0086874
--- /dev/null
+++ b/src/models/save_transactions_response_data.rs
@@ -0,0 +1,46 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct SaveTransactionsResponseData {
+ /// The transaction ids that were saved
+ #[serde(rename = "transaction_ids")]
+ pub transaction_ids: Vec<String>,
+ #[serde(rename = "transaction", skip_serializing_if = "Option::is_none")]
+ pub transaction: Option<::models::TransactionDetail>,
+ /// If multiple transactions were specified, the transactions that were saved
+ #[serde(rename = "transactions", skip_serializing_if = "Option::is_none")]
+ pub transactions: Option<Vec<::models::TransactionDetail>>,
+ /// If multiple transactions were specified, a list of import_ids that were not created because of an existing import_id found on the same account
+ #[serde(rename = "duplicate_import_ids", skip_serializing_if = "Option::is_none")]
+ pub duplicate_import_ids: Option<Vec<String>>,
+ /// The knowledge of the server
+ #[serde(rename = "server_knowledge")]
+ pub server_knowledge: i64,
+}
+
+impl SaveTransactionsResponseData {
+ pub fn new(transaction_ids: Vec<String>, server_knowledge: i64) -> SaveTransactionsResponseData {
+ SaveTransactionsResponseData {
+ transaction_ids: transaction_ids,
+ transaction: None,
+ transactions: None,
+ duplicate_import_ids: None,
+ server_knowledge: server_knowledge,
+ }
+ }
+}
+
+
diff --git a/src/models/save_transactions_wrapper.rs b/src/models/save_transactions_wrapper.rs
new file mode 100644
index 0000000..ed49180
--- /dev/null
+++ b/src/models/save_transactions_wrapper.rs
@@ -0,0 +1,33 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct SaveTransactionsWrapper {
+ #[serde(rename = "transaction", skip_serializing_if = "Option::is_none")]
+ pub transaction: Option<::models::SaveTransaction>,
+ #[serde(rename = "transactions", skip_serializing_if = "Option::is_none")]
+ pub transactions: Option<Vec<::models::SaveTransaction>>,
+}
+
+impl SaveTransactionsWrapper {
+ pub fn new() -> SaveTransactionsWrapper {
+ SaveTransactionsWrapper {
+ transaction: None,
+ transactions: None,
+ }
+ }
+}
+
+
diff --git a/src/models/scheduled_sub_transaction.rs b/src/models/scheduled_sub_transaction.rs
new file mode 100644
index 0000000..dfc0aca
--- /dev/null
+++ b/src/models/scheduled_sub_transaction.rs
@@ -0,0 +1,54 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct ScheduledSubTransaction {
+ #[serde(rename = "id")]
+ pub id: String,
+ #[serde(rename = "scheduled_transaction_id")]
+ pub scheduled_transaction_id: String,
+ /// The scheduled subtransaction amount in milliunits format
+ #[serde(rename = "amount")]
+ pub amount: i64,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
+ #[serde(rename = "category_id")]
+ pub category_id: String,
+ /// If a transfer, the account_id which the scheduled subtransaction transfers to
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
+ /// Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+}
+
+impl ScheduledSubTransaction {
+ pub fn new(id: String, scheduled_transaction_id: String, amount: i64, category_id: String, deleted: bool) -> ScheduledSubTransaction {
+ ScheduledSubTransaction {
+ id: id,
+ scheduled_transaction_id: scheduled_transaction_id,
+ amount: amount,
+ memo: None,
+ payee_id: None,
+ category_id: category_id,
+ transfer_account_id: None,
+ deleted: deleted,
+ }
+ }
+}
+
+
diff --git a/src/models/scheduled_transaction_detail.rs b/src/models/scheduled_transaction_detail.rs
new file mode 100644
index 0000000..d86ef25
--- /dev/null
+++ b/src/models/scheduled_transaction_detail.rs
@@ -0,0 +1,128 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct ScheduledTransactionDetail {
+ #[serde(rename = "id")]
+ pub id: String,
+ /// The first date for which the Scheduled Transaction was scheduled.
+ #[serde(rename = "date_first")]
+ pub date_first: String,
+ /// The next date for which the Scheduled Transaction is scheduled.
+ #[serde(rename = "date_next")]
+ pub date_next: String,
+ #[serde(rename = "frequency")]
+ pub frequency: String,
+ /// The scheduled transaction amount in milliunits format
+ #[serde(rename = "amount")]
+ pub amount: i64,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
+ /// The scheduled transaction flag
+ #[serde(rename = "flag_color")]
+ pub flag_color: String,
+ #[serde(rename = "account_id")]
+ pub account_id: String,
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
+ #[serde(rename = "category_id")]
+ pub category_id: String,
+ /// If a transfer, the account_id which the scheduled transaction transfers to
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
+ /// Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+ #[serde(rename = "account_name")]
+ pub account_name: String,
+ #[serde(rename = "payee_name")]
+ pub payee_name: String,
+ #[serde(rename = "category_name")]
+ pub category_name: String,
+ /// If a split scheduled transaction, the subtransactions.
+ #[serde(rename = "subtransactions")]
+ pub subtransactions: Vec<::models::ScheduledSubTransaction>,
+}
+
+impl ScheduledTransactionDetail {
+ pub fn new(id: String, date_first: String, date_next: String, frequency: String, amount: i64, flag_color: String, account_id: String, category_id: String, deleted: bool, account_name: String, payee_name: String, category_name: String, subtransactions: Vec<::models::ScheduledSubTransaction>) -> ScheduledTransactionDetail {
+ ScheduledTransactionDetail {
+ id: id,
+ date_first: date_first,
+ date_next: date_next,
+ frequency: frequency,
+ amount: amount,
+ memo: None,
+ flag_color: flag_color,
+ account_id: account_id,
+ payee_id: None,
+ category_id: category_id,
+ transfer_account_id: None,
+ deleted: deleted,
+ account_name: account_name,
+ payee_name: payee_name,
+ category_name: category_name,
+ subtransactions: subtransactions,
+ }
+ }
+}
+
+///
+#[derive(Debug, 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, 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
new file mode 100644
index 0000000..cf7e6c7
--- /dev/null
+++ b/src/models/scheduled_transaction_detail_all_of.rs
@@ -0,0 +1,40 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct ScheduledTransactionDetailAllOf {
+ #[serde(rename = "account_name")]
+ pub account_name: String,
+ #[serde(rename = "payee_name")]
+ pub payee_name: String,
+ #[serde(rename = "category_name")]
+ pub category_name: String,
+ /// If a split scheduled transaction, the subtransactions.
+ #[serde(rename = "subtransactions")]
+ pub subtransactions: Vec<::models::ScheduledSubTransaction>,
+}
+
+impl ScheduledTransactionDetailAllOf {
+ pub fn new(account_name: String, payee_name: String, category_name: String, subtransactions: Vec<::models::ScheduledSubTransaction>) -> ScheduledTransactionDetailAllOf {
+ ScheduledTransactionDetailAllOf {
+ account_name: account_name,
+ payee_name: payee_name,
+ category_name: category_name,
+ subtransactions: subtransactions,
+ }
+ }
+}
+
+
diff --git a/src/models/scheduled_transaction_response.rs b/src/models/scheduled_transaction_response.rs
new file mode 100644
index 0000000..25286cd
--- /dev/null
+++ b/src/models/scheduled_transaction_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct ScheduledTransactionResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::ScheduledTransactionResponseData,
+}
+
+impl ScheduledTransactionResponse {
+ pub fn new(data: ::models::ScheduledTransactionResponseData) -> ScheduledTransactionResponse {
+ ScheduledTransactionResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/scheduled_transaction_response_data.rs b/src/models/scheduled_transaction_response_data.rs
new file mode 100644
index 0000000..70db916
--- /dev/null
+++ b/src/models/scheduled_transaction_response_data.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct ScheduledTransactionResponseData {
+ #[serde(rename = "scheduled_transaction")]
+ pub scheduled_transaction: ::models::ScheduledTransactionDetail,
+}
+
+impl ScheduledTransactionResponseData {
+ pub fn new(scheduled_transaction: ::models::ScheduledTransactionDetail) -> ScheduledTransactionResponseData {
+ ScheduledTransactionResponseData {
+ scheduled_transaction: scheduled_transaction,
+ }
+ }
+}
+
+
diff --git a/src/models/scheduled_transaction_summary.rs b/src/models/scheduled_transaction_summary.rs
new file mode 100644
index 0000000..7966d2c
--- /dev/null
+++ b/src/models/scheduled_transaction_summary.rs
@@ -0,0 +1,115 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct ScheduledTransactionSummary {
+ #[serde(rename = "id")]
+ pub id: String,
+ /// The first date for which the Scheduled Transaction was scheduled.
+ #[serde(rename = "date_first")]
+ pub date_first: String,
+ /// The next date for which the Scheduled Transaction is scheduled.
+ #[serde(rename = "date_next")]
+ pub date_next: String,
+ #[serde(rename = "frequency")]
+ pub frequency: String,
+ /// The scheduled transaction amount in milliunits format
+ #[serde(rename = "amount")]
+ pub amount: i64,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
+ /// The scheduled transaction flag
+ #[serde(rename = "flag_color")]
+ pub flag_color: String,
+ #[serde(rename = "account_id")]
+ pub account_id: String,
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
+ #[serde(rename = "category_id")]
+ pub category_id: String,
+ /// If a transfer, the account_id which the scheduled transaction transfers to
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
+ /// Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+}
+
+impl ScheduledTransactionSummary {
+ pub fn new(id: String, date_first: String, date_next: String, frequency: String, amount: i64, flag_color: String, account_id: String, category_id: String, deleted: bool) -> ScheduledTransactionSummary {
+ ScheduledTransactionSummary {
+ id: id,
+ date_first: date_first,
+ date_next: date_next,
+ frequency: frequency,
+ amount: amount,
+ memo: None,
+ flag_color: flag_color,
+ account_id: account_id,
+ payee_id: None,
+ category_id: category_id,
+ transfer_account_id: None,
+ deleted: deleted,
+ }
+ }
+}
+
+///
+#[derive(Debug, 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, 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
new file mode 100644
index 0000000..8ff8378
--- /dev/null
+++ b/src/models/scheduled_transactions_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct ScheduledTransactionsResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::ScheduledTransactionsResponseData,
+}
+
+impl ScheduledTransactionsResponse {
+ pub fn new(data: ::models::ScheduledTransactionsResponseData) -> ScheduledTransactionsResponse {
+ ScheduledTransactionsResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/scheduled_transactions_response_data.rs b/src/models/scheduled_transactions_response_data.rs
new file mode 100644
index 0000000..71e5c79
--- /dev/null
+++ b/src/models/scheduled_transactions_response_data.rs
@@ -0,0 +1,34 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct ScheduledTransactionsResponseData {
+ #[serde(rename = "scheduled_transactions")]
+ pub scheduled_transactions: Vec<::models::ScheduledTransactionDetail>,
+ /// The knowledge of the server
+ #[serde(rename = "server_knowledge")]
+ pub server_knowledge: i64,
+}
+
+impl ScheduledTransactionsResponseData {
+ pub fn new(scheduled_transactions: Vec<::models::ScheduledTransactionDetail>, server_knowledge: i64) -> ScheduledTransactionsResponseData {
+ ScheduledTransactionsResponseData {
+ scheduled_transactions: scheduled_transactions,
+ server_knowledge: server_knowledge,
+ }
+ }
+}
+
+
diff --git a/src/models/sub_transaction.rs b/src/models/sub_transaction.rs
new file mode 100644
index 0000000..633ae38
--- /dev/null
+++ b/src/models/sub_transaction.rs
@@ -0,0 +1,54 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct SubTransaction {
+ #[serde(rename = "id")]
+ pub id: String,
+ #[serde(rename = "transaction_id")]
+ pub transaction_id: String,
+ /// The subtransaction amount in milliunits format
+ #[serde(rename = "amount")]
+ pub amount: i64,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
+ #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
+ pub category_id: Option<String>,
+ /// If a transfer, the account_id which the subtransaction transfers to
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
+ /// Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+}
+
+impl SubTransaction {
+ pub fn new(id: String, transaction_id: String, amount: i64, deleted: bool) -> SubTransaction {
+ SubTransaction {
+ id: id,
+ transaction_id: transaction_id,
+ amount: amount,
+ memo: None,
+ payee_id: None,
+ category_id: None,
+ transfer_account_id: None,
+ deleted: deleted,
+ }
+ }
+}
+
+
diff --git a/src/models/transaction_detail.rs b/src/models/transaction_detail.rs
new file mode 100644
index 0000000..956eae9
--- /dev/null
+++ b/src/models/transaction_detail.rs
@@ -0,0 +1,121 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct TransactionDetail {
+ #[serde(rename = "id")]
+ pub id: String,
+ /// The transaction date in ISO format (e.g. 2016-12-01)
+ #[serde(rename = "date")]
+ pub date: String,
+ /// The transaction amount in milliunits format
+ #[serde(rename = "amount")]
+ pub amount: i64,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
+ /// The cleared status of the transaction
+ #[serde(rename = "cleared")]
+ pub cleared: String,
+ /// 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<String>,
+ #[serde(rename = "account_id")]
+ pub account_id: String,
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
+ #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
+ pub category_id: Option<String>,
+ /// If a transfer transaction, the account to which it transfers
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
+ /// If a transfer transaction, the id of transaction on the other side of the transfer
+ #[serde(rename = "transfer_transaction_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_transaction_id: Option<String>,
+ /// If transaction is matched, the id of the matched transaction
+ #[serde(rename = "matched_transaction_id", skip_serializing_if = "Option::is_none")]
+ pub matched_transaction_id: Option<String>,
+ /// If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'.
+ #[serde(rename = "import_id", skip_serializing_if = "Option::is_none")]
+ pub import_id: Option<String>,
+ /// Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+ #[serde(rename = "account_name")]
+ pub account_name: String,
+ #[serde(rename = "payee_name", skip_serializing_if = "Option::is_none")]
+ pub payee_name: Option<String>,
+ #[serde(rename = "category_name", skip_serializing_if = "Option::is_none")]
+ pub category_name: Option<String>,
+ /// If a split transaction, the subtransactions.
+ #[serde(rename = "subtransactions")]
+ pub subtransactions: Vec<::models::SubTransaction>,
+}
+
+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<::models::SubTransaction>) -> TransactionDetail {
+ TransactionDetail {
+ id: id,
+ date: date,
+ amount: amount,
+ memo: None,
+ cleared: cleared,
+ approved: approved,
+ flag_color: None,
+ 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,
+ payee_name: None,
+ category_name: None,
+ subtransactions: subtransactions,
+ }
+ }
+}
+
+/// The cleared status of the transaction
+#[derive(Debug, Serialize, Deserialize)]
+pub enum Cleared {
+ #[serde(rename = "cleared")]
+ Cleared,
+ #[serde(rename = "uncleared")]
+ Uncleared,
+ #[serde(rename = "reconciled")]
+ Reconciled,
+}
+/// The transaction flag
+#[derive(Debug, 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
new file mode 100644
index 0000000..cead8f5
--- /dev/null
+++ b/src/models/transaction_detail_all_of.rs
@@ -0,0 +1,40 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct TransactionDetailAllOf {
+ #[serde(rename = "account_name")]
+ pub account_name: String,
+ #[serde(rename = "payee_name", skip_serializing_if = "Option::is_none")]
+ pub payee_name: Option<String>,
+ #[serde(rename = "category_name", skip_serializing_if = "Option::is_none")]
+ pub category_name: Option<String>,
+ /// If a split transaction, the subtransactions.
+ #[serde(rename = "subtransactions")]
+ pub subtransactions: Vec<::models::SubTransaction>,
+}
+
+impl TransactionDetailAllOf {
+ pub fn new(account_name: String, subtransactions: Vec<::models::SubTransaction>) -> TransactionDetailAllOf {
+ TransactionDetailAllOf {
+ account_name: account_name,
+ payee_name: None,
+ category_name: None,
+ subtransactions: subtransactions,
+ }
+ }
+}
+
+
diff --git a/src/models/transaction_response.rs b/src/models/transaction_response.rs
new file mode 100644
index 0000000..cc65780
--- /dev/null
+++ b/src/models/transaction_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct TransactionResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::TransactionResponseData,
+}
+
+impl TransactionResponse {
+ pub fn new(data: ::models::TransactionResponseData) -> TransactionResponse {
+ TransactionResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/transaction_response_data.rs b/src/models/transaction_response_data.rs
new file mode 100644
index 0000000..5f96108
--- /dev/null
+++ b/src/models/transaction_response_data.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct TransactionResponseData {
+ #[serde(rename = "transaction")]
+ pub transaction: ::models::TransactionDetail,
+}
+
+impl TransactionResponseData {
+ pub fn new(transaction: ::models::TransactionDetail) -> TransactionResponseData {
+ TransactionResponseData {
+ transaction: transaction,
+ }
+ }
+}
+
+
diff --git a/src/models/transaction_summary.rs b/src/models/transaction_summary.rs
new file mode 100644
index 0000000..94ce164
--- /dev/null
+++ b/src/models/transaction_summary.rs
@@ -0,0 +1,108 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct TransactionSummary {
+ #[serde(rename = "id")]
+ pub id: String,
+ /// The transaction date in ISO format (e.g. 2016-12-01)
+ #[serde(rename = "date")]
+ pub date: String,
+ /// The transaction amount in milliunits format
+ #[serde(rename = "amount")]
+ pub amount: i64,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
+ /// The cleared status of the transaction
+ #[serde(rename = "cleared")]
+ pub cleared: String,
+ /// 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<String>,
+ #[serde(rename = "account_id")]
+ pub account_id: String,
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
+ #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
+ pub category_id: Option<String>,
+ /// If a transfer transaction, the account to which it transfers
+ #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_account_id: Option<String>,
+ /// If a transfer transaction, the id of transaction on the other side of the transfer
+ #[serde(rename = "transfer_transaction_id", skip_serializing_if = "Option::is_none")]
+ pub transfer_transaction_id: Option<String>,
+ /// If transaction is matched, the id of the matched transaction
+ #[serde(rename = "matched_transaction_id", skip_serializing_if = "Option::is_none")]
+ pub matched_transaction_id: Option<String>,
+ /// If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'.
+ #[serde(rename = "import_id", skip_serializing_if = "Option::is_none")]
+ pub import_id: Option<String>,
+ /// Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests.
+ #[serde(rename = "deleted")]
+ pub deleted: bool,
+}
+
+impl TransactionSummary {
+ pub fn new(id: String, date: String, amount: i64, cleared: String, approved: bool, account_id: String, deleted: bool) -> TransactionSummary {
+ TransactionSummary {
+ id: id,
+ date: date,
+ amount: amount,
+ memo: None,
+ cleared: cleared,
+ approved: approved,
+ flag_color: None,
+ 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,
+ }
+ }
+}
+
+/// The cleared status of the transaction
+#[derive(Debug, Serialize, Deserialize)]
+pub enum Cleared {
+ #[serde(rename = "cleared")]
+ Cleared,
+ #[serde(rename = "uncleared")]
+ Uncleared,
+ #[serde(rename = "reconciled")]
+ Reconciled,
+}
+/// The transaction flag
+#[derive(Debug, 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
new file mode 100644
index 0000000..cda3c1f
--- /dev/null
+++ b/src/models/transactions_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct TransactionsResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::TransactionsResponseData,
+}
+
+impl TransactionsResponse {
+ pub fn new(data: ::models::TransactionsResponseData) -> TransactionsResponse {
+ TransactionsResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/transactions_response_data.rs b/src/models/transactions_response_data.rs
new file mode 100644
index 0000000..4ac9438
--- /dev/null
+++ b/src/models/transactions_response_data.rs
@@ -0,0 +1,34 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct TransactionsResponseData {
+ #[serde(rename = "transactions")]
+ pub transactions: Vec<::models::TransactionDetail>,
+ /// The knowledge of the server
+ #[serde(rename = "server_knowledge")]
+ pub server_knowledge: i64,
+}
+
+impl TransactionsResponseData {
+ pub fn new(transactions: Vec<::models::TransactionDetail>, server_knowledge: i64) -> TransactionsResponseData {
+ TransactionsResponseData {
+ transactions: transactions,
+ server_knowledge: server_knowledge,
+ }
+ }
+}
+
+
diff --git a/src/models/update_transaction.rs b/src/models/update_transaction.rs
new file mode 100644
index 0000000..5e93837
--- /dev/null
+++ b/src/models/update_transaction.rs
@@ -0,0 +1,98 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct UpdateTransaction {
+ #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
+ pub id: Option<String>,
+ #[serde(rename = "account_id")]
+ pub account_id: String,
+ /// The transaction date in ISO format (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored.
+ #[serde(rename = "date")]
+ pub date: String,
+ /// The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored.
+ #[serde(rename = "amount")]
+ pub amount: i64,
+ /// The payee for the transaction
+ #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
+ pub payee_id: Option<String>,
+ /// The payee name. If a payee_name value is provided and payee_id has a null value, the payee_name value will be used to resolve the payee by either (1) a matching payee rename rule (only if import_id is also specified) or (2) a payee with the same name or (3) creation of a new payee.
+ #[serde(rename = "payee_name", skip_serializing_if = "Option::is_none")]
+ pub payee_name: Option<String>,
+ /// The category for the transaction. Split and Credit Card Payment categories are not permitted and will be ignored if supplied. If an existing transaction has a Split category it cannot be changed.
+ #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
+ pub category_id: Option<String>,
+ #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
+ pub memo: Option<String>,
+ /// The cleared status of the transaction
+ #[serde(rename = "cleared", skip_serializing_if = "Option::is_none")]
+ pub cleared: Option<String>,
+ /// 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<bool>,
+ /// The transaction flag
+ #[serde(rename = "flag_color", skip_serializing_if = "Option::is_none")]
+ pub flag_color: Option<String>,
+ /// If specified, the new transaction will be assigned this import_id and considered \"imported\". *At the time of import* we will attempt to match \"imported\" transactions with non-imported (i.e. \"user-entered\") transactions.<br><br>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.<br><br>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<String>,
+}
+
+impl UpdateTransaction {
+ pub fn new(account_id: String, date: String, amount: i64) -> UpdateTransaction {
+ UpdateTransaction {
+ id: None,
+ account_id: account_id,
+ date: date,
+ amount: amount,
+ payee_id: None,
+ payee_name: None,
+ category_id: None,
+ memo: None,
+ cleared: None,
+ approved: None,
+ flag_color: None,
+ import_id: None,
+ }
+ }
+}
+
+/// The cleared status of the transaction
+#[derive(Debug, Serialize, Deserialize)]
+pub enum Cleared {
+ #[serde(rename = "cleared")]
+ Cleared,
+ #[serde(rename = "uncleared")]
+ Uncleared,
+ #[serde(rename = "reconciled")]
+ Reconciled,
+}
+/// The transaction flag
+#[derive(Debug, 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_wrapper.rs b/src/models/update_transaction_wrapper.rs
new file mode 100644
index 0000000..5c34fbb
--- /dev/null
+++ b/src/models/update_transaction_wrapper.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct UpdateTransactionWrapper {
+ #[serde(rename = "transaction")]
+ pub transaction: ::models::UpdateTransaction,
+}
+
+impl UpdateTransactionWrapper {
+ pub fn new(transaction: ::models::UpdateTransaction) -> UpdateTransactionWrapper {
+ UpdateTransactionWrapper {
+ transaction: transaction,
+ }
+ }
+}
+
+
diff --git a/src/models/update_transactions_response.rs b/src/models/update_transactions_response.rs
new file mode 100644
index 0000000..c56d2b3
--- /dev/null
+++ b/src/models/update_transactions_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct UpdateTransactionsResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::SaveTransactionsResponseData,
+}
+
+impl UpdateTransactionsResponse {
+ pub fn new(data: ::models::SaveTransactionsResponseData) -> UpdateTransactionsResponse {
+ UpdateTransactionsResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/update_transactions_wrapper.rs b/src/models/update_transactions_wrapper.rs
new file mode 100644
index 0000000..810d054
--- /dev/null
+++ b/src/models/update_transactions_wrapper.rs
@@ -0,0 +1,33 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct UpdateTransactionsWrapper {
+ #[serde(rename = "transaction", skip_serializing_if = "Option::is_none")]
+ pub transaction: Option<::models::UpdateTransaction>,
+ #[serde(rename = "transactions", skip_serializing_if = "Option::is_none")]
+ pub transactions: Option<Vec<::models::UpdateTransaction>>,
+}
+
+impl UpdateTransactionsWrapper {
+ pub fn new() -> UpdateTransactionsWrapper {
+ UpdateTransactionsWrapper {
+ transaction: None,
+ transactions: None,
+ }
+ }
+}
+
+
diff --git a/src/models/user.rs b/src/models/user.rs
new file mode 100644
index 0000000..8143284
--- /dev/null
+++ b/src/models/user.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct User {
+ #[serde(rename = "id")]
+ pub id: String,
+}
+
+impl User {
+ pub fn new(id: String) -> User {
+ User {
+ id: id,
+ }
+ }
+}
+
+
diff --git a/src/models/user_response.rs b/src/models/user_response.rs
new file mode 100644
index 0000000..e2427e0
--- /dev/null
+++ b/src/models/user_response.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct UserResponse {
+ #[serde(rename = "data")]
+ pub data: ::models::UserResponseData,
+}
+
+impl UserResponse {
+ pub fn new(data: ::models::UserResponseData) -> UserResponse {
+ UserResponse {
+ data: data,
+ }
+ }
+}
+
+
diff --git a/src/models/user_response_data.rs b/src/models/user_response_data.rs
new file mode 100644
index 0000000..9fc30f8
--- /dev/null
+++ b/src/models/user_response_data.rs
@@ -0,0 +1,30 @@
+/*
+ * YNAB API Endpoints
+ *
+ * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://openapi-generator.tech
+ */
+
+
+#[allow(unused_imports)]
+use serde_json::Value;
+
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct UserResponseData {
+ #[serde(rename = "user")]
+ pub user: ::models::User,
+}
+
+impl UserResponseData {
+ pub fn new(user: ::models::User) -> UserResponseData {
+ UserResponseData {
+ user: user,
+ }
+ }
+}
+
+
diff --git a/src/paths.rs b/src/paths.rs
deleted file mode 100644
index f53bef5..0000000
--- a/src/paths.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-use snafu::{OptionExt, ResultExt};
-use std::io::Read;
-
-#[derive(Debug, snafu::Snafu)]
-pub enum Error {
- #[snafu(display("couldn't find config path for project {}", name))]
- FindConfigDir { name: String },
-
- #[snafu(display(
- "couldn't open file {}: {}",
- file.to_string_lossy(),
- source
- ))]
- OpenFile {
- file: std::path::PathBuf,
- source: std::io::Error,
- },
-
- #[snafu(display(
- "couldn't read file {}: {}",
- file.to_string_lossy(),
- source
- ))]
- ReadFile {
- file: std::path::PathBuf,
- source: std::io::Error,
- },
-}
-
-pub type Result<T> = std::result::Result<T, Error>;
-
-const PROJECT_NAME: &str = "ynab";
-
-pub fn api_key() -> Result<std::path::PathBuf> {
- Ok(directories::ProjectDirs::from("", "", PROJECT_NAME)
- .with_context(|| FindConfigDir {
- name: PROJECT_NAME.to_string(),
- })?
- .config_dir()
- .join("api-key"))
-}
-
-pub fn read_api_key() -> Result<String> {
- let mut key = String::new();
- let key_file = api_key()?;
- std::fs::File::open(key_file.clone())
- .with_context(|| OpenFile {
- file: key_file.clone(),
- })?
- .read_to_string(&mut key)
- .with_context(|| ReadFile {
- file: key_file.clone(),
- })?;
- let key = key.trim();
- Ok(key.to_string())
-}
diff --git a/src/views.rs b/src/views.rs
deleted file mode 100644
index 6129e53..0000000
--- a/src/views.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-mod txn_table;
-mod txn_tables;
-mod util;
-
-pub use txn_tables::TxnTables;
diff --git a/src/views/txn_table.rs b/src/views/txn_table.rs
deleted file mode 100644
index b71a92e..0000000
--- a/src/views/txn_table.rs
+++ /dev/null
@@ -1,151 +0,0 @@
-use cursive::view::{Identifiable, View, ViewWrapper};
-
-#[derive(Clone, Copy, Eq, Hash, PartialEq)]
-pub enum TxnColumn {
- Selected,
- Date,
- Account,
- Payee,
- Amount,
- TotalAmount,
-}
-
-pub type TxnTableView =
- cursive_table_view::TableView<crate::ynab::Transaction, TxnColumn>;
-pub struct TxnTable {
- view: super::util::FullView<TxnTableView>,
-}
-
-impl cursive::view::ViewWrapper for TxnTable {
- cursive::wrap_impl!(self.view: super::util::FullView<TxnTableView>);
-}
-
-impl TxnTable {
- pub fn new(
- txns: Vec<crate::ynab::Transaction>,
- id: &'static str,
- ) -> Self {
- let mut table = cursive_table_view::TableView::new()
- .column(TxnColumn::Selected, "Sel", |c| c.width(3))
- .column(TxnColumn::Date, "Date", |c| c.width(10))
- .column(TxnColumn::Account, "Account", |c| c.width(15))
- .column(TxnColumn::Payee, "Payee", |c| c)
- .column(TxnColumn::Amount, "Amount", |c| {
- c.align(cursive::align::HAlign::Right).width(10)
- })
- .column(TxnColumn::TotalAmount, "", |c| {
- c.align(cursive::align::HAlign::Right).width(10)
- })
- .default_column(TxnColumn::Date)
- .on_submit(|s, _, _| {
- s.on_event(cursive::event::Event::Key(
- cursive::event::Key::F0,
- ));
- });
- table.set_items(txns);
- let view = cursive::views::OnEventView::new(table)
- .on_event_inner(' ', |v: &mut TxnTableView, _| {
- if let Some(idx) = v.item() {
- let txn = v.borrow_item_mut(idx).unwrap();
- txn.selected = !txn.selected;
- }
- None
- })
- .on_event_inner('h', |v: &mut TxnTableView, _| {
- v.on_event(cursive::event::Event::Key(
- cursive::event::Key::Left,
- ));
- None
- })
- .on_event_inner('j', |v: &mut TxnTableView, _| {
- v.on_event(cursive::event::Event::Key(
- cursive::event::Key::Down,
- ));
- None
- })
- .on_event_inner('k', |v: &mut TxnTableView, _| {
- v.on_event(cursive::event::Event::Key(
- cursive::event::Key::Up,
- ));
- None
- })
- .on_event_inner('l', |v: &mut TxnTableView, _| {
- v.on_event(cursive::event::Event::Key(
- cursive::event::Key::Right,
- ));
- None
- })
- .on_event_inner('g', |v: &mut TxnTableView, _| {
- v.set_selected_row(0);
- None
- })
- .on_event_inner('G', |v: &mut TxnTableView, _| {
- v.set_selected_row(v.len() - 1);
- None
- })
- .with_id(id);
- TxnTable { view }
- }
-
- pub fn len(&self) -> usize {
- self.view
- .with_view(|v| v.with_view(|v| v.len()).unwrap())
- .unwrap()
- }
-
- // XXX why does borrow_items require &mut self?
- pub fn amount(&mut self) -> i64 {
- self.view
- .get_mut()
- .get_inner_mut()
- .borrow_items()
- .iter()
- .map(|t| t.amount)
- .sum()
- }
-}
-
-impl cursive_table_view::TableViewItem<TxnColumn>
- for crate::ynab::Transaction
-{
- fn to_column(&self, column: TxnColumn) -> String {
- match column {
- TxnColumn::Selected => {
- if self.selected {
- "[x]".to_string()
- } else {
- "[ ]".to_string()
- }
- }
- TxnColumn::Date => self.date.clone(),
- TxnColumn::Account => {
- self.account.clone().unwrap_or_else(|| "".to_string())
- }
- TxnColumn::Payee => {
- self.payee.clone().unwrap_or_else(|| "".to_string())
- }
- TxnColumn::Amount => crate::ynab::format_amount(self.amount),
- TxnColumn::TotalAmount => {
- if self.amount == self.total_amount {
- "".to_string()
- } else {
- crate::ynab::format_amount(self.total_amount)
- }
- }
- }
- }
-
- fn cmp(&self, other: &Self, column: TxnColumn) -> std::cmp::Ordering
- where
- Self: Sized,
- {
- match column {
- TxnColumn::Selected => std::cmp::Ordering::Equal,
- TxnColumn::Date => self.date.cmp(&other.date),
- TxnColumn::Account => self.account.cmp(&other.account),
- TxnColumn::Payee => self.payee.cmp(&other.payee),
- TxnColumn::Amount => self.amount.cmp(&other.amount),
- TxnColumn::TotalAmount => self.amount.cmp(&other.total_amount),
- }
- }
-}
diff --git a/src/views/txn_tables.rs b/src/views/txn_tables.rs
deleted file mode 100644
index 62539ac..0000000
--- a/src/views/txn_tables.rs
+++ /dev/null
@@ -1,353 +0,0 @@
-use cursive::view::{Identifiable, View};
-
-const SELECTED_TOTAL_ID: &str = "selected_total";
-const INFLOWS_TABLE_ID: &str = "inflows_table";
-const OUTFLOWS_TABLE_ID: &str = "outflows_table";
-
-pub struct TxnTables {
- view: super::util::FullView<cursive::views::LinearLayout>,
-}
-
-impl cursive::view::ViewWrapper for TxnTables {
- cursive::wrap_impl!(
- self.view: super::util::FullView<cursive::views::LinearLayout>
- );
-}
-
-impl TxnTables {
- pub fn new(id: &'static str, budget: &crate::ynab::Budget) -> Self {
- let mut layout = cursive::views::LinearLayout::vertical();
-
- layout.add_child(
- cursive::views::TextView::new("Selected: $0.00 (0 transactions)")
- .h_align(cursive::align::HAlign::Right)
- .with_id(SELECTED_TOTAL_ID),
- );
-
- let inflows = budget
- .reimbursables()
- .iter()
- .filter(|t| !t.reimbursed && t.amount > 0)
- .cloned()
- .collect();
- let mut inflows_table =
- super::txn_table::TxnTable::new(inflows, INFLOWS_TABLE_ID);
- layout.add_child(cursive::views::TextView::new(format!(
- "Inflows: {} ({} transaction{}",
- crate::ynab::format_amount(inflows_table.amount()),
- inflows_table.len(),
- if inflows_table.len() == 1 { ") " } else { "s)" }
- )));
- layout.add_child(cursive::views::CircularFocus::wrap_arrows(
- cursive::views::BoxView::with_min_height(
- std::cmp::min(std::cmp::max(inflows_table.len(), 1), 5) + 2,
- cursive::views::BoxView::with_full_width(inflows_table),
- ),
- ));
-
- layout.add_child(cursive::views::TextView::new(" "));
-
- let outflows = budget
- .reimbursables()
- .iter()
- .filter(|t| !t.reimbursed && t.amount <= 0)
- .cloned()
- .collect();
- let mut outflows_table =
- super::txn_table::TxnTable::new(outflows, OUTFLOWS_TABLE_ID);
- layout.add_child(cursive::views::TextView::new(format!(
- "Outflows: {} ({} transaction{}",
- crate::ynab::format_amount(outflows_table.amount()),
- outflows_table.len(),
- if outflows_table.len() == 1 {
- ") "
- } else {
- "s)"
- }
- )));
- layout.add_child(cursive::views::CircularFocus::wrap_arrows(
- cursive::views::BoxView::with_full_screen(outflows_table),
- ));
-
- let event_view = cursive::views::OnEventView::new(layout)
- .on_event(cursive::event::Key::F0, move |s| {
- submit(s);
- })
- .on_event('r', move |s| {
- refresh(s);
- })
- .on_pre_event_inner(' ', |v, _| select(v))
- .with_id(id);
-
- TxnTables { view: event_view }
- }
-}
-
-fn submit(s: &mut cursive::Cursive) {
- let inflows: Vec<_> = s
- .call_on_id(
- INFLOWS_TABLE_ID,
- |v: &mut cursive::views::OnEventView<
- super::txn_table::TxnTableView,
- >| {
- v.get_inner_mut()
- .borrow_items()
- .iter()
- .filter(|t| t.selected)
- .cloned()
- .collect()
- },
- )
- .unwrap();
- let outflows: Vec<_> = s
- .call_on_id(
- OUTFLOWS_TABLE_ID,
- |v: &mut cursive::views::OnEventView<
- super::txn_table::TxnTableView,
- >| {
- v.get_inner_mut()
- .borrow_items()
- .iter()
- .filter(|t| t.selected)
- .cloned()
- .collect()
- },
- )
- .unwrap();
- let total_inflow: i64 = inflows.iter().map(|t| t.amount).sum();
- let total_outflow: i64 = outflows.iter().map(|t| t.amount).sum();
- let total_amount = total_inflow + total_outflow;
- if total_amount == 0 && (inflows.len() + outflows.len() > 0) {
- let budget: &mut crate::ynab::Budget = s.user_data().unwrap();
- let txns: Vec<_> = inflows.iter().chain(outflows.iter()).collect();
- let err = budget.reconcile_transactions(&txns);
- if let Err(err) = err {
- s.add_layer(super::util::dialog(&format!("Error: {}", err)))
- } else {
- s.add_layer(super::util::dialog(&format!(
- "Successfully updated {} transactions",
- txns.len()
- )));
- s.call_on_id(
- INFLOWS_TABLE_ID,
- |v: &mut cursive::views::OnEventView<
- super::txn_table::TxnTableView,
- >| {
- let v = v.get_inner_mut();
- let all_txns = v.borrow_items_mut();
- for id in txns.iter().map(|t| t.id.clone()) {
- if let Some(idx) =
- all_txns.iter().position(|t| t.id == id)
- {
- all_txns.remove(idx);
- }
- }
- if let Some(row) = v.row() {
- if row >= v.len() {
- v.set_selected_row(v.len() - 1);
- }
- }
- },
- )
- .unwrap();
- s.call_on_id(
- OUTFLOWS_TABLE_ID,
- |v: &mut cursive::views::OnEventView<
- super::txn_table::TxnTableView,
- >| {
- let v = v.get_inner_mut();
- let all_txns = v.borrow_items_mut();
- for id in txns.iter().map(|t| t.id.clone()) {
- if let Some(idx) =
- all_txns.iter().position(|t| t.id == id)
- {
- all_txns.remove(idx);
- }
- }
- if let Some(row) = v.row() {
- if row >= v.len() {
- v.set_selected_row(v.len() - 1);
- }
- }
- },
- )
- .unwrap();
- }
- } else if total_amount != 0 {
- s.add_layer(super::util::dialog(&format!(
- "Selected amount is {}, must be 0",
- crate::ynab::format_amount(total_amount)
- )))
- }
-}
-
-fn refresh(s: &mut cursive::Cursive) {
- let budget: &mut crate::ynab::Budget = s.user_data().unwrap();
- let err = budget.refresh();
- if let Err(err) = err {
- s.add_layer(super::util::dialog(&format!("Error: {}", err)));
- return;
- }
-
- let mut inflows: Vec<_> = budget
- .reimbursables()
- .iter()
- .filter(|t| !t.reimbursed && t.amount > 0)
- .cloned()
- .collect();
- s.call_on_id(
- INFLOWS_TABLE_ID,
- |v: &mut cursive::views::OnEventView<
- super::txn_table::TxnTableView,
- >| {
- let v = v.get_inner_mut();
- let selected: std::collections::HashSet<_> = v
- .borrow_items()
- .iter()
- .filter(|t| t.selected)
- .map(|t| t.id.clone())
- .collect();
- let row = v
- .item()
- .and_then(|idx| v.borrow_item(idx).map(|t| t.id.clone()));
- for mut t in inflows.iter_mut() {
- if selected.contains(&t.id) {
- t.selected = true;
- }
- }
- let idx =
- row.and_then(|id| inflows.iter().position(|t| t.id == id));
- v.set_items(inflows);
- if let Some(idx) = idx {
- v.set_selected_item(idx);
- }
- },
- )
- .unwrap();
-
- let budget: &mut crate::ynab::Budget = s.user_data().unwrap();
- let mut outflows: Vec<_> = budget
- .reimbursables()
- .iter()
- .filter(|t| !t.reimbursed && t.amount <= 0)
- .cloned()
- .collect();
- s.call_on_id(
- OUTFLOWS_TABLE_ID,
- |v: &mut cursive::views::OnEventView<
- super::txn_table::TxnTableView,
- >| {
- let v = v.get_inner_mut();
- let selected: std::collections::HashSet<_> = v
- .borrow_items()
- .iter()
- .filter(|t| t.selected)
- .map(|t| t.id.clone())
- .collect();
- let row = v
- .item()
- .and_then(|idx| v.borrow_item(idx).map(|t| t.id.clone()));
- for mut t in outflows.iter_mut() {
- if selected.contains(&t.id) {
- t.selected = true;
- }
- }
- let idx =
- row.and_then(|id| outflows.iter().position(|t| t.id == id));
- v.set_items(outflows);
- if let Some(idx) = idx {
- v.set_selected_item(idx);
- }
- },
- )
- .unwrap();
-
- render_selected_total(s);
-}
-
-fn select(
- v: &mut cursive::views::LinearLayout,
-) -> Option<cursive::event::EventResult> {
- let idx = v.get_focus_index();
- let child = v.get_child_mut(idx).unwrap();
- child.call_on_any(
- &cursive::view::Selector::Id(INFLOWS_TABLE_ID),
- Box::new(|v| {
- v.downcast_mut::<cursive::views::IdView<
- cursive::views::OnEventView<super::txn_table::TxnTableView>,
- >>()
- .map(|v| v.on_event(cursive::event::Event::Char(' ')));
- }),
- );
- child.call_on_any(
- &cursive::view::Selector::Id(OUTFLOWS_TABLE_ID),
- Box::new(|v| {
- v.downcast_mut::<cursive::views::IdView<
- cursive::views::OnEventView<super::txn_table::TxnTableView>,
- >>()
- .map(|v| v.on_event(cursive::event::Event::Char(' ')));
- }),
- );
- Some(cursive::event::EventResult::with_cb(|s| {
- render_selected_total(s);
- }))
-}
-
-fn render_selected_total(s: &mut cursive::Cursive) {
- let inflows: Vec<_> = s
- .call_on_id(
- INFLOWS_TABLE_ID,
- |v: &mut cursive::views::OnEventView<
- super::txn_table::TxnTableView,
- >| {
- v.get_inner_mut()
- .borrow_items()
- .iter()
- .filter(|t| t.selected)
- .map(|t| t.amount)
- .collect()
- },
- )
- .unwrap();
- let outflows: Vec<_> = s
- .call_on_id(
- OUTFLOWS_TABLE_ID,
- |v: &mut cursive::views::OnEventView<
- super::txn_table::TxnTableView,
- >| {
- v.get_inner_mut()
- .borrow_items()
- .iter()
- .filter(|t| t.selected)
- .map(|t| t.amount)
- .collect()
- },
- )
- .unwrap();
- let outflow: i64 = outflows.iter().sum();
- let inflow: i64 = inflows.iter().sum();
- let amount = outflow + inflow;
- s.call_on_id(SELECTED_TOTAL_ID, |v: &mut cursive::views::TextView| {
- let mut sstr =
- cursive::utils::markup::StyledString::plain("Selected: ");
- let color = if amount == 0 && outflows.len() + inflows.len() != 0 {
- cursive::theme::Color::Dark(cursive::theme::BaseColor::Green)
- } else {
- cursive::theme::Color::TerminalDefault
- };
- sstr.append(cursive::utils::markup::StyledString::styled(
- crate::ynab::format_amount(amount),
- color,
- ));
- sstr.append(format!(
- " ({} transaction{}",
- outflows.len() + inflows.len(),
- if outflows.len() + inflows.len() == 1 {
- ") "
- } else {
- "s)"
- }
- ));
- v.set_content(sstr);
- });
-}
diff --git a/src/views/util.rs b/src/views/util.rs
deleted file mode 100644
index eb22976..0000000
--- a/src/views/util.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-pub type FullView<T> = cursive::views::IdView<cursive::views::OnEventView<T>>;
-
-pub fn dialog(s: &str) -> impl cursive::view::View {
- cursive::views::Panel::new(cursive::views::Dialog::info(s))
-}
diff --git a/src/ynab.rs b/src/ynab.rs
deleted file mode 100644
index f07d86e..0000000
--- a/src/ynab.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-mod budget;
-mod client;
-mod transaction;
-mod util;
-
-pub use budget::Budget;
-pub use budget::Error as BudgetError;
-pub use client::Client;
-pub use transaction::Transaction;
-pub use util::format_amount;
diff --git a/src/ynab/budget.rs b/src/ynab/budget.rs
deleted file mode 100644
index e3275bb..0000000
--- a/src/ynab/budget.rs
+++ /dev/null
@@ -1,216 +0,0 @@
-use snafu::{OptionExt, ResultExt};
-
-#[derive(Debug, snafu::Snafu)]
-pub enum Error {
- #[snafu(display("couldn't get default budget: {}", source))]
- GetBudget { source: super::client::Error },
-
- #[snafu(display("couldn't update transactions: {}", source))]
- UpdateTransactions { source: super::client::Error },
-
- #[snafu(display("couldn't find the reimbursables category"))]
- FindReimbursablesCategory,
-}
-
-pub type Result<T> = std::result::Result<T, Error>;
-
-pub struct Budget {
- client: super::client::Client,
- id: String,
- name: String,
- reimbursables: Vec<super::transaction::Transaction>,
-}
-
-impl Budget {
- pub fn new(key: &str) -> Result<Self> {
- let client = super::client::Client::new(key);
- let budget = client.default_budget().context(GetBudget)?;
- let reimbursables = Self::get_reimbursables(&budget)?;
- let budget = Self {
- client,
- id: budget.id.clone(),
- name: budget.name.clone(),
- reimbursables,
- };
- budget.check();
- Ok(budget)
- }
-
- #[must_use]
- pub fn refresh(&mut self) -> Result<()> {
- let budget = self.client.default_budget().context(GetBudget)?;
- self.id = budget.id.clone();
- self.name = budget.name.clone();
- self.reimbursables = Self::get_reimbursables(&budget)?;
- self.check();
- Ok(())
- }
-
- pub fn name(&self) -> String {
- self.name.clone()
- }
-
- pub fn id(&self) -> String {
- self.id.clone()
- }
-
- pub fn reimbursables(&self) -> &[super::transaction::Transaction] {
- &self.reimbursables
- }
-
- #[must_use]
- pub fn reconcile_transactions(
- &self,
- txns: &[&super::transaction::Transaction],
- ) -> Result<()> {
- let mut to_update =
- ynab_api::models::UpdateTransactionsWrapper::new();
- to_update.transactions = Some(
- txns.iter()
- .map(|t| {
- let mut ut = t.to_update_transaction();
- ut.flag_color = Some("green".to_string());
- ut
- })
- .collect(),
- );
- self.client
- .update_transactions(&self.id, to_update)
- .context(UpdateTransactions)?;
- Ok(())
- }
-
- fn get_reimbursables(
- budget: &ynab_api::models::BudgetDetail,
- ) -> Result<Vec<super::transaction::Transaction>> {
- let reimbursables_id = budget
- .categories
- .as_ref()
- .and_then(|categories| {
- categories
- .iter()
- .find(|c| c.name == "Reimbursables")
- .map(|c| c.id.clone())
- })
- .context(FindReimbursablesCategory)?;
-
- let mut payee_map = std::collections::HashMap::new();
- if let Some(payees) = &budget.payees {
- for p in payees {
- payee_map.insert(p.id.clone(), p.name.clone());
- }
- }
- let payee_map = payee_map;
-
- let mut account_map = std::collections::HashMap::new();
- if let Some(accounts) = &budget.accounts {
- for a in accounts {
- account_map.insert(a.id.clone(), a.name.clone());
- }
- }
- let account_map = account_map;
-
- let mut reimbursables = vec![];
-
- let mut transaction_map = std::collections::HashMap::new();
- if let Some(transactions) = &budget.transactions {
- for t in transactions {
- transaction_map.insert(t.id.clone(), t);
-
- if let Some(category_id) = &t.category_id {
- if category_id != &reimbursables_id {
- continue;
- }
- } else {
- continue;
- }
-
- let payee = t
- .payee_id
- .iter()
- .map(|payee_id| payee_map.get(payee_id).cloned())
- .next()
- .unwrap_or(None);
- let account = account_map.get(&t.account_id).cloned();
-
- let mut txn =
- super::transaction::Transaction::from_transaction(t);
- txn.payee = payee;
- txn.account = account;
- reimbursables.push(txn);
- }
- }
- let transaction_map = transaction_map;
-
- if let Some(subtransactions) = &budget.subtransactions {
- for st in subtransactions {
- if let Some(category_id) = &st.category_id {
- if category_id != &reimbursables_id {
- continue;
- }
- } else {
- continue;
- }
-
- let t = transaction_map[&st.transaction_id];
- let payee = st
- .payee_id
- .iter()
- .map(|payee_id| payee_map.get(payee_id).cloned())
- .next()
- .unwrap_or_else(|| {
- t.payee_id
- .iter()
- .map(|payee_id| payee_map.get(payee_id).cloned())
- .next()
- .unwrap_or(None)
- });
- let account = account_map.get(&t.account_id).cloned();
-
- let mut txn =
- super::transaction::Transaction::from_sub_transaction(
- t, st,
- );
- txn.payee = payee;
- txn.account = account;
- reimbursables.push(txn);
- }
- }
-
- reimbursables.sort_by_cached_key(|t| t.date.clone());
- Ok(reimbursables)
- }
-
- fn check(&self) {
- self.check_reconciled();
- self.check_has_inflows();
- }
-
- fn check_reconciled(&self) {
- let reconciled_amount: i64 = self
- .reimbursables()
- .iter()
- .filter(|t| t.reimbursed)
- .map(|t| t.amount)
- .sum();
- if reconciled_amount != 0 {
- eprintln!(
- "reconciled reimbursables don't sum to $0.00: ${}",
- crate::ynab::format_amount(reconciled_amount)
- );
- std::process::exit(1);
- }
- }
-
- fn check_has_inflows(&self) {
- let txns = self
- .reimbursables()
- .iter()
- .filter(|t| !t.reimbursed && t.amount > 0)
- .count();
- if txns == 0 {
- eprintln!("no transactions to reconcile");
- std::process::exit(1);
- }
- }
-}
diff --git a/src/ynab/client.rs b/src/ynab/client.rs
deleted file mode 100644
index 19b456b..0000000
--- a/src/ynab/client.rs
+++ /dev/null
@@ -1,76 +0,0 @@
-#[derive(Debug, snafu::Snafu)]
-pub enum Error {
- // ynab-api error types don't implement Error, so can't use the
- // auto-source behavior
- #[snafu(display("failed to update transactions: {}", source_msg))]
- UpdateTransactions { source_msg: String },
-
- #[snafu(display("failed to get budgets: {}", source_msg))]
- GetBudgets { source_msg: String },
-
- #[snafu(display("failed to get budget {}: {}", id, source_msg))]
- GetBudgetById { id: String, source_msg: String },
-}
-
-pub type Result<T> = std::result::Result<T, Error>;
-
-pub struct Client {
- api: ynab_api::apis::client::APIClient,
-}
-
-impl Client {
- pub fn new(key: &str) -> Self {
- let mut ynab_config =
- ynab_api::apis::configuration::Configuration::new();
- ynab_config.api_key = Some(ynab_api::apis::configuration::ApiKey {
- prefix: Some("Bearer".to_string()),
- key: key.to_string(),
- });
- Self {
- api: ynab_api::apis::client::APIClient::new(ynab_config),
- }
- }
-
- pub fn default_budget(&self) -> Result<ynab_api::models::BudgetDetail> {
- let budget_id = self
- .api
- .budgets_api()
- .get_budgets()
- .map_err(|e| Error::GetBudgets {
- source_msg: format!("{:?}", e),
- })?
- .data
- .budgets
- .iter()
- .next()
- .ok_or_else(|| Error::GetBudgets {
- source_msg: "no budgets found".to_string(),
- })?
- .id
- .clone();
- Ok(self
- .api
- .budgets_api()
- .get_budget_by_id(&budget_id, 0)
- .map_err(|e| Error::GetBudgetById {
- id: budget_id.clone(),
- source_msg: format!("{:?}", e),
- })?
- .data
- .budget)
- }
-
- pub fn update_transactions(
- &self,
- budget_id: &str,
- transactions: ynab_api::models::UpdateTransactionsWrapper,
- ) -> Result<()> {
- self.api
- .transactions_api()
- .update_transactions(budget_id, transactions)
- .map(|_| ())
- .map_err(|e| Error::UpdateTransactions {
- source_msg: format!("{:?}", e),
- })
- }
-}
diff --git a/src/ynab/transaction.rs b/src/ynab/transaction.rs
deleted file mode 100644
index be31019..0000000
--- a/src/ynab/transaction.rs
+++ /dev/null
@@ -1,101 +0,0 @@
-#[derive(Clone, Debug)]
-pub struct Transaction {
- pub id: String,
- pub date: String,
- pub amount: i64,
- pub memo: Option<String>,
- pub cleared: String,
- pub approved: bool,
- pub flag_color: Option<String>,
- pub account_id: String,
- pub payee_id: Option<String>,
- pub category_id: Option<String>,
- pub import_id: Option<String>,
-
- pub account: Option<String>,
- pub payee: Option<String>,
- pub total_amount: i64,
- pub reimbursed: bool,
- pub selected: bool,
-}
-
-impl Transaction {
- pub fn from_transaction(
- t: &ynab_api::models::TransactionSummary,
- ) -> Self {
- let reimbursed = if let Some(color) = &t.flag_color {
- color == "green"
- } else {
- false
- };
- Self {
- id: t.id.clone(),
- date: t.date.clone(),
- amount: t.amount,
- memo: t.memo.clone(),
- cleared: t.cleared.clone(),
- approved: t.approved,
- flag_color: t.flag_color.clone(),
- account_id: t.account_id.clone(),
- payee_id: t.payee_id.clone(),
- category_id: t.category_id.clone(),
- import_id: t.import_id.clone(),
-
- account: None,
- payee: None,
- total_amount: t.amount,
- reimbursed,
- selected: false,
- }
- }
-
- pub fn from_sub_transaction(
- t: &ynab_api::models::TransactionSummary,
- st: &ynab_api::models::SubTransaction,
- ) -> Self {
- let reimbursed = if let Some(color) = &t.flag_color {
- color == "green"
- } else {
- false
- };
- Self {
- id: t.id.clone(),
- date: t.date.clone(),
- amount: st.amount,
- memo: t.memo.clone(),
- cleared: t.cleared.clone(),
- approved: t.approved,
- flag_color: t.flag_color.clone(),
- account_id: t.account_id.clone(),
- payee_id: t.payee_id.clone(),
- category_id: t.category_id.clone(),
- import_id: t.import_id.clone(),
-
- account: None,
- payee: None,
- total_amount: t.amount,
- reimbursed,
- selected: false,
- }
- }
-
- pub fn to_update_transaction(
- &self,
- ) -> ynab_api::models::UpdateTransaction {
- let mut ut = ynab_api::models::UpdateTransaction::new(
- self.account_id.clone(),
- self.date.clone(),
- self.amount,
- );
- ut.id = Some(self.id.clone());
- ut.payee_id = self.payee_id.clone();
- ut.category_id = self.category_id.clone();
- ut.memo = self.memo.clone();
- ut.cleared = Some(self.cleared.clone());
- ut.approved = Some(self.approved);
- ut.flag_color = self.flag_color.clone();
- ut.import_id = self.import_id.clone();
-
- ut
- }
-}
diff --git a/src/ynab/util.rs b/src/ynab/util.rs
deleted file mode 100644
index af8a8d1..0000000
--- a/src/ynab/util.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-pub fn format_amount(amount: i64) -> String {
- let dollars = amount.abs() / 1000;
- let cents = (amount.abs() % 1000) / 10;
- let sign = if amount < 0 { "-" } else { "" };
- format!("${}{}.{:02}", sign, dollars, cents)
-}