diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-07 03:57:33 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-07 03:57:33 -0500 |
commit | a942c7c8e17eb829ef1581c0b556665784f19e33 (patch) | |
tree | ff391dc8d22860009bd06f77042cb74d6eb6c1f2 /src/models/update_transaction.rs | |
parent | 4c94e5f9101c14bfc5c6989d11ea6c855c809f0b (diff) | |
download | ynab-api-a942c7c8e17eb829ef1581c0b556665784f19e33.tar.gz ynab-api-a942c7c8e17eb829ef1581c0b556665784f19e33.zip |
update openapi spec and regenerate with newer openapi-generator
the newer openapi-generator picks up fixes for optional parameters,
among other things
Diffstat (limited to 'src/models/update_transaction.rs')
-rw-r--r-- | src/models/update_transaction.rs | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/src/models/update_transaction.rs b/src/models/update_transaction.rs index d14c8d4..00b8f9b 100644 --- a/src/models/update_transaction.rs +++ b/src/models/update_transaction.rs @@ -10,6 +10,7 @@ + #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateTransaction { #[serde(rename = "id")] @@ -35,13 +36,13 @@ pub struct UpdateTransaction { pub memo: Option<String>, /// The cleared status of the transaction #[serde(rename = "cleared", skip_serializing_if = "Option::is_none")] - pub cleared: Option<String>, + pub cleared: Option<Cleared>, /// 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>, + pub flag_color: Option<FlagColor>, /// 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.<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>, @@ -50,10 +51,10 @@ pub struct UpdateTransaction { impl UpdateTransaction { pub fn new(id: String, account_id: String, date: String, amount: i64) -> UpdateTransaction { UpdateTransaction { - id: id, - account_id: account_id, - date: date, - amount: amount, + id, + account_id, + date, + amount, payee_id: None, payee_name: None, category_id: None, @@ -66,4 +67,30 @@ impl UpdateTransaction { } } +/// The cleared status of the transaction +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum Cleared { + #[serde(rename = "cleared")] + Cleared, + #[serde(rename = "uncleared")] + Uncleared, + #[serde(rename = "reconciled")] + Reconciled, +} +/// The transaction flag +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub enum FlagColor { + #[serde(rename = "red")] + Red, + #[serde(rename = "orange")] + Orange, + #[serde(rename = "yellow")] + Yellow, + #[serde(rename = "green")] + Green, + #[serde(rename = "blue")] + Blue, + #[serde(rename = "purple")] + Purple, +} |