ms32035 / firefly-iii-client

Python client for Firefly III API. Please read .generator/Readme.md
19 stars 8 forks source link

Invalid value for 'first_date', must not be 'None' when updating recurrences even if 'first_date' is not None #2

Closed schwarzamir closed 4 years ago

schwarzamir commented 4 years ago

no matter what i do it keeps claiming its None, and I can't figure out why. the format I am using is the same as the model.

update = {"data": {"attributes": {"active": True,
                         "apply_rules": True,
                         "description": "",
                         "first_date": date.date(),
                         "latest_date": None,
                         "meta": None,
                         "notes": "",
                         "recurrence_repetitions": [{ "id" :  3,
                                                     "moment": "10",
                                                     "occurrences": [datetime.date(2019, 10, 10),
                                                                     datetime.date(2019, 11, 10),
                                                                     datetime.date(2019, 12, 10),
                                                                     datetime.date(2020, 1, 10),
                                                                     datetime.date(2020, 2, 10)],
                                                     "skip": 0,
                                                     "type": "monthly",
                                                     "weekend": 1}],
                         "repeat_until": None,
                         "repetitions": 0,
                         "title": "תשלום אשראי",
                         "transaction_type": "transfer",
                         "transaction_type_id": 3,
                         "transactions": [{"amount": float(re.search(r"(?<=סכום )\d{1,3}(,{0,1}\d{3})*(\.\d+)?", text)[0].replace(",","")),
                                           "currency_code": "ILS",
                                           "currency_decimal_places": 2,
                                           "currency_id": 23,
                                           "currency_symbol": "₪",
                                           "description": "mothly_י",
                                           "destination_id": 7,
                                           "destination_name": "Credit Card",
                                           "foreign_amount": None,
                                           "foreign_currency_code": None,
                                           "foreign_currency_decimal_places": None,
                                           "foreign_currency_id": None,
                                           "foreign_currency_symbol": None,
                                           "meta": [],
                                           "source_id": 1,
                                           "source_name": "Bank"}]},
                    "id": 1,
                    "type": "recurrences",
                    }}

api_instance = firefly_iii_client.RecurrencesApi(firefly_iii_client.ApiClient(configuration))
id = 1 # int | The ID of the recurring transaction.
recurrence_update = firefly_iii_client.RecurrenceUpdate(update)

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-182-6b134959f229> in <module>
----> 1 recurrence_update = firefly_iii_client.RecurrenceUpdate(update)

~/anaconda3/lib/python3.7/site-packages/firefly_iii_client/models/recurrence_update.py in __init__(self, active, apply_rules, description, first_date, nr_of_repetitions, piggy_bank_id, repeat_until, repetitions, tags, title, transactions, type)
     85         if description is not None:
     86             self.description = description
---> 87         self.first_date = first_date
     88         if nr_of_repetitions is not None:
     89             self.nr_of_repetitions = nr_of_repetitions

~/anaconda3/lib/python3.7/site-packages/firefly_iii_client/models/recurrence_update.py in first_date(self, first_date)
    186         """
    187         if first_date is None:
--> 188             raise ValueError("Invalid value for `first_date`, must not be `None`")  # noqa: E501
    189 
    190         self._first_date = first_date

ValueError: Invalid value for `first_date`, must not be `None`
ms32035 commented 4 years ago

I have regenerated the package for the latest API. You can try again. Anyways, this seems to be more like an API specification issue.