From aa52e632b866b51d455787a96bcd2f5a63b7ac89 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 19 Aug 2019 00:19:38 -0400 Subject: move ynab-api to its own repository --- src/models/scheduled_sub_transaction.rs | 54 +++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/models/scheduled_sub_transaction.rs (limited to 'src/models/scheduled_sub_transaction.rs') 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, + #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")] + pub payee_id: Option, + #[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, + /// 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, + } + } +} + + -- cgit v1.2.3-54-g00ecf