From 4c94e5f9101c14bfc5c6989d11ea6c855c809f0b Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 14 Sep 2019 14:19:01 -0400 Subject: update openapi spec --- src/models/update_transaction.rs | 43 +++++++--------------------------------- 1 file changed, 7 insertions(+), 36 deletions(-) (limited to 'src/models/update_transaction.rs') diff --git a/src/models/update_transaction.rs b/src/models/update_transaction.rs index 5e93837..d14c8d4 100644 --- a/src/models/update_transaction.rs +++ b/src/models/update_transaction.rs @@ -9,14 +9,11 @@ */ -#[allow(unused_imports)] -use serde_json::Value; - -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateTransaction { - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, + #[serde(rename = "id")] + pub id: 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. @@ -25,7 +22,7 @@ pub struct UpdateTransaction { /// 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 + /// The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as tranfer_payee_id on the account resource. #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")] pub payee_id: Option, /// 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. @@ -45,15 +42,15 @@ pub struct UpdateTransaction { /// The transaction flag #[serde(rename = "flag_color", skip_serializing_if = "Option::is_none")] pub flag_color: Option, - /// 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.

Transactions imported through File Based Import or Direct Import (not through the API) are assigned an import_id in the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. Using a consistent format will prevent duplicates through Direct Import and File Based Import.

If import_id is omitted or specified as null, the transaction will be treated as a \"user-entered\" transaction. As such, it will be eligible to be matched against transactions later being imported (via DI, FBI, or API). + /// If specified, the new transaction will be assigned this import_id and considered \"imported\". We will also attempt to match this imported transaction to an existing \"user-entered\" transation on the same account, with the same amount, and with a date +/-10 days from the imported transaction date.

Transactions imported through File Based Import or Direct Import (not through the API) are assigned an import_id in the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. Using a consistent format will prevent duplicates through Direct Import and File Based Import.

If import_id is omitted or specified as null, the transaction will be treated as a \"user-entered\" transaction. As such, it will be eligible to be matched against transactions later being imported (via DI, FBI, or API). #[serde(rename = "import_id", skip_serializing_if = "Option::is_none")] pub import_id: Option, } impl UpdateTransaction { - pub fn new(account_id: String, date: String, amount: i64) -> UpdateTransaction { + pub fn new(id: String, account_id: String, date: String, amount: i64) -> UpdateTransaction { UpdateTransaction { - id: None, + id: id, account_id: account_id, date: date, amount: amount, @@ -69,30 +66,4 @@ impl UpdateTransaction { } } -/// 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, -} -- cgit v1.2.3-54-g00ecf