aboutsummaryrefslogtreecommitdiffstats
path: root/src/apis
diff options
context:
space:
mode:
Diffstat (limited to 'src/apis')
-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
13 files changed, 1276 insertions, 0 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()?)
+ }
+
+}