ynab_api_async_fork/models/save_sub_transaction.rs
1/*
2 * YNAB API Endpoints
3 *
4 * 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.ynab.com
5 *
6 * The version of the OpenAPI document: 1.72.1
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12
13
14#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
15pub struct SaveSubTransaction {
16 /// The subtransaction amount in milliunits format.
17 #[serde(rename = "amount")]
18 pub amount: i64,
19 /// The payee for the subtransaction.
20 #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
21 pub payee_id: Option<String>,
22 /// 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 on parent transaction) or (2) a payee with the same name or (3) creation of a new payee.
23 #[serde(rename = "payee_name", skip_serializing_if = "Option::is_none")]
24 pub payee_name: Option<String>,
25 /// The category for the subtransaction. Credit Card Payment categories are not permitted and will be ignored if supplied.
26 #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
27 pub category_id: Option<String>,
28 #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
29 pub memo: Option<String>,
30}
31
32impl SaveSubTransaction {
33 pub fn new(amount: i64) -> SaveSubTransaction {
34 SaveSubTransaction {
35 amount,
36 payee_id: None,
37 payee_name: None,
38 category_id: None,
39 memo: None,
40 }
41 }
42}
43
44