diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..be67565 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,42 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python application + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + pip install pytest-cov + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest --cov=./ --cov-report=xml + + - name: Codecov + uses: codecov/codecov-action@v2.1.0 + with: + files: ./coverage.xml diff --git a/.gitignore b/.gitignore index be2ff05..110a108 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,18 @@ personal_api_settings.py .vscode/* *.csv -ynab/models/__pycache__/* -ynab/ynab/__pycache__/* -ynab/__pycache__/* +*/*/*/__pycache__/* +*/__pycache__/* __pycache__/* api_settings.py -api_settings.py sync_accounts.1.py bash_script.sh api_settings_temp.py +log/* +*.log +transacti* +statement* +workspace* +secret* +coverage.xml +.coverage diff --git a/GetPaymentsOneAccount.py b/GetPaymentsOneAccount.py index 2aed826..f0751a0 100644 --- a/GetPaymentsOneAccount.py +++ b/GetPaymentsOneAccount.py @@ -2,51 +2,32 @@ # https://support.youneedabudget.com/t/y72kjg import csv -from Helpers import create_authenticated_http_session,get_accounts,get_standing_orders,get_payments,get_transactions,getTransactionDate,getPayee,getMemo, getOut, getIn, getPaymentsDate - -def getAccount(http_session, customerId, accountNo): - accounts = get_accounts( - http_session, - customerId) - - for account in accounts: - if account['accountNumber'] == accountNo: - return account - - return None - +from sbanken.Sbanken import Sbanken +from helpers.Helpers import getPaymentsDate, getAccounts def main(): # enable_debug_logging() import api_settings import pprint - http_session = create_authenticated_http_session(api_settings.CLIENTID, api_settings.SECRET) + sbanken = Sbanken(api_settings.CUSTOMERID, api_settings.CLIENTID, api_settings.SECRET) - # customer_info = get_customer_information(http_session, api_settings.CUSTOMERID) + # customer_info = sbanken.GetCustomerInfo() # pprint.pprint(customer_info) # pprint.pprint(accounts) - # accountNo = input('What is the account number:') - accountNo = '97104496257' - account = getAccount(http_session, api_settings.CUSTOMERID, accountNo) + accountNo = input('What is the account number:') + account = getAccounts(sbanken, accountNo) if account == None: print('Account not found!') exit(1) - # stOrders = get_standing_orders( - # http_session, - # api_settings.CUSTOMERID, - # account['accountId'] - # ) + # stOrders = sbanken.GetStandingOrders(account['accountId']) # pprint.pprint(stOrders) - payments = get_payments( - http_session, - api_settings.CUSTOMERID, - account['accountId']) + payments = sbanken.GetPayments(account['accountId']) # pprint.pprint(payments) with open(account['name']+'_'+account['accountNumber']+'_Payments.csv', 'w', encoding='utf-8') as csvfile: diff --git a/GetStatementOneAccount.py b/GetStatementOneAccount.py index 95de2f8..3a38c1c 100644 --- a/GetStatementOneAccount.py +++ b/GetStatementOneAccount.py @@ -1,16 +1,6 @@ import csv -from Helpers import create_authenticated_http_session,get_accounts,get_transactions,getTransactionDate,getPayee,getMemo, getOut, getIn - -def getAccount(http_session, customerId, accountNo): - accounts = get_accounts( - http_session, - customerId) - - for account in accounts: - if account['accountNumber'] == accountNo: - return account - - return None +from sbanken.Sbanken import Sbanken +from helpers.Helpers import getAccounts, getTransactionDate, getPayee, getMemo, getOut, getIn def main(): @@ -18,15 +8,10 @@ def main(): import api_settings import pprint - http_session = create_authenticated_http_session(api_settings.CLIENTID, api_settings.SECRET) - - # customer_info = get_customer_information(http_session, api_settings.CUSTOMERID) - # pprint.pprint(customer_info) - - # pprint.pprint(accounts) + sbanken = Sbanken(api_settings.CUSTOMERID, api_settings.CLIENTID, api_settings.SECRET) accountNo = input('What is the account number:') - account = getAccount(http_session, api_settings.CUSTOMERID, accountNo) + account = getAccounts(sbanken, accountNo) if account == None: print('Account not found!') @@ -39,11 +24,7 @@ def main(): if months > 12: months = 12 - transactions = get_transactions( - http_session, - api_settings.CUSTOMERID, - account['accountId'], - months) + transactions = sbanken.GetTransactions(account['accountId'],months) # pprint.pprint(transactions) with open(account['name']+'_'+account['accountNumber']+'.csv', 'w', encoding='utf-8') as csvfile: diff --git a/GetStatementOneYear.py b/GetStatementOneYear.py index 34219c4..c1d255e 100644 --- a/GetStatementOneYear.py +++ b/GetStatementOneYear.py @@ -1,32 +1,16 @@ import csv -from Helpers import get_transactions_year,create_authenticated_http_session,get_accounts,get_transactions,getTransactionDate,getPayee,getMemo, getOut, getIn - -def getAccount(http_session, customerId, accountNo): - accounts = get_accounts( - http_session, - customerId) - - for account in accounts: - if account['accountNumber'] == accountNo: - return account - - return None - +from sbanken.Sbanken import Sbanken +from helpers.Helpers import getAccounts, getTransactionDate,getPayee,getMemo, getOut, getIn def main(): # enable_debug_logging() import api_settings import pprint - http_session = create_authenticated_http_session(api_settings.CLIENTID, api_settings.SECRET) - - # customer_info = get_customer_information(http_session, api_settings.CUSTOMERID) - # pprint.pprint(customer_info) - - # pprint.pprint(accounts) + sbanken = Sbanken(api_settings.CUSTOMERID, api_settings.CLIENTID, api_settings.SECRET) accountNo = input('What is the account number:') - account = getAccount(http_session, api_settings.CUSTOMERID, accountNo) + account = getAccounts(sbanken, accountNo) if account == None: print('Account not found!') @@ -34,17 +18,13 @@ def main(): year = input('What year?') if year == '': - year = 2019 + year = 2020 year = int(year) if year < 2000: - year = 2019 + year = 2020 - transactions = get_transactions_year( - http_session, - api_settings.CUSTOMERID, - account['accountId'], - year) + transactions = sbanken.GetTransactionsForYear(account['accountId'],year) # pprint.pprint(transactions) with open(account['name']+'_'+account['accountNumber']+'.csv', 'w', encoding='utf-8') as csvfile: diff --git a/GetStatementsAllAccounts.py b/GetStatementsAllAccounts.py index 2b72526..d18c8ce 100644 --- a/GetStatementsAllAccounts.py +++ b/GetStatementsAllAccounts.py @@ -1,5 +1,6 @@ import csv -from Helpers import * +from sbanken.Sbanken import Sbanken +from helpers.Helpers import getAccounts, getTransactionDate, getPayee, getMemo, getOut, getIn def main(): @@ -7,20 +8,13 @@ def main(): import api_settings import pprint - http_session = create_authenticated_http_session(api_settings.CLIENTID, api_settings.SECRET) - - accounts = get_accounts( - http_session, - api_settings.CUSTOMERID) + sbanken = Sbanken(api_settings.CUSTOMERID, api_settings.CLIENTID, api_settings.SECRET) + accounts = getAccounts(sbanken) for account in accounts: - transactions = get_transactions( - http_session, - api_settings.CUSTOMERID, - account['accountId'], - 1) + transactions = sbanken.GetTransactions(account['accountId'],1) # pprint.pprint(transactions) with open(account['name']+'_'+account['accountNumber']+'.csv', 'w', encoding='utf-8') as csvfile: diff --git a/Helpers_test.py b/Helpers_test.py new file mode 100644 index 0000000..840856c --- /dev/null +++ b/Helpers_test.py @@ -0,0 +1,599 @@ +# Testing the SBanken YNAB integration +import unittest +from unittest.mock import MagicMock +# from sbanken.Sbanken import Sbanken + +#### Helpers tests +from helpers.Helpers import * +from testdata.transactions import * + + +class RunGetNameTest(unittest.TestCase): + + # def setup(self): + # return super(RunGetNameTest, self).setup() + + def test_transactions(self): + + for i in range(len(test_transaction_list)): + result = getPayee(test_transaction_list[i]) + self.assertEqual(result, test_trans_result_list[i]) + + + def test_Renter(self): + # arrange + transaction = {'transactionTypeCode': 752, 'text':'testing testing'} + + # act + result = getPayee(transaction) + + #assert + self.assertEqual(result, 'Sbanken') + + def test_Nettgiro(self): + # arrange + # transaction = nettgiro_actual_transaction_short_text + transaction = nettgiro_actual_transaction + + # act + result = getPayee(transaction) + + #assert + self.assertEqual(result, 'Berntsen anders') + + def test_Nettgiro_short(self): + # arrange + transaction = nettgiro_actual_transaction_short_text + + # act + result = getPayee(transaction) + + #assert + self.assertEqual(result, 'Nettgiro') + +class RunFindMatchingTransactionTest(unittest.TestCase): + + # def setup(self): + # return super(self).setup() + + @unittest.skip("Not working due to test data formatting") + def test_transactions(self): + # arrange + original_account = 'A974' + transaction = { + 'amount': 199.00, + 'interestDate': '2020-12-30T00:00:00', + 'transactionTypeCode': 200, + 'transactionTypeText': 'OVFNETTB', + 'isReservation': False, + 'reservationType': None, + 'source': 'Archive', + 'cardDetailsSpecified': False, + 'transactionDetailSpecified': False, + 'accountingDate': '2020-12-30T00:00:00' + } + accounts_transactions_list = [ + [ + {'amount': 198.0, 'interestDate': '2020-12-30T00:00:00', 'transactionTypeCode': 200, 'accountingDate': '2020-12-30T00:00:00'}, + {'amount': -199.0, 'interestDate': '2020-12-30T00:00:00', 'transactionTypeCode': 200, 'accountingDate': '2020-12-30T00:00:00'} + ], + [ + {'amount': 0, 'interestDate': '2020-12-30T00:00:00', 'transactionTypeCode': 200, 'accountingDate': '2020-12-30T00:00:00'}, + {'amount': -199.0, 'interestDate': '2020-12-30T00:00:00', 'transactionTypeCode': 200, 'accountingDate': '2020-12-30T00:00:00'} + ] + ] + accounts = [ + {'Name': 'Brukskonto', 'Number': 97104420188, 'ID': 'A974', 'account': '9280'}, + {'Name': 'Kredittkort', 'Number': 97290394663, 'ID': '6CF0', 'account': 'a99f'} + ] + account_references = [ + { + 'balance': 4690970.0, + 'cleared_balance': 0.0, + 'closed': False, + 'id': '9280', + 'name': 'Brukskonto', + 'note': None, + 'on_budget': True, + 'transfer_payee_id': '0743addd', + 'type': 'checking', + 'uncleared_balance': 4690970.0}, + { + 'balance': -1500400.0, + 'cleared_balance': 0.0, + 'closed': False, + 'id': 'a99f', + 'name': 'Kredittkort', + 'note': None, + 'on_budget': True, + 'transfer_payee_id': '7154b463', + 'type': 'creditCard', + 'uncleared_balance': -1500400.0}, + { + 'balance': 0.0, + 'cleared_balance': 0.0, + 'closed': False, + 'id': 'cdd8', + 'name': 'Kontokreditt', + 'note': None, + 'on_budget': False, + 'transfer_payee_id': '4a48f78c', + 'type': 'otherLiability', + 'uncleared_balance': 0.0}, + { + 'balance': 0.0, + 'cleared_balance': 0.0, + 'closed': False, + 'id': '3929', + 'name': 'Utgifter', + 'note': None, + 'on_budget': True, + 'transfer_payee_id': 'fbdf3011', + 'type': 'checking', + 'uncleared_balance': 0.0}, + { + 'balance': -587690.0, + 'cleared_balance': 0.0, + 'closed': False, + 'id': '0ece', + 'name': 'Monica', + 'note': None, + 'on_budget': True, + 'transfer_payee_id': 'd1461c03', + 'type': 'checking', + 'uncleared_balance': -587690.0} + ] + + # act + result = findMatchingTransfer(original_account, transaction, accounts_transactions_list, accounts, account_references) + + # assert + self.assertEqual(result['Name'], 'Kredittkort') + +class RunParseVIsaDate(unittest.TestCase): + def test_ParseVisaDate(self): + # arrange + datestring = '2021-02-09T00:00:00' + # act + result = parseVisaDate(datestring) + # assert + self.assertEqual(result.strftime('%d.%m.%Y'), '09.02.2021') + +class RunParseYearlessDate(unittest.TestCase): + def test_ParseYearlessDate(self): + # arrange + datestring = '23.05' + + # act + result = parseYearlessDate(datestring, 2020) + + # assert + self.assertEqual(result.strftime('%d.%m.%Y'), '23.05.2020') + + def test_ParseYearlessDateKorreksjon(self): + # arrange + datestring = 'KORREKSJON AV 23.05' + + # act + result = parseYearlessDate(datestring, 2020) + + # assert + self.assertEqual(result.strftime('%d.%m.%Y'), '23.05.2020') + + def test_ParseYearlessDateValueError(self): + # arrange + datestring = '29.02' + + # act + result = parseYearlessDate(datestring, 2020) + + # assert + self.assertEqual(result.strftime('%d.%m.%Y'), '29.02.2020') + +class RunGetTransactionDate(unittest.TestCase): + + def test_GetTransactionDate710(self): + # arrange + transaction = { + 'interestDate': '2020-12-30T00:00:00', + 'transactionTypeCode': 710, + 'accountingDate': '2020-12-30T00:00:00', + 'text': '28.12' + } + # act + result = getTransactionDate(transaction) + + # assert + self.assertEqual(result, '28.12.2020') + + def test_GetTransactionDate709(self): + # arrange + transaction = { + 'interestDate': '2020-12-30T00:00:00', + 'transactionTypeCode': 709, + 'accountingDate': '2020-12-30T00:00:00', + 'text': '28.12' + } + # act + result = getTransactionDate(transaction) + + # assert + self.assertEqual(result, '28.12.2020') + + def test_GetTransactionDate_visa(self): + # arrange + transaction = visa_transaction # 'interestDate': '2021-02-11T00:00:00' + + # act + result = getTransactionDate(transaction) + + # assert + self.assertEqual(result, '09.02.2021') + + def test_GetTransactionDate_visa_long_date(self): + # arrange + transaction = visa_transaction_long_date # 'purchaseDate': '2022-06-14T00:00:00', + + # act + result = getTransactionDate(transaction) + + # assert + self.assertEqual(result, '14.06.2021') + + def test_GetTransactionDate_credit(self): + # arrange + transaction = credit_transaction # 'interestDate': '2021-02-13T00:00:00' + + # act + result = getTransactionDate(transaction) + + # assert + self.assertEqual(result, '13.02.2021') + +class RunGetYnabTransDate(unittest.TestCase): + + def test_GetYnabTransDateBfName(self): + # arrange + transaction = { + 'beneficiaryName': 'test', + 'dueDate': '2015-12-30T00:00:00',} + + # act + result = getYnabTransactionDate(transaction) + + # assert + self.assertEqual(result, '2015-12-30') + + def test_GetYnabTransDateNoBfName(self): + # arrange + transaction = { + 'dueDate': '2015-12-30T00:00:00', + 'interestDate': '2020-12-30T00:00:00', + 'transactionTypeCode': 710, + 'accountingDate': '2020-12-30T00:00:00', + 'text': '28.12' + } + + # act + result = getYnabTransactionDate(transaction) + + # assert + self.assertEqual(result, '2020-12-28') + +class RunGetPayee(unittest.TestCase): + + def test_GetPayee_visa_transaction(self): + # arrange + transaction = visa_transaction + # act + result = getPayee(transaction) + # assert + self.assertEqual(result, 'Stavanger parke') + + def test_GetPayee_overforing(self): + # arrange + transaction = overf_transaction + # act + result = getPayee(transaction) + # assert + self.assertEqual(result, 'Overføring mellom egne kontoer') + + def test_GetPayee_credit_transaction(self): + # arrange + transaction = credit_transaction + # act + result = getPayee(transaction) + # assert + self.assertEqual(result, 'Mester grønn 20') + + def test_GetPayee_reserved_transaction(self): + # arrange + transaction = reserved_transaction + # act + result = getPayee(transaction) + # assert + self.assertEqual(result, 'Rogaland taxi a') + + def test_GetPayee_vipps_transactiion(self): + # arrange + transaction = vipps_transactiion + # act + result = getPayee(transaction) + # assert + self.assertEqual(result, 'Vipps*jatta vgs. tur idre') + + def test_GetPayee_kolumbus_actual_transaction(self): + # arrange + transaction = kolumbus_actual_transaction + # act + result = getPayee(transaction) + # assert + self.assertEqual(result, 'Kolumbus as') + + def test_GetPayee_google_actual_transaction(self): + # arrange + transaction = google_actual_transaction + # act + result = getPayee(transaction) + # assert + self.assertEqual(result, 'Google *google') + + def test_GetPayee_nettgiro_actual_transaction_short_text(self): + # arrange + transaction = nettgiro_actual_transaction_short_text + # act + result = getPayee(transaction) + # assert + self.assertEqual(result, 'Nettgiro') + + def test_GetPayee_nettgiro_actual_transaction(self): + # arrange + transaction = nettgiro_actual_transaction + # act + result = getPayee(transaction) + # assert + self.assertEqual(result, 'Berntsen anders') + +class RunGetMemoTest(unittest.TestCase): + def test_GetMemo_visa_transaction(self): + # arrange + transaction = visa_transaction + # act + result = getMemo(transaction) + # assert + self.assertEqual(result,'Nok 10.21 stavanger parke kurs: 1.0000 tId:481000000001540') + + def test_GetMemo_overf_transaction(self): + # arrange + transaction = overf_transaction + # act + result = getMemo(transaction) + # assert + self.assertEqual(result,'Overføring fra annen egen konto') + + def test_GetMemo_credit_transaction(self): + # arrange + transaction = credit_transaction + # act + result = getMemo(transaction) + # assert + self.assertEqual(result,'Reserved: Mester grønn 20') + + def test_GetMemo_reserved_transaction(self): + # arrange + transaction = reserved_transaction + # act + result = getMemo(transaction) + # assert + self.assertEqual(result,'Reserved: Rogaland taxi a') + + def test_GetMemo_vipps_transactiion(self): + # arrange + transaction = vipps_transactiion + # act + result = getMemo(transaction) + # assert + self.assertEqual(result,'Nok 500.00 vipps*jatta vgs. tur idre kurs: 1.0000 tId:4810000000000040') + + def test_GetMemo_kolumbus_actual_transaction(self): + # arrange + transaction = kolumbus_actual_transaction + # act + result = getMemo(transaction) + # assert + self.assertEqual(result,'Nok 299.00 kolumbus as kurs: 1.0000 tId:4810000000000310') + + def test_GetMemo_google_actual_transaction(self): + # arrange + transaction = google_actual_transaction + # act + result = getMemo(transaction) + # assert + self.assertEqual(result,'Nok 49.00 google *google kurs: 1.0000 tId:481000000000060') + + def test_GetMemo_nettgiro_actual_transaction_short_text(self): + # arrange + transaction = nettgiro_actual_transaction_short_text + # act + result = getMemo(transaction) + # assert + self.assertEqual(result,'Nettgiro') + + def test_GetMemo_nettgiro_actual_transaction(self): + # arrange + transaction = nettgiro_actual_transaction + # act + result = getMemo(transaction) + # assert + self.assertEqual(result,'Nettgiro til: berntsen anders ca betalt: 02.11.20') + +class RunGetAccountsTest(unittest.TestCase): + + def test_GetAccounts_return_all(self): + account_list = [ + { 'accountId': 'ABC', + 'accountNumber': '97101236549', + 'accountType': 'Standard account', + 'available': 0.0, + 'balance': 0.0, + 'creditLimit': 0.0, + 'name': 'Lønnskonto', + 'ownerCustomerId': '23056612345'}, + {'accountId': 'DEF', + 'accountNumber': '97107894563', + 'accountType': 'Standard account', + 'available': 187.43, + 'balance': 187.43, + 'creditLimit': 0.0, + 'name': 'Brukskonto', + 'ownerCustomerId': '23056612345' + }] + sbanken = MagicMock() + sbanken.GetAccounts = MagicMock(return_value=account_list) + + # act + result = getAccounts(sbanken) + + # Assert + self.assertEqual(result[0]['accountNumber'], '97101236549' ) + + + def test_GetAccounts_return_single(self): + account_list = [ + { 'accountId': 'ABC', + 'accountNumber': '97101236549', + 'accountType': 'Standard account', + 'available': 0.0, + 'balance': 0.0, + 'creditLimit': 0.0, + 'name': 'Lønnskonto', + 'ownerCustomerId': '23056612345'}, + {'accountId': 'DEF', + 'accountNumber': '97107894563', + 'accountType': 'Standard account', + 'available': 187.43, + 'balance': 187.43, + 'creditLimit': 0.0, + 'name': 'Brukskonto', + 'ownerCustomerId': '23056612345' + }] + sbanken = MagicMock() + sbanken.GetAccounts = MagicMock(return_value=account_list) + + # act + result = getAccounts(sbanken, '97107894563') + + # Assert + self.assertEqual(result['accountId'], 'DEF' ) + + def test_GetAccounts_return_none(self): + account_list = [ + { 'accountId': 'ABC', + 'accountNumber': '97101236549', + 'accountType': 'Standard account', + 'available': 0.0, + 'balance': 0.0, + 'creditLimit': 0.0, + 'name': 'Lønnskonto', + 'ownerCustomerId': '23056612345'}, + {'accountId': 'DEF', + 'accountNumber': '97107894563', + 'accountType': 'Standard account', + 'available': 187.43, + 'balance': 187.43, + 'creditLimit': 0.0, + 'name': 'Brukskonto', + 'ownerCustomerId': '23056612345' + }] + sbanken = MagicMock() + sbanken.GetAccounts = MagicMock(return_value=account_list) + + # act + result = getAccounts(sbanken, '97107004563') + + # Assert + self.assertEqual(result, None ) + +class RunGetInOutTest(unittest.TestCase): + def test_getOut_negative(self): + # arrange + transaction = {'amount': -49.0} + + # act + result = getOut(transaction) + + # assert + + self.assertEqual(result, 49) + + def test_getOut_positive(self): + # arrange + transaction = {'amount': 49.0} + + # act + result = getOut(transaction) + + # assert + + self.assertEqual(result, '') + + def test_getIn_negative(self): + # arrange + transaction = {'amount': -49.0} + + # act + result = getIn(transaction) + + # assert + + self.assertEqual(result, '') + + def test_getIn_positive(self): + # arrange + transaction = {'amount': 49.0} + + # act + result = getIn(transaction) + + # assert + + self.assertEqual(result, 49) + +class RunGetIntAmountMilliTest(unittest.TestCase): + + def test_getAmountMilli_negative(self): + # arrange + transaction = {'amount': -49.0} + + # act + result = getIntAmountMilli(transaction) + + # assert + self.assertEqual(result, -49000) + + def test_getAmountMilli_positive(self): + # arrange + transaction = {'amount': 49.0} + + # act + result = getIntAmountMilli(transaction) + + # assert + self.assertEqual(result, 49000) + +class RunGetYnabSyncId(unittest.TestCase): + + def test_GetYnabSyncId_regular(self): + # arrange + transaction = nettgiro_actual_transaction_short_text + + # act + result = getYnabSyncId(transaction) + + # assert + self.assertEqual(result, 'YNAB:-1500000:2020-11-02:1') + + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/ListAccountsAndIds.py b/ListAccountsAndIds.py index f92b526..1815f58 100644 --- a/ListAccountsAndIds.py +++ b/ListAccountsAndIds.py @@ -1,6 +1,6 @@ import csv import pprint -from Helpers import create_authenticated_http_session,get_accounts +from sbanken.Sbanken import Sbanken def main(): @@ -8,11 +8,8 @@ def main(): import api_settings # import pprint - http_session = create_authenticated_http_session(api_settings.CLIENTID, api_settings.SECRET) - - accounts = get_accounts( - http_session, - api_settings.CUSTOMERID) + sbanken = Sbanken(api_settings.CUSTOMERID, api_settings.CLIENTID, api_settings.SECRET) + accounts = sbanken.GetAccounts() for account in accounts: print('Name:', account['name'], 'Number:', account['accountNumber'], 'ID:', account['accountId']) diff --git a/README.md b/README.md index 7c404ab..208f4bc 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,31 @@ +[![codecov](https://codecov.io/gh/stenjo/SbankenToYNAB/branch/master/graph/badge.svg?token=UOMQUN7S49)](https://codecov.io/gh/stenjo/SbankenToYNAB) # SbankenToYNAB Importing data from Sbanken to YNAB using Sbanken API and python 3 Exported from https://github.com/sbanken This repo contains functions to fetch data from SBanken on transactions and create an CSV file for import into YNAB (https://www.youneedabudget.com/) -Enter your details into the api_settings.py and run from there. -The ListAccountsAndIds.py lists all accounts available to your id and prints the account given name, its account number and id. -GetStatementsAllAccounts creates a CSV file for all accounts available the last month. +Enter your details into the `api_settings.py` and run from there. The various fields are described in comments in the `api_settings.py` file +The `ListAccountsAndIds.py` lists all accounts available to your id and prints the account given name, its account number and id. +`GetStatementsAllAccounts.py` creates a CSV file for all accounts available the last month. -# Setup guide +Want to try YNAB? Help me out by using this referral link: https://ynab.com/referral/?ref=OKHeNiTm3GB_ss4i&utm_source=customer_referral + +# Get what you need from Sbanken + +- Activate your SBanken Beta subscription: https://sbanken.no/om-oss/beta/ +- Make sure you have a BankID that works +- Fill in you api access application form at https://secure.sbanken.no/Personal/ApiBeta/ApiHome. If you feel for it, advocate for SBankenToYNAB. +- Get your application key, generate your password and allow access at https://secure.sbanken.no/Personal/ApiBeta/Info. Select all read access. +- Make sure you have selected: **Grants access to perform operations on APIBeta APIs (aka. developer portal)** +- Your SBanken password will expire after three months and needs to be renewed then. + +# Get your YNAB access details. +- When logged into your YNAB app, go to https://app.youneedabudget.com/settings/developer +- Create a personal Access Token. This toke will never expire. +- Fill in your `api_settings.py` where the settings file require an `api_key` + + +# SW Setup guide * Requires Python 3 * Requires package ``requests_oauthlib``: @@ -15,7 +33,22 @@ GetStatementsAllAccounts creates a CSV file for all accounts available the last $ pip install requests-oauthlib c:> pip install requests-oauthlib ``` +* Requires package ``ynab_api``: +``` +$ pip install git+https://github.com/dmlerner/ynab-api.git@nullfix +c:> pip install git+https://github.com/dmlerner/ynab-api.git@nullfix +``` +* For running publication via MQTT (publish_accounts_status.py) package ``paho-mqtt`` is required +``` +$ pip3 install paho-mqtt +c:> pip3 install paho-mqtt +``` + For these programs to work, you need to rename the ```api_settings_format.py``` to ```api_settings.py``` and replace all the dummy keys and values with values for your own budget and keys. Edit ``api_settings.py`` and supply your client credentials + customer id. +- Fill inn the keys and password in your copy of the `api_settings.py` +- Run `ListAccountsAndIds.py` to get your list of accounts and ids to further update your `api_settings.py` +- In YNAB, find `budget_id` and `account` in the url of ynab when the account you want to map is selected: https://app.youneedabudget.com//accounts/\ +- Do the above for each account you want to map # Programs for listing, printing and importing ## ListAccountsAndIds.py diff --git a/api_settings_format.py b/api_settings_format.py index ff4b670..737c6c4 100644 --- a/api_settings_format.py +++ b/api_settings_format.py @@ -15,6 +15,9 @@ # Uncomment if reserved transactions should be flagged with a colour # reservedFlagColor = 'Red' +# Days back to sync. Change this number to sync other than 8 days back +daysBack = 8 + # The SBanken to YNAB mappings budget_id = '12345ab-6789-abcd-****-fedcba987654' # str | The ID of the Budget. api_key = '*********' # Tha YNAB Api key @@ -22,8 +25,8 @@ { 'Name': 'Brukskonto', 'Number': 97000000321, - 'ID': 'ABCDEF1234567890ABCDEF0123456789', - 'account':'12345678-90ab-cdef-0123-456789abcdef' + 'ID': 'ABCDEF1234567890ABCDEF0123456789', # Bank account ID from SBanken. Find it running ListAccountsAnIds.py + 'account':'12345678-90ab-cdef-0123-456789abcdef' # Budget account ID from YNAB budget. }, { 'Name': 'Utgiftskonto', @@ -38,7 +41,7 @@ balances = [ { 'category_name' : 'Dagligvarer', - 'category_id' : 'cd7c625b-****-****-****-10bb7e69d29f' + 'category_id' : 'cd7c625b-****-****-****-10bb7e69d29f' # get this from the url to your YNAB application when category is selected }, { 'category_name' : 'Spise ute', diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..f86d127 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,3 @@ +ignore: + - "ynab" # ignore folders and all its contents + - "sbanken" # ignore folders and all its contents diff --git a/Helpers.py b/helpers/Helpers.py similarity index 60% rename from Helpers.py rename to helpers/Helpers.py index 040edf3..ccfc392 100644 --- a/Helpers.py +++ b/helpers/Helpers.py @@ -1,7 +1,3 @@ -from oauthlib.oauth2 import BackendApplicationClient -import requests -from requests_oauthlib import OAuth2Session -import urllib.parse import csv import datetime import pprint @@ -19,197 +15,29 @@ def enable_debug_logging(): requests_log.setLevel(logging.DEBUG) requests_log.propagate = True - -def create_authenticated_http_session(client_id, client_secret) -> requests.Session: - oauth2_client = BackendApplicationClient(client_id=urllib.parse.quote(client_id)) - session = OAuth2Session(client=oauth2_client) - session.fetch_token( - token_url='https://auth.sbanken.no/identityserver/connect/token', - client_id=urllib.parse.quote(client_id), - client_secret=urllib.parse.quote(client_secret) - ) - return session - - -def get_customer_information(http_session: requests.Session, customerid): - """ - Get customer information SBanken given by the customerid - - Args: - http_session (requests.Session): [description] - customerid ([type]): [description] - - Raises: - RuntimeError: [description] - - Returns: - [type]: [description] - """ - response_object = http_session.get( - "https://api.sbanken.no/exec.customers/api/v1/Customers", - headers={'customerId': customerid} - ) - print(response_object) - print(response_object.text) - response = response_object.json() - - if not response["isError"]: - return response["item"] - else: - raise RuntimeError("{} {}".format(response["errorType"], response["errorMessage"])) - - -def get_accounts(http_session: requests.Session, customerid): +def getAccounts(api, accountNo=None): """ - Fetch all accounts from SBanken based on customerid + Gets all (or specific) accounts from api.get_accounts Args: - http_session (requests.Session): [description] - customerid ([type]): [description] - - Raises: - RuntimeError: [description] - - Returns: - [type]: [description] - """ - response = http_session.get( - "https://api.sbanken.no/exec.bank/api/v1/Accounts", - headers={'customerId': customerid} - ).json() - - if not response["isError"]: - return response["items"] - else: - raise RuntimeError("{} {}".format(response["errorType"], response["errorMessage"])) + api (http_session): Sbanken api + accountNo (string): Account number to look for. If None (default) then all accounts returned - -def get_transactions_period(http_session: requests.Session, customerid, account_id, startDate, endDate): - """ - Get all transactions from SBanken for a given time period - - Args: - http_session (requests.Session): [description] - customerid (string): The customer id of the user - account_id (string): The account id where transactions are read - startDate (Date): From date - endDate (Date): To date - - Raises: - RuntimeError: Error reading from API - RuntimeError: - Returns: - array: List of transactions - """ - queryString = "https://api.sbanken.no/exec.bank/api/v1/Transactions/{}?length=1000&startDate={}&endDate={}".format(account_id,startDate.strftime("%Y-%m-%d"),endDate.strftime("%Y-%m-%d")) - response = http_session.get(queryString - , headers={'customerId': customerid} - ) - if response.ok: - response = response.json() - else: - raise RuntimeError("Request to transactions API returned with HTTP status code {} with reason {}. Request was {}".format(response.status_code, response.reason, queryString)) - - if not response["isError"]: - return response["items"] - else: - raise RuntimeError("{} {}, Request was {}".format(response["errorType"], response["errorMessage"], queryString)) + accounts list: accounts retrieved from Sbanken. All (if accountNO is None) or the one given by accountNo + singular account if specified account is found -def get_standing_orders(http_session: requests.Session, customerid, account_id): """ - Get all future repeated future payments from SBanken API - - Args: - http_session (requests.Session): Current session - customerid (string): Id of the customer - account_id (string): Id of the account - - Raises: - RuntimeError: API error - - Returns: - array: List of standing order payments being paid on date - """ - # print(customerid) - # print(account_id) - response = http_session.get( - "https://api.sbanken.no/exec.bank/api/v1/StandingOrders/{}".format(account_id), - headers={'customerId': customerid} - ).json() - - if not response["isError"]: - return response["items"] - else: - raise RuntimeError("{} {}".format(response["errorType"], response["errorMessage"])) + accounts = api.GetAccounts() -def get_payments(http_session: requests.Session, customerid, account_id): - """ - Get all future payments from SBanken API - - Args: - http_session (requests.Session): Current session - customerid (string): ID of the customer - account_id (string): Id of th account - - Raises: - RuntimeError: API error - - Returns: - array: List of future payments being paid on date - """ - queryString = "https://api.sbanken.no/exec.bank/api/v1/Payments/{}".format(account_id) - response = http_session.get( - queryString, - headers={'customerId': customerid} - ).json() - - if not response["isError"]: - return response["items"] + if accountNo is not None: + for account in accounts: + if account['accountNumber'] == accountNo: + return account + return None else: - raise RuntimeError("{} {}, Request was {}".format(response["errorType"], response["errorMessage"], queryString)) - -def get_transactions(http_session: requests.Session, customerid, account_id, months): - """ - Get transactions for a given number of months back up and until now - - Args: - http_session (requests.Session): Current session - customerid (string): Id of the customer - account_id (string): Id of the account - months (integer): Number of months back to start getting transactions. There is a limit of 12 months - - Returns: - arrya: List of transactions - """ - today = datetime.date.today() - endDate = today - datetime.timedelta(0) - startDate = today - datetime.timedelta(30*months) - - return get_transactions_period(http_session, customerid, account_id, startDate, endDate) - - -def get_transactions_year(http_session: requests.Session, customerid, account_id, year): - """ - Get transactions from a full year - - Args: - http_session (requests.Session): Current session - customerid (string): Id of the customer - account_id (string): Id of the account - year (int): The year + return accounts - Returns: - array: Transactions from jan 1st to dec 31st the given year - """ - today = datetime.date.today() - endDate = datetime.date(year, 12, 31) - if today < endDate: - endDate = today - - startDate = datetime.date(year, 1, 1) - - return get_transactions_period(http_session, customerid, account_id, startDate, endDate) def parseVisaDate (stringDate, substractYear=False): """ @@ -281,7 +109,14 @@ def getTransactionDate(transaction): d = parseYearlessDate(transaction['text'], forcedYear=(d.year-1)) elif code == 714 and transaction['cardDetailsSpecified']: d = parseVisaDate(stringDate=transaction['cardDetails']['purchaseDate'], substractYear=True) - return d.strftime('%d.%m.%Y') + else: + # Use accounting date if nothing else. Make sure the date is not in the future + d = accountingDate + + if d > datetime.datetime.today(): + return accountingDate.strftime('%d.%m.%Y') + else: + return d.strftime('%d.%m.%Y') def getYnabTransactionDate(transaction): @@ -301,6 +136,22 @@ def getYnabTransactionDate(transaction): d = datetime.datetime.strptime( getTransactionDate(transaction), "%d.%m.%Y") return d.strftime('%Y-%m-%d') +def getYnabTransactionDateAsDate(transaction): + """ + Extract transaction date from an SBanken transaction and return this in a YNAB format + + Args: + transaction (object): Transaction from a transaction list + + Returns: + string: Transaction date in the format YYYY-MM-DD + """ + if 'beneficiaryName' in transaction: + return datetime.datetime.strptime(getPaymentsDate(transaction), "%d.%m.%Y").date() + # return d.strftime('%Y-%m-%d') + else: + return datetime.datetime.strptime( getTransactionDate(transaction), "%d.%m.%Y").date() + # return d.strftime('%Y-%m-%d') def getPayee(transaction): """ @@ -360,16 +211,19 @@ def getPayee(transaction): res = (payee[1]+ ' ' + payee[2]).capitalize() elif transaction['transactionTypeCode'] == 200: # Overføringe egen konto - if transaction['otherAccountNumberSpecified'] == True: - pprint.pprint(transaction) - if transaction['amount'] > 0: - res = 'Transfer from:' - else: - res = 'Transfer to:' + if 'otherAccountNumberSpecified' in transaction and transaction['otherAccountNumberSpecified'] == True: + #pprint.pprint(transaction) + if transaction['amount'] > 0: + res = 'Transfer from:' + else: + res = 'Transfer to:' elif transaction['transactionTypeCode'] == 203: # Nettgiro payee = transaction['text'].split(' ') try: - res = (payee[2] + ' ' + payee[3]).capitalize() + if len(payee) > 3: + res = (payee[2] + ' ' + payee[3]).capitalize() + else: + res = transaction['text'].capitalize() except IndexError: raise ValueError ("Can't extract payee from nettgiro.") elif transaction['transactionTypeCode'] == 15: # Valuta @@ -387,13 +241,22 @@ def getPayee(transaction): return res[0:50] def getMemo(transaction): + """ + Gets a memo string based on the transaction passed + + Args: + transaction (Object): Sbanken Transaction + + Returns: + string: Memo string extracted from the transaction + """ transactionId = '' if transaction['cardDetailsSpecified'] == True: transactionId = ' tId:'+transaction['cardDetails']['transactionId'] isReservation = '' - if transaction['isReservation'] == True: + if 'isReservation' in transaction and transaction['isReservation'] == True: isReservation = 'Reserved: ' transactionMemo = '' @@ -432,9 +295,43 @@ def getIntAmountMilli(transaction): return int(transaction['amount'] * 1000) def getYnabSyncId(transaction): + """Creates the YNAB transaction id based on amount and date + + Args: + transaction (Object): Sbanken transaction object + + Returns: + string: YNAB transaction id + """ return "YNAB:"+str(getIntAmountMilli(transaction))+":"+getYnabTransactionDate(transaction)+":"+"1" def getPaymentsDate(payment): d = datetime.datetime.strptime(payment['dueDate'].split('T')[0], "%Y-%m-%d") return d.strftime('%d.%m.%Y') + +def findMatchingTransfer(original_account, transaction, accounts_transactions_list, accounts, account_references): + # print(transaction) + compare = transaction.copy() + compare['amount'] = transaction['amount'] * -1 + for account_idx in range(len(accounts)): + if accounts[account_idx]['ID'] != original_account: + for t in accounts_transactions_list[account_idx]: + if getYnabSyncId(t) == getYnabSyncId(compare): + # reference = [a for a in account_references if a['id'] == accounts[account_idx]['account']] + reference = [] + + for ar in account_references: + if ar.id == accounts[account_idx]['account']: + reference.append(ar) + + d = {} + d['Name'] = accounts[account_idx]['Name'] + d['account'] = accounts[account_idx]['account'] + if len(reference) > 0 and hasattr(reference[0], 'transfer_payee_id'): + d['payee_id'] = reference[0].transfer_payee_id + else: + d['payee_id'] = None + + return d + diff --git a/publish_accounts_status.py b/publish_accounts_status.py index f5698db..f911a01 100644 --- a/publish_accounts_status.py +++ b/publish_accounts_status.py @@ -3,21 +3,16 @@ import api_settings import time import paho.mqtt.client as mqtt -from Helpers import create_authenticated_http_session,get_accounts +from sbanken.Sbanken import Sbanken Broker = api_settings.broker def main(): # enable_debug_logging() import api_settings - # import pprint - - http_session = create_authenticated_http_session(api_settings.CLIENTID, api_settings.SECRET) - - accounts = get_accounts( - http_session, - api_settings.CUSTOMERID) + sbanken = Sbanken(api_settings.CUSTOMERID, api_settings.CLIENTID, api_settings.SECRET) + accounts = sbanken.GetAccounts() ids = [x['ID'] for x in api_settings.account_statuses] try: diff --git a/sbanken/Sbanken.py b/sbanken/Sbanken.py new file mode 100644 index 0000000..0d39e18 --- /dev/null +++ b/sbanken/Sbanken.py @@ -0,0 +1,252 @@ +# +# Functions to interface SBanken API +# + +import datetime +from oauthlib.oauth2 import BackendApplicationClient +import requests +from requests_oauthlib import OAuth2Session +import urllib.parse + +sbanken_api_url = "https://publicapi.sbanken.no/apibeta" + +class Sbanken: + + """ api interface to sbanken """ + session: requests.Session + + def __init__(self, customer_id, client_id, client_secret): + self.customer_id = customer_id + self.client_id = client_id + self.client_secret = client_secret + oauth2_client = BackendApplicationClient(client_id=urllib.parse.quote(client_id)) + self.session = OAuth2Session(client=oauth2_client) + self.session.fetch_token( + token_url='https://auth.sbanken.no/identityserver/connect/token', + client_id=urllib.parse.quote(client_id), + client_secret=urllib.parse.quote(client_secret) + ) + + # def create_authenticated_http_session(self, client_id, client_secret) -> requests.Session: + # oauth2_client = BackendApplicationClient(client_id=urllib.parse.quote(client_id)) + # self.session = OAuth2Session(client=oauth2_client) + # self.session.fetch_token( + # token_url='https://auth.sbanken.no/identityserver/connect/token', + # client_id=urllib.parse.quote(client_id), + # client_secret=urllib.parse.quote(client_secret) + # ) + # return session + + + def GetCustomerInfo(self): + """ + Get customer information SBanken given by the customerid + + Args: + http_session (requests.Session): [description] + customerid ([type]): [description] + + Raises: + RuntimeError: [description] + + Returns: + [type]: [description] + """ + response_object = self.session.get( + sbanken_api_url + "/api/v1/Customers", + headers={'customerId': self.customer_id} + ) + print(response_object) + print(response_object.text) + response = response_object.json() + + if not response["isError"]: + return response["item"] + else: + raise RuntimeError("{} {}".format(response["errorType"], response["errorMessage"])) + + + def GetAccounts(self): + """ + Fetch all accounts from SBanken based on customerid + + Args: + http_session (requests.Session): [description] + customerid ([type]): [description] + + Raises: + RuntimeError: [description] + + Returns: + [type]: [description] + """ + response = self.session.get( + sbanken_api_url + "/api/v1/Accounts", + headers={'customerId': self.customer_id} + ).json() + + if not response["isError"]: + return response["items"] + else: + raise RuntimeError("{} {}".format(response["errorType"], response["errorMessage"])) + + def GetAccountByAccountId(self, accountId): + + response = self.session.get( + sbanken_api_url + "/api/v1/Accounts/" + accountId + "/", + headers={'customerId': self.customer_id} + ).json() + + if not response["isError"]: + return response["item"] + else: + raise RuntimeError("{} {}".format(response["errorType"], response["errorMessage"])) + + def GetArchivedForPeriod(self, account_id, startDate, endDate): + queryString = sbanken_api_url + "/api/v1/Transactions/archive/{}?length=1000&startDate={}".format(account_id, startDate.strftime("%Y-%m-%d")) + + if endDate is not None: + queryString = sbanken_api_url + "/api/v1/Transactions/archive/{}?startDate={}&endDate={}".format(account_id, startDate.strftime("%Y-%m-%d"), endDate.strftime("%Y-%m-%d")) + + # response = self.session.get(queryString, headers={'customerId': self.customer_id}) + response = self.session.get(queryString) + if response.ok: + response = response.json() + else: + raise RuntimeError("Request to transactions API returned with HTTP status code {} with reason {}. Request was {}".format(response.status_code, response.reason, queryString)) + + if not response["isError"]: + return response["items"] + else: + raise RuntimeError("{} {}, Request was {}".format(response["errorType"], response["errorMessage"], queryString)) + + + def GetTransactionsForPeriod(self, account_id, startDate, endDate): + """ + Get all transactions from SBanken for a given time period + + Args: + customerid (string): The customer id of the user + account_id (string): The account id where transactions are read + startDate (Date): From date + endDate (Date): To date + + Raises: + RuntimeError: Error reading from API + RuntimeError: + + Returns: + array: List of transactions + """ + queryString = sbanken_api_url + "/api/v1/Transactions/{}?length=1000&startDate={}".format(account_id, startDate.strftime("%Y-%m-%d")) + + today = datetime.date.today() + if endDate is not None and not endDate == today: + queryString = sbanken_api_url + "/api/v1/Transactions/{}?startDate={}&endDate={}".format(account_id, startDate.strftime("%Y-%m-%d"), endDate.strftime("%Y-%m-%d")) + + # response = self.session.get(queryString, headers={'customerId': self.customer_id}) + response = self.session.get(queryString) + if response.ok: + response = response.json() + else: + raise RuntimeError("Request to transactions API returned with HTTP status code {} with reason {}. Request was {}".format(response.status_code, response.reason, queryString)) + + if not response["isError"]: + return response["items"] + else: + raise RuntimeError("{} {}, Request was {}".format(response["errorType"], response["errorMessage"], queryString)) + + + def GetStandingOrders(self, account_id): + """ + Get all future repeated future payments from SBanken API + + Args: + customerid (string): Id of the customer + account_id (string): Id of the account + + Raises: + RuntimeError: API error + + Returns: + array: List of standing order payments being paid on date + """ + # print(customerid) + # print(account_id) + response = self.session.get( + sbanken_api_url + "/api/v1/StandingOrders/{}".format(account_id), + headers={'customerId': self.customer_id} + ).json() + + if not response["isError"]: + return response["items"] + else: + raise RuntimeError("{} {}".format(response["errorType"], response["errorMessage"])) + + def GetPayments(self, account_id): + """ + Get all future payments from SBanken API + + Args: + customerid (string): ID of the customer + account_id (string): Id of th account + + Raises: + RuntimeError: API error + + Returns: + array: List of future payments being paid on date + """ + queryString = sbanken_api_url + "/api/v1/Payments/{}".format(account_id) + response = self.session.get( + queryString, + headers={'customerId': self.customer_id} + ).json() + + if not response["isError"]: + return response["items"] + else: + raise RuntimeError("{} {}, Request was {}".format(response["errorType"], response["errorMessage"], queryString)) + + def GetTransactions(self, account_id, months): + """ + Get transactions for a given number of months back up and until now + + Args: + customerid (string): Id of the customer + account_id (string): Id of the account + months (integer): Number of months back to start getting transactions. There is a limit of 12 months + + Returns: + arrya: List of transactions + """ + today = datetime.date.today() + endDate = today - datetime.timedelta(0) + startDate = today - datetime.timedelta(30*months) + + # return self.get_archived_period(account_id, startDate, endDate) + return self.GetTransactionsForPeriod(account_id, startDate, endDate = None) + + def GetTransactionsForYear(self, account_id, year): + """ + Get transactions from a full year + + Args: + customerid (string): Id of the customer + account_id (string): Id of the account + year (int): The year + + Returns: + array: Transactions from jan 1st to dec 31st the given year + """ + today = datetime.date.today() + endDate = datetime.date(year, 12, 31) + if today < endDate: + endDate = today - datetime.timedelta(days=1) + + startDate = datetime.date(year, 1, 1) + + return self.GetTransactionsForPeriod(account_id, startDate, endDate) + + def close(self): + self.session.close diff --git a/service/README.md b/service/README.md new file mode 100644 index 0000000..6cce77e --- /dev/null +++ b/service/README.md @@ -0,0 +1,47 @@ +# Sync Sbanken transactions to YNAB as a service +Sbanken to YNAB may be run as a service rather than using cron + +To make that happen, modify and then copy the files in the ./service folder: + +`sbanken-sync.service` + +`sbanken-sync.timer` + +## Setting up the sync Service +In `sbanken-sync.service` change +After modifying the `sbanken-sync.service` file, copy it to `/etc/systemd/system` using root.: +``` +$ sudo cp sbanken-sync.service /etc/systemd/system/sbanken-sync.service +``` + +## Setting up the schedule +Edit `sbanken-sync.timer` particularly focus on +``` +[Timer] +OnCalendar=*-*-* 01:00:00 +``` +Set this to a value that suits you. The default runs the service at one in the morning every day. Changing to +``` +OnCalendar=Hourly +``` +will run the sync every hour - on the hour. Script should be capable to handle this. +See also https://wiki.archlinux.org/title/Systemd/Timers for more options. + +After modifying the `sbanken-sync.timer` file, copy it to `/etc/systemd/system` using root.: +``` +$ sudo cp sbanken-sync.timer /etc/systemd/system/sbanken-sync.timer +``` + +Start the sync timer running: +``` +$ sudo systemctl start sbanken-sync.timer +``` + +To verify that your timer is scheduled to run sync, use the command: +``` +$ systemctl list-timers +``` +or check the run status: +``` +$ sudo systemctl status sbanken-sync.timer +``` diff --git a/service/sbanken-sync.service b/service/sbanken-sync.service new file mode 100644 index 0000000..f62b93b --- /dev/null +++ b/service/sbanken-sync.service @@ -0,0 +1,16 @@ +[Unit] +Description=Syncs Sbanken to YNAB +Wants=sbanken-sync.timer +Wants=network-online.target +After=network-online.target + +[Service] +User=appropriate-username +Group=appropriate-group + +WorkingDirectory=/path/to/SbankenToYNAB + +ExecStart=/usr/bin/python3 sync_accounts.py + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/service/sbanken-sync.timer b/service/sbanken-sync.timer new file mode 100644 index 0000000..d0332cf --- /dev/null +++ b/service/sbanken-sync.timer @@ -0,0 +1,9 @@ +[Unit] +Description=SbankenToYNAB sync timer +Requires=sbanken-sync.service + +[Timer] +OnCalendar=*-*-* 01:00:00 + +[Install] +WantedBy=timers.target diff --git a/sync_accounts.py b/sync_accounts.py index 1afedc7..360c9fc 100644 --- a/sync_accounts.py +++ b/sync_accounts.py @@ -1,91 +1,65 @@ from __future__ import print_function import time -import ynab import api_settings import datetime -from ynab.rest import ApiException -from pprint import pprint -from Helpers import create_authenticated_http_session,get_accounts,get_transactions,getTransactionDate,getPayee,getMemo, getOut, getIn,getIntAmountMilli,getYnabTransactionDate,get_transactions_period,getYnabSyncId - - -def findMatchingTransfer(original_account, transaction, accounts_transactions_list, accounts, account_references): - - compare = transaction.copy() - compare['amount'] = transaction['amount'] * -1 - for account_idx in range(len(accounts)): - if accounts[account_idx]['ID'] != original_account: - for t in accounts_transactions_list[account_idx]: - if getYnabSyncId(t) == getYnabSyncId(compare): - reference = [a for a in account_references if a.id == accounts[account_idx]['account']] - - d = {} - d['Name'] = accounts[account_idx]['Name'] - d['account'] = accounts[account_idx]['account'] - if len(reference) > 0 and hasattr(reference[0], 'transfer_payee_id'): - d['payee_id'] = reference[0].transfer_payee_id - else: - d['payee_id'] = None +import logging +import platform - return d +from pprint import pprint +from helpers.Helpers import getTransactionDate, getPayee, getMemo, getOut, getIn, getIntAmountMilli, getYnabTransactionDate, getYnabTransactionDateAsDate, getYnabSyncId, findMatchingTransfer +from sbanken.Sbanken import Sbanken +from ynab.Ynab import Ynab -# Configure API key authorization: bearer -configuration = ynab.Configuration() -configuration.api_key['Authorization'] = api_settings.api_key -configuration.api_key_prefix['Authorization'] = 'Bearer' +logging.basicConfig(filename='sync_accounts.log', filemode='w', level=logging.INFO) +logging.info("Python version: %s, %s\n", platform.python_version(), platform.platform()) -# create an instance of the API class -api_instance = ynab.TransactionsApi(ynab.ApiClient(configuration)) -api_accounts = ynab.AccountsApi(ynab.ApiClient(configuration)) +# YNAB auth +ynab = Ynab(api_settings.api_key, api_settings.budget_id) #SBanken auth -http_session = create_authenticated_http_session(api_settings.CLIENTID, api_settings.SECRET) +sbanken = Sbanken(api_settings.CUSTOMERID, api_settings.CLIENTID, api_settings.SECRET) + +# http_session = create_authenticated_http_session(api_settings.CLIENTID, api_settings.SECRET) today = datetime.date.today() endDate = today -startDate = today - datetime.timedelta(8) # Last 8 days +startDate = today - datetime.timedelta(8) # Last 8 days - unless changed in api_settings +if 'daysBack' in vars(api_settings) and api_settings.daysBack != None: + startDate = today - datetime.timedelta(api_settings.daysBack) + +if api_settings.includeReservedTransactions == True: + endDate = None # Get the transactions for all accounts accounts = [] for mapping in api_settings.mapping: - accounts.append(get_transactions_period( - http_session, - api_settings.CUSTOMERID, - mapping['ID'], - startDate, - endDate)) - -# Find ynab accounts -try: - # Get existing accounts for the budget - api_response = api_accounts.get_accounts(api_settings.budget_id) -except ApiException as e: - print("Exception when calling AccountsApi->get_accounts: %s\n" % e) - -ynab_accounts = api_response.data.accounts + accounts.append(sbanken.GetTransactionsForPeriod(mapping['ID'],startDate,endDate)) + + +ynab_accounts = ynab.GetAccounts() # Loop through all batches of transactions for all accounts for account_idx in range(len(accounts)): transactions = accounts[account_idx] # Transactions from SBanken account_map = api_settings.mapping[account_idx] # Account mapping - ynab_transactions = [] # Transactions to YNAB + yTrs = [] # Transactions to YNAB ynab_updates = [] # Transactions to be updated in YNAB import_ids = [] # Import ids (before last colon) handled so far for this account existing_transactions = [] + logging.info("Fetched %i transactions from %s in SBanken", len(transactions), account_map['Name']) + # Find existing transactions if len(account_map['account']) > 2: # Only fetch YNAB transactions from accounts that are synced in YNAB - try: - # Get existing transactions that are Reserved in case they need to be updated - api_response = api_instance.get_transactions_by_account(api_settings.budget_id, account_map['account'], since_date=startDate) - except ApiException as e: - print("Exception when calling TransactionsApi->get_transactions_by_account: %s\n" % e) + existing_transactions = ynab.GetTransactionsByAccount(account_map['account'], startDate) + + logging.info("Got %i existing YNAB transactions from %s", len(existing_transactions), account_map['Name']) - existing_transactions = api_response.data.transactions # Loop through all transactions for transaction_item in transactions: payee_id = None if api_settings.includeReservedTransactions != True: - if transaction_item.get('isReservation') == True or transaction_item.get('otherAccountNumberSpecified') == False: + if transaction_item.get('isReservation') == True: # or transaction_item.get('otherAccountNumberSpecified') == False: continue try: @@ -94,29 +68,31 @@ def findMatchingTransfer(original_account, transaction, accounts_transactions_li except ValueError: pass - ynab_transaction = ynab.TransactionDetail( - date=getYnabTransactionDate(transaction_item), - amount=getIntAmountMilli(transaction_item), - cleared='uncleared', - approved=False, - account_id=account_map['account'], - memo=getMemo(transaction_item), - import_id=getYnabSyncId(transaction_item) + logging.info("Transaction: %s, amount: %s, typecode: %s, text: %s", getYnabTransactionDate(transaction_item), transaction_item['amount'], transaction_item['transactionTypeCode'], getMemo(transaction_item)) + + yTrn = ynab.SaveTransaction( + getYnabTransactionDateAsDate(transaction_item), + getIntAmountMilli(transaction_item), + account_map['account'], + getMemo(transaction_item), + getYnabSyncId(transaction_item), + account_map['Name'] ) - ynab_transaction.payee_name = payee_name + + yTrn.payee_name = payee_name if 'transactionFlagColor' in vars(api_settings) and api_settings.transactionFlagColor != None: - ynab_transaction.flag_color = api_settings.transactionFlagColor + yTrn.flag_color = api_settings.transactionFlagColor.lower() if 'reservedFlagColor' in vars(api_settings) and api_settings.reservedFlagColor != None and (transaction_item.get('isReservation') == True or (transaction_item.get('otherAccountNumberSpecified') == False and transaction_item.get('source') != 'Archive')): - ynab_transaction.flag_color = api_settings.reservedFlagColor + yTrn.flag_color = api_settings.reservedFlagColor.lower() # Change import_id if same amount on same day several times - transaction_ref = ':'.join(ynab_transaction.import_id.split(':')[:3]) + transaction_ref = ':'.join(yTrn.import_id.split(':')[:3]) if import_ids.count(transaction_ref) > 0: - ynab_transaction.import_id=transaction_ref + ":" + str(import_ids.count(transaction_ref)+1) + yTrn.import_id=transaction_ref + ":" + str(import_ids.count(transaction_ref)+1) import_ids.append(transaction_ref) @@ -125,55 +101,57 @@ def findMatchingTransfer(original_account, transaction, accounts_transactions_li payee = findMatchingTransfer(account_map['ID'], transaction_item, accounts, api_settings.mapping, ynab_accounts) if payee != None: if 'payee_id' in payee: - ynab_transaction.payee_id = payee['payee_id'] - ynab_transaction.payee_name = None + yTrn.payee_id = payee['payee_id'] + yTrn.payee_name = None else: - ynab_transaction.payee_name = 'Transfer ' + yTrn.payee_name = 'Transfer ' - if ynab_transaction.amount > 0: - ynab_transaction.payee_name += 'from: ' + if yTrn.amount > 0: + yTrn.payee_name += 'from: ' else: - ynab_transaction.payee_name += 'to: ' - ynab_transaction.payee_name += payee['Name'] + yTrn.payee_name += 'to: ' + yTrn.payee_name += payee['Name'] - ynab_transaction.memo += ': '+payee['Name'] + logging.info("Found matching internal transaction id: %s, name: %s", yTrn.payee_id, yTrn.payee_name) + yTrn.memo += ': '+payee['Name'] else: - ynab_transaction.payee_name = (ynab_transaction.payee_name[:45] + '...') if len(ynab_transaction.payee_name) > 49 else ynab_transaction.payee_name + yTrn.payee_name = (yTrn.payee_name[:45] + '...') if len(yTrn.payee_name) > 49 else yTrn.payee_name else: - ynab_transaction.payee_name = (ynab_transaction.payee_name[:45] + '...') if len(ynab_transaction.payee_name) > 49 else ynab_transaction.payee_name + yTrn.payee_name = (yTrn.payee_name[:45] + '...') if len(yTrn.payee_name) > 49 else yTrn.payee_name # Update existing transactions if there are any - updated = [x for x in existing_transactions if x.import_id == ynab_transaction.import_id] + updated = [x for x in existing_transactions if x.import_id == yTrn.import_id] if len(updated) > 0: # Existing transactions to be updated update_transaction = updated[0] - ynab_transaction.id = update_transaction.id - ynab_transaction.cleared = update_transaction.cleared - ynab_transaction.approved = update_transaction.approved - ynab_transaction.category_id = update_transaction.category_id - ynab_transaction.category_name = update_transaction.category_name - # if ynab_transaction.memo != update_transaction.memo or ynab_transaction.payee_name != update_transaction.payee_name: - # ynab_transaction.memo = update_transaction.memo - if ynab_transaction.payee_name != update_transaction.payee_name: - ynab_transaction.payee_id = None + yTrn.id = update_transaction.id + yTrn.cleared = update_transaction.cleared + yTrn.approved = update_transaction.approved + yTrn.category_id = update_transaction.category_id + yTrn.category_name = update_transaction.category_name + # if yTrn.memo != update_transaction.memo or yTrn.payee_name != update_transaction.payee_name: + # yTrn.memo = update_transaction.memo + if yTrn.payee_name != update_transaction.payee_name: + yTrn.payee_id = None else: - ynab_transaction.payee_id = update_transaction.payee_id - ynab_updates.append(ynab_transaction) + yTrn.payee_id = update_transaction.payee_id + ynab_updates.append(ynab.UpdateTransaction(yTrn)) elif len(account_map['account']) > 2: # New transactions not yet in YNAB - ynab_transactions.append(ynab_transaction) + yTrs.append(yTrn) - if len(ynab_transactions) > 0: - try: - # Create new transaction - api_response = api_instance.create_transaction(api_settings.budget_id, {"transactions":ynab_transactions}) - except ApiException as e: - print("Exception when calling TransactionsApi->create_transaction: %s\n" % e) - #print (ynab_transactions) + + logging.info(" %i YNAB transactions to be added", len(yTrs)) + + if len(yTrs) > 0: + ynab.CreateTransactions(yTrs) + + logging.info(" %i YNAB transactions to be updated", len(ynab_updates)) if len(ynab_updates) > 0: - try: - # Update existing transactions - api_response = api_instance.update_transactions(api_settings.budget_id, {"transactions":ynab_updates} ) - except ApiException as e: - print("Exception when calling TransactionsApi->update_transaction: %s\n" % e) \ No newline at end of file + ynab.UpdateTransactions(ynab_updates) + + logging.info("Sync done for %s\n", account_map['Name']) + +logging.info("Sync done for all") +sbanken.close() diff --git a/testdata/transactions.py b/testdata/transactions.py new file mode 100644 index 0000000..e525add --- /dev/null +++ b/testdata/transactions.py @@ -0,0 +1,214 @@ +######################################################################### +# Actual Transaction test data +# Data obtained from api - slightly modified to remove traceability +# + +### Testdata +visa_transaction = { + 'accountingDate': '2021-02-10T00:00:00', + 'interestDate': '2021-02-11T00:00:00', + 'otherAccountNumberSpecified': False, + 'amount': -10.21, + 'text': '*6755 09.02 NOK 10.21 STAVANGER PARKE Kurs: 1.0000', + 'transactionType': 'VISA VARE', + 'transactionTypeCode': 714, + 'transactionTypeText': 'VISA VARE', + 'isReservation': False, + 'reservationType': None, + 'source': 'Archive', + 'cardDetailsSpecified': True, + 'cardDetails': { + 'cardNumber': '*6755', + 'currencyAmount': 10.21, + 'currencyRate': 1.0, + 'merchantCategoryCode': '7523', + 'merchantCategoryDescription': 'Parkering, garasje', + 'merchantCity': 'STAVANGER', + 'merchantName': 'STAVANGER PARKE', + 'originalCurrencyCode': 'NOK', + 'purchaseDate': '2021-02-09T00:00:00', + 'transactionId': '481000000001540' + }, + 'transactionDetailSpecified': False} + +visa_transaction_long_date = { + 'accountingDate': '2021-06-15T00:00:00', + 'amount': -2790.0, + 'cardDetails': {'cardNumber': '*0392', + 'currencyAmount': 2790.0, + 'currencyRate': 1.0, + 'merchantCategoryCode': '5732', + 'merchantCategoryDescription': 'Elektronikk', + 'merchantCity': 'Lorenskog', + 'merchantName': 'Elkjop.no', + 'originalCurrencyCode': 'NOK', + 'purchaseDate': '2022-06-14T00:00:00', + 'transactionId': '4811655705445700'}, + 'cardDetailsSpecified': True, + 'interestDate': '2021-07-20T00:00:00', + 'isReservation': False, + 'otherAccountNumberSpecified': False, + 'reservationType': None, + 'source': 'Archive', + 'text': '*0392 14.06 NOK 2790.00 Elkjop.no Kurs: 1.0000', + 'transactionDetailSpecified': False, + 'transactionType': 'VISA VARE', + 'transactionTypeCode': 714, + 'transactionTypeText': 'VISA VARE'} + + +overf_transaction = { + 'accountingDate': '2021-02-09T00:00:00', + 'interestDate': '2021-02-09T00:00:00', + 'otherAccountNumberSpecified': False, + 'amount': 150.0, + 'text': 'Overføring mellom egne kontoer', + 'transactionType': 'OVFNETTB', + 'transactionTypeCode': 200, + 'transactionTypeText': 'OVFNETTB', + 'isReservation': False, + 'reservationType': None, + 'source': 'Archive', + 'cardDetailsSpecified': False, + 'transactionDetailSpecified': False} + +credit_transaction = { + 'accountingDate': '2021-02-13T00:00:00', + 'interestDate': '2021-02-13T00:00:00', + 'otherAccountNumberSpecified': False, + 'amount': -200.0, + 'text': 'MESTER GRøNN 20', + 'transactionType': 'Bekreftet VISA', + 'transactionTypeCode': 946, + 'transactionTypeText': '', + 'isReservation': True, + 'reservationType': 'VisaReservation', + 'source': 'AccountStatement', + 'cardDetailsSpecified': False, + 'transactionDetailSpecified': False} + +reserved_transaction = { + 'accountingDate': '2021-02-13T00:00:00', + 'interestDate': '2021-02-13T00:00:00', + 'otherAccountNumberSpecified': False, + 'amount': -187.0, + 'text': 'ROGALAND TAXI A', + 'transactionType': 'Bekreftet VISA', + 'transactionTypeCode': 946, + 'transactionTypeText': '', + 'isReservation': True, + 'reservationType': 'VisaReservation', + 'source': 'AccountStatement', + 'cardDetailsSpecified': False, + 'transactionDetailSpecified': False} + +vipps_transactiion = { + 'accountingDate': '2021-02-10T00:00:00', + 'interestDate': '2021-03-22T00:00:00', + 'otherAccountNumberSpecified': False, + 'amount': -500.0, + 'text': '*0392 09.02 NOK 500.00 Vipps*Jatta vgs. Tur idre Kurs: 1.0000', + 'transactionType': 'VISA VARE', + 'transactionTypeCode': 714, + 'transactionTypeText': 'VISA VARE', + 'isReservation': False, + 'reservationType': None, + 'source': 'Archive', + 'cardDetailsSpecified': True, + 'cardDetails': { + 'cardNumber': '*0392', + 'currencyAmount': 500.0, + 'currencyRate': 1.0, + 'merchantCategoryCode': '9399', + 'merchantCategoryDescription': 'Diverse', + 'merchantCity': 'Oslo', + 'merchantName': 'Vipps*Jatta vgs. Tur idre', + 'originalCurrencyCode': 'NOK', + 'purchaseDate': '2021-02-09T00:00:00', + 'transactionId': '4810000000000040'}, + 'transactionDetailSpecified': False} + +kolumbus_actual_transaction = { + 'accountingDate': '2021-02-10T00:00:00', + 'interestDate': '2021-03-22T00:00:00', + 'otherAccountNumberSpecified': False, + 'amount': -299.0, + 'text': '*5584 09.02 NOK 299.00 KOLUMBUS AS Kurs: 1.0000', + 'transactionType': 'VISA VARE', + 'transactionTypeCode': 714, + 'transactionTypeText': 'VISA VARE', + 'isReservation': False, + 'reservationType': None, + 'source': 'Archive', + 'cardDetailsSpecified': True, + 'cardDetails': { + 'cardNumber': '*5584', + 'currencyAmount': 299.0, + 'currencyRate': 1.0, + 'merchantCategoryCode': '4111', + 'merchantCategoryDescription': 'Transport/billett', + 'merchantCity': 'STAVANGER', + 'merchantName': 'KOLUMBUS AS', + 'originalCurrencyCode': 'NOK', + 'purchaseDate': '2021-02-09T00:00:00', + 'transactionId': '4810000000000310'}, + 'transactionDetailSpecified': False} + +google_actual_transaction = { + 'accountingDate': '2021-02-08T00:00:00', + 'interestDate': '2021-03-22T00:00:00', + 'otherAccountNumberSpecified': False, + 'amount': -49.0, + 'text': '*5584 06.02 NOK 49.00 GOOGLE *Google Kurs: 1.0000', + 'transactionType': 'VISA VARE', + 'transactionTypeCode': 714, + 'transactionTypeText': 'VISA VARE', + 'isReservation': False, + 'reservationType': None, + 'source': 'Archive', + 'cardDetailsSpecified': True, + 'cardDetails': { + 'cardNumber': '*5584', + 'currencyAmount': 49.0, + 'currencyRate': 1.0, + 'merchantCategoryCode': '5815', + 'merchantCategoryDescription': 'Digitale tjenester', + 'merchantCity': 'g.co/helppay#', + 'merchantName': 'GOOGLE *Google', + 'originalCurrencyCode': 'NOK', + 'purchaseDate': '2021-02-06T00:00:00', + 'transactionId': '481000000000060'}, + 'transactionDetailSpecified': False} + +nettgiro_actual_transaction_short_text = { + 'accountingDate': '2020-11-02T00:00:00', + 'amount': -1500.0, + 'cardDetailsSpecified': False, + 'interestDate': '2020-11-02T00:00:00', + 'isReservation': False, + 'otherAccountNumberSpecified': False, + 'reservationType': None, + 'source': 'Archive', + 'text': 'Nettgiro', + 'transactionDetailSpecified': False, + 'transactionType': 'NETTGIRO', + 'transactionTypeCode': 203, + 'transactionTypeText': 'NETTGIRO'} + +nettgiro_actual_transaction = { + 'accountingDate': '2020-11-02T00:00:00', + 'amount': -1500.0, + 'cardDetailsSpecified': False, + 'interestDate': '2020-11-02T00:00:00', + 'isReservation': False, + 'otherAccountNumberSpecified': False, + 'reservationType': None, + 'source': 'Archive', + 'text': 'Nettgiro til: Berntsen Anders Ca Betalt: 02.11.20', + 'transactionDetailSpecified': False, + 'transactionType': 'NETTGIRO', + 'transactionTypeCode': 203, + 'transactionTypeText': 'NETTGIRO'} + +test_transaction_list = [visa_transaction, overf_transaction, credit_transaction, reserved_transaction, vipps_transactiion, kolumbus_actual_transaction, google_actual_transaction] +test_trans_result_list = ['Stavanger parke', 'Overføring mellom egne kontoer', 'Mester grønn 20', 'Rogaland taxi a', 'Vipps*jatta vgs. tur idre', 'Kolumbus as', 'Google *google'] \ No newline at end of file diff --git a/testynabapi.py b/testynabapi.py new file mode 100644 index 0000000..a0a5485 --- /dev/null +++ b/testynabapi.py @@ -0,0 +1,23 @@ +import datetime +from pprint import pprint +from ynab.Ynab import Ynab +import api_settings + +# YNAB auth +ynab = Ynab(api_settings.api_key, api_settings.budget_id) + +ynab_accounts = ynab.GetAccounts() + +pprint(ynab_accounts) + +today = datetime.date.today() +endDate = today +startDate = today - datetime.timedelta(80) # Last 8 days - unless changed in api_settings + +existing_transactions = ynab.GetTransactionsByAccount('9280f4d8-92c4-46a4-aba1-0cb41a92f85b', startDate) + +pprint(existing_transactions) +yTrs = [] # Transactions to YNAB +sTrns = ynab.SaveTransaction(today, -20000, '9280f4d8-92c4-46a4-aba1-0cb41a92f85b', 'Tesing memo', '46a47-aba1', 'Brukskonto', []) +yTrs.append(sTrns) +ynab.CreateTransactions(yTrs) \ No newline at end of file diff --git a/ynab/Ynab.py b/ynab/Ynab.py new file mode 100644 index 0000000..d5092ca --- /dev/null +++ b/ynab/Ynab.py @@ -0,0 +1,126 @@ +import ynab_api +from ynab_api.api import accounts_api, transactions_api +from ynab_api.models import TransactionDetail, SaveTransaction, UpdateTransaction +# from ynab_api import exceptions, models + +class Ynab: + def __init__(self, api_key, budgetId): + self.budgetId = budgetId + self.api_key = api_key + + # Configure API key authorization: bearer + self.configuration = ynab_api.Configuration(host="https://api.youneedabudget.com/v1") + self.configuration.api_key['bearer'] = self.api_key + self.configuration.api_key_prefix['bearer'] = 'Bearer' + + + # # create an instance of the API class + self.api_client = ynab_api.ApiClient(self.configuration) + self.accounts_instance = accounts_api.AccountsApi(self.api_client) + self.transactions_instance = transactions_api.TransactionsApi(self.api_client) + + + + def GetAccounts(self): + # create an instance of the API class + # with ynab_api.ApiClient(self.configuration) as api_client: + # self.configuration = ynab_api.Configuration(host="https://api.youneedabudget.com/v1") + # self.configuration.api_key['bearer'] = self.api_key + # self.configuration.api_key_prefix['bearer'] = 'Bearer' + + + # create an instance of the API class + # self.api_client = ynab_api.ApiClient(self.configuration) + # self.accounts_instance = accounts_api.AccountsApi(self.api_client) + try: + # Get existing accounts for the budget + api_response = self.accounts_instance.get_accounts(self.budgetId) + except ynab_api.ApiException as e: + print("Exception when calling AccountsApi->get_accounts: %s\n" % e) + + return api_response.data.accounts + + + def GetTransactionsByAccount(self, accountId, fromDate): + # Configure API key authorization: bearer + # self.configuration = ynab_api.Configuration(host="https://api.youneedabudget.com/v1") + # self.configuration.api_key['bearer'] = self.api_key + # self.configuration.api_key_prefix['bearer'] = 'Bearer' + + + # create an instance of the API class + # self.api_client = ynab_api.ApiClient(self.configuration) + # self.transactions_instance = transactions_api.TransactionsApi(self.api_client) + try: + # Get existing transactions that are Reserved in case they need to be updated + api_response = self.transactions_instance.get_transactions_by_account(self.budgetId, accountId, since_date=fromDate) + + except ynab_api.ApiException as e: + print("Exception when calling AccountsApi->get_accounts: %s\n" % e) + + return api_response.data.transactions + + def CreateTransactions(self, transactionList): + # create an instance of the API class + # api_instance = self.transactions_instance.TransactionsApi(self.api_client) + try: + # Create new transaction + api_response = self.transactions_instance.create_transaction(self.budgetId, {"transactions":transactionList}) + except ynab_api.ApiException as e: + print("Exception when calling TransactionsApi->create_transaction: %s\n" % e) + + def UpdateTransactions(self, transactionList): + # create an instance of the API class + # api_instance = transactions_api.TransactionsApi(self.api_client) + try: + # Update existing transactions + api_response = self.transactions_instance.update_transactions(self.budgetId, {"transactions": transactionList}) + except ynab_api.ApiException as e: + print("Exception when calling TransactionsApi->update_transaction: %s\n" % e) + + def Transaction(self, tdate, tamount, accountId, tmemo, timportId, accountName, subtrans=[], transactionId = ''): + # api_instance = accounts_api.TransactionsApi(self.api_client) + return TransactionDetail( + date=tdate, + amount=tamount, + cleared='uncleared', + approved=False, + account_id=accountId, + account_name=accountName, + memo=tmemo, + import_id=timportId, + subtransactions=subtrans, + deleted=False, + id = transactionId + ) + + def SaveTransaction(self, tdate, tamount, accountId, tmemo, timportId, accountName, subtrans=[], transactionId = ''): + # api_instance = accounts_api.TransactionsApi(self.api_client) + return SaveTransaction( + date=tdate, + amount=tamount, + cleared='uncleared', + approved=False, + account_id=accountId, + account_name=accountName, + memo=tmemo, + import_id=timportId, + subtransactions=subtrans, + deleted=False, + id = transactionId + ) + + def UpdateTransaction(self, transaction): + return UpdateTransaction( + date = transaction.date, + amount = transaction.amount, + cleared = transaction.cleared, + approved = transaction.approved, + account_id = transaction.account_id, + account_name = transaction.account_name, + memo = transaction.memo, + import_id = transaction.import_id, + subtransactions = transaction.subtransactions, + deleted = transaction.deleted, + id = transaction.id + ) \ No newline at end of file diff --git a/ynab/__init__.py b/ynab/__init__.py deleted file mode 100644 index 602b62a..0000000 --- a/ynab/__init__.py +++ /dev/null @@ -1,96 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -# import apis into sdk package -from ynab.ynab.accounts_api import AccountsApi -from ynab.ynab.budgets_api import BudgetsApi -from ynab.ynab.categories_api import CategoriesApi -from ynab.ynab.months_api import MonthsApi -from ynab.ynab.payee_locations_api import PayeeLocationsApi -from ynab.ynab.payees_api import PayeesApi -from ynab.ynab.scheduled_transactions_api import ScheduledTransactionsApi -from ynab.ynab.transactions_api import TransactionsApi -from ynab.ynab.user_api import UserApi - -# import ApiClient -from ynab.api_client import ApiClient -from ynab.configuration import Configuration -# import models into sdk package -from ynab.models.account import Account -from ynab.models.account_response import AccountResponse -from ynab.models.account_wrapper import AccountWrapper -from ynab.models.accounts_response import AccountsResponse -from ynab.models.accounts_wrapper import AccountsWrapper -from ynab.models.budget_detail_response import BudgetDetailResponse -from ynab.models.budget_detail_wrapper import BudgetDetailWrapper -from ynab.models.budget_summary import BudgetSummary -from ynab.models.budget_summary_response import BudgetSummaryResponse -from ynab.models.budget_summary_wrapper import BudgetSummaryWrapper -from ynab.models.bulk_id_wrapper import BulkIdWrapper -from ynab.models.bulk_ids import BulkIds -from ynab.models.bulk_response import BulkResponse -from ynab.models.bulk_transactions import BulkTransactions -from ynab.models.categories_response import CategoriesResponse -from ynab.models.category import Category -from ynab.models.category_group import CategoryGroup -from ynab.models.category_groups_wrapper import CategoryGroupsWrapper -from ynab.models.category_response import CategoryResponse -from ynab.models.category_wrapper import CategoryWrapper -from ynab.models.currency_format import CurrencyFormat -from ynab.models.date_format import DateFormat -from ynab.models.error_detail import ErrorDetail -from ynab.models.error_response import ErrorResponse -from ynab.models.hybrid_transactions_response import HybridTransactionsResponse -from ynab.models.hybrid_transactions_wrapper import HybridTransactionsWrapper -from ynab.models.month_detail_response import MonthDetailResponse -from ynab.models.month_detail_wrapper import MonthDetailWrapper -from ynab.models.month_summaries_response import MonthSummariesResponse -from ynab.models.month_summaries_wrapper import MonthSummariesWrapper -from ynab.models.month_summary import MonthSummary -from ynab.models.payee import Payee -from ynab.models.payee_location import PayeeLocation -from ynab.models.payee_location_response import PayeeLocationResponse -from ynab.models.payee_location_wrapper import PayeeLocationWrapper -from ynab.models.payee_locations_response import PayeeLocationsResponse -from ynab.models.payee_locations_wrapper import PayeeLocationsWrapper -from ynab.models.payee_response import PayeeResponse -from ynab.models.payee_wrapper import PayeeWrapper -from ynab.models.payees_response import PayeesResponse -from ynab.models.payees_wrapper import PayeesWrapper -from ynab.models.save_transaction import SaveTransaction -from ynab.models.save_transaction_wrapper import SaveTransactionWrapper -from ynab.models.scheduled_sub_transaction import ScheduledSubTransaction -from ynab.models.scheduled_transaction_response import ScheduledTransactionResponse -from ynab.models.scheduled_transaction_summary import ScheduledTransactionSummary -from ynab.models.scheduled_transaction_wrapper import ScheduledTransactionWrapper -from ynab.models.scheduled_transactions_response import ScheduledTransactionsResponse -from ynab.models.scheduled_transactions_wrapper import ScheduledTransactionsWrapper -from ynab.models.sub_transaction import SubTransaction -from ynab.models.transaction_response import TransactionResponse -from ynab.models.transaction_summary import TransactionSummary -from ynab.models.transaction_wrapper import TransactionWrapper -from ynab.models.transactions_response import TransactionsResponse -from ynab.models.transactions_wrapper import TransactionsWrapper -from ynab.models.user import User -from ynab.models.user_response import UserResponse -from ynab.models.user_wrapper import UserWrapper -from ynab.models.budget_detail import BudgetDetail -from ynab.models.category_group_with_categories import CategoryGroupWithCategories -from ynab.models.hybrid_transaction import HybridTransaction -from ynab.models.month_detail import MonthDetail -from ynab.models.scheduled_transaction_detail import ScheduledTransactionDetail -from ynab.models.transaction_detail import TransactionDetail diff --git a/ynab/api_client.py b/ynab/api_client.py deleted file mode 100644 index bc9416d..0000000 --- a/ynab/api_client.py +++ /dev/null @@ -1,621 +0,0 @@ -# coding: utf-8 -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -from __future__ import absolute_import - -import datetime -import json -import mimetypes -from multiprocessing.pool import ThreadPool -import os -import re -import tempfile - -# python 2 and python 3 compatibility library -import six -from six.moves.urllib.parse import quote - -from ynab.configuration import Configuration -import ynab.models -from ynab import rest - - -class ApiClient(object): - """Generic API client for Swagger client library builds. - - Swagger generic API client. This client handles the client- - server communication, and is invariant across implementations. Specifics of - the methods and models for each application are generated from the Swagger - templates. - - NOTE: This class is auto generated by the swagger code generator program. - Ref: https://github.com/swagger-api/swagger-codegen - Do not edit the class manually. - - :param configuration: .Configuration object for this client - :param header_name: a header to pass when making calls to the API. - :param header_value: a header value to pass when making calls to - the API. - :param cookie: a cookie to include in the header when making calls - to the API - """ - - PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types - NATIVE_TYPES_MAPPING = { - 'int': int, - 'long': int if six.PY3 else long, # noqa: F821 - 'float': float, - 'str': str, - 'bool': bool, - 'date': datetime.date, - 'datetime': datetime.datetime, - 'object': object, - } - - def __init__(self, configuration=None, header_name=None, header_value=None, - cookie=None): - if configuration is None: - configuration = Configuration() - self.configuration = configuration - - self.pool = ThreadPool() - self.rest_client = rest.RESTClientObject(configuration) - self.default_headers = {} - if header_name is not None: - self.default_headers[header_name] = header_value - self.cookie = cookie - # Set default User-Agent. - self.user_agent = 'Swagger-Codegen/1.0.0/python' - - def __del__(self): - self.pool.close() - self.pool.join() - - @property - def user_agent(self): - """User agent for this API client""" - return self.default_headers['User-Agent'] - - @user_agent.setter - def user_agent(self, value): - self.default_headers['User-Agent'] = value - - def set_default_header(self, header_name, header_value): - self.default_headers[header_name] = header_value - - def __call_api( - self, resource_path, method, path_params=None, - query_params=None, header_params=None, body=None, post_params=None, - files=None, response_type=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None): - - config = self.configuration - - # header parameters - header_params = header_params or {} - header_params.update(self.default_headers) - if self.cookie: - header_params['Cookie'] = self.cookie - if header_params: - header_params = self.sanitize_for_serialization(header_params) - header_params = dict(self.parameters_to_tuples(header_params, - collection_formats)) - - # path parameters - if path_params: - path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, - collection_formats) - for k, v in path_params: - # specified safe chars, encode everything - resource_path = resource_path.replace( - '{%s}' % k, - quote(str(v), safe=config.safe_chars_for_path_param) - ) - - # query parameters - if query_params: - query_params = self.sanitize_for_serialization(query_params) - query_params = self.parameters_to_tuples(query_params, - collection_formats) - - # post parameters - if post_params or files: - post_params = self.prepare_post_parameters(post_params, files) - post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, - collection_formats) - - # auth setting - self.update_params_for_auth(header_params, query_params, auth_settings) - - # body - if body: - body = self.sanitize_for_serialization(body) - - # request url - url = self.configuration.host + resource_path - - # perform request and return response - response_data = self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout) - - self.last_response = response_data - - return_data = response_data - if _preload_content: - # deserialize response data - if response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None - - if _return_http_data_only: - return (return_data) - else: - return (return_data, response_data.status, - response_data.getheaders()) - - def sanitize_for_serialization(self, obj): - """Builds a JSON POST object. - - If obj is None, return None. - If obj is str, int, long, float, bool, return directly. - If obj is datetime.datetime, datetime.date - convert to string in iso8601 format. - If obj is list, sanitize each element in the list. - If obj is dict, return the dict. - If obj is swagger model, return the properties dict. - - :param obj: The data to serialize. - :return: The serialized form of data. - """ - if obj is None: - return None - elif isinstance(obj, self.PRIMITIVE_TYPES): - return obj - elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) - for sub_obj in obj] - elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) - for sub_obj in obj) - elif isinstance(obj, (datetime.datetime, datetime.date)): - return obj.isoformat() - - if isinstance(obj, dict): - obj_dict = obj - else: - # Convert model obj to dict except - # attributes `swagger_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) - for attr, _ in six.iteritems(obj.swagger_types) - if getattr(obj, attr) is not None} - - return {key: self.sanitize_for_serialization(val) - for key, val in six.iteritems(obj_dict)} - - def deserialize(self, response, response_type): - """Deserializes response into an object. - - :param response: RESTResponse object to be deserialized. - :param response_type: class literal for - deserialized object, or string of class name. - - :return: deserialized object. - """ - # handle file downloading - # save response body into a tmp file and return the instance - if response_type == "file": - return self.__deserialize_file(response) - - # fetch data from response object - try: - data = json.loads(response.data) - except ValueError: - data = response.data - - return self.__deserialize(data, response_type) - - def __deserialize(self, data, klass): - """Deserializes dict, list, str into an object. - - :param data: dict, list or str. - :param klass: class literal, or string of class name. - - :return: object. - """ - if data is None: - return None - - if type(klass) == str: - if klass.startswith('list['): - sub_kls = re.match('list\[(.*)\]', klass).group(1) - return [self.__deserialize(sub_data, sub_kls) - for sub_data in data] - - if klass.startswith('dict('): - sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2) - return {k: self.__deserialize(v, sub_kls) - for k, v in six.iteritems(data)} - - # convert str to class - if klass in self.NATIVE_TYPES_MAPPING: - klass = self.NATIVE_TYPES_MAPPING[klass] - else: - klass = getattr(ynab.models, klass) - - if klass in self.PRIMITIVE_TYPES: - return self.__deserialize_primitive(data, klass) - elif klass == object: - return self.__deserialize_object(data) - elif klass == datetime.date: - return self.__deserialize_date(data) - elif klass == datetime.datetime: - return self.__deserialize_datatime(data) - else: - return self.__deserialize_model(data, klass) - - def call_api(self, resource_path, method, - path_params=None, query_params=None, header_params=None, - body=None, post_params=None, files=None, - response_type=None, auth_settings=None, use_async=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None): - """Makes the HTTP request (synchronous) and returns deserialized data. - - To make an async request, set the use_async parameter. - - :param resource_path: Path to method endpoint. - :param method: Method to call. - :param path_params: Path parameters in the url. - :param query_params: Query parameters in the url. - :param header_params: Header parameters to be - placed in the request header. - :param body: Request body. - :param post_params dict: Request post form parameters, - for `application/x-www-form-urlencoded`, `multipart/form-data`. - :param auth_settings list: Auth Settings names for the request. - :param response: Response data type. - :param files dict: key -> filename, value -> filepath, - for `multipart/form-data`. - :param use_async bool: execute request asynchronously - :param _return_http_data_only: response data without head status code - and headers - :param collection_formats: dict of collection formats for path, query, - header, and post parameters. - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: - If use_async parameter is True, - the request will be called asynchronously. - The method will return the request thread. - If parameter use_async is False or missing, - then the method will return the response directly. - """ - if not use_async: - return self.__call_api(resource_path, method, - path_params, query_params, header_params, - body, post_params, files, - response_type, auth_settings, - _return_http_data_only, collection_formats, - _preload_content, _request_timeout) - else: - thread = self.pool.apply_async(self.__call_api, (resource_path, - method, path_params, query_params, - header_params, body, - post_params, files, - response_type, auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, _request_timeout)) - return thread - - def request(self, method, url, query_params=None, headers=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): - """Makes the HTTP request using RESTClient.""" - if method == "GET": - return self.rest_client.GET(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) - elif method == "HEAD": - return self.rest_client.HEAD(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) - elif method == "OPTIONS": - return self.rest_client.OPTIONS(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "POST": - return self.rest_client.POST(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "PUT": - return self.rest_client.PUT(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "PATCH": - return self.rest_client.PATCH(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "DELETE": - return self.rest_client.DELETE(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - else: - raise ValueError( - "http method must be `GET`, `HEAD`, `OPTIONS`," - " `POST`, `PATCH`, `PUT` or `DELETE`." - ) - - def parameters_to_tuples(self, params, collection_formats): - """Get parameters as list of tuples, formatting collections. - - :param params: Parameters as dict or list of two-tuples - :param dict collection_formats: Parameter collection formats - :return: Parameters as list of tuples, collections formatted - """ - new_params = [] - if collection_formats is None: - collection_formats = {} - for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 - if k in collection_formats: - collection_format = collection_formats[k] - if collection_format == 'multi': - new_params.extend((k, value) for value in v) - else: - if collection_format == 'ssv': - delimiter = ' ' - elif collection_format == 'tsv': - delimiter = '\t' - elif collection_format == 'pipes': - delimiter = '|' - else: # csv is the default - delimiter = ',' - new_params.append( - (k, delimiter.join(str(value) for value in v))) - else: - new_params.append((k, v)) - return new_params - - def prepare_post_parameters(self, post_params=None, files=None): - """Builds form parameters. - - :param post_params: Normal form parameters. - :param files: File parameters. - :return: Form parameters with files. - """ - params = [] - - if post_params: - params = post_params - - if files: - for k, v in six.iteritems(files): - if not v: - continue - file_names = v if type(v) is list else [v] - for n in file_names: - with open(n, 'rb') as f: - filename = os.path.basename(f.name) - filedata = f.read() - mimetype = (mimetypes.guess_type(filename)[0] or - 'application/octet-stream') - params.append( - tuple([k, tuple([filename, filedata, mimetype])])) - - return params - - def select_header_accept(self, accepts): - """Returns `Accept` based on an array of accepts provided. - - :param accepts: List of headers. - :return: Accept (e.g. application/json). - """ - if not accepts: - return - - accepts = [x.lower() for x in accepts] - - if 'application/json' in accepts: - return 'application/json' - else: - return ', '.join(accepts) - - def select_header_content_type(self, content_types): - """Returns `Content-Type` based on an array of content_types provided. - - :param content_types: List of content-types. - :return: Content-Type (e.g. application/json). - """ - if not content_types: - return 'application/json' - - content_types = [x.lower() for x in content_types] - - if 'application/json' in content_types or '*/*' in content_types: - return 'application/json' - else: - return content_types[0] - - def update_params_for_auth(self, headers, querys, auth_settings): - """Updates header and query params based on authentication setting. - - :param headers: Header parameters dict to be updated. - :param querys: Query parameters tuple list to be updated. - :param auth_settings: Authentication setting identifiers list. - """ - if not auth_settings: - return - - for auth in auth_settings: - auth_setting = self.configuration.auth_settings().get(auth) - if auth_setting: - if not auth_setting['value']: - continue - elif auth_setting['in'] == 'header': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - querys.append((auth_setting['key'], auth_setting['value'])) - else: - raise ValueError( - 'Authentication token must be in `query` or `header`' - ) - - def __deserialize_file(self, response): - """Deserializes body to file - - Saves response body into a file in a temporary folder, - using the filename from the `Content-Disposition` header if provided. - - :param response: RESTResponse. - :return: file path. - """ - fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) - os.close(fd) - os.remove(path) - - content_disposition = response.getheader("Content-Disposition") - if content_disposition: - filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', - content_disposition).group(1) - path = os.path.join(os.path.dirname(path), filename) - - with open(path, "wb") as f: - f.write(response.data) - - return path - - def __deserialize_primitive(self, data, klass): - """Deserializes string to primitive type. - - :param data: str. - :param klass: class literal. - - :return: int, long, float, str, bool. - """ - try: - return klass(data) - except UnicodeEncodeError: - return six.u(data) - except TypeError: - return data - - def __deserialize_object(self, value): - """Return a original value. - - :return: object. - """ - return value - - def __deserialize_date(self, string): - """Deserializes string to date. - - :param string: str. - :return: date. - """ - try: - from dateutil.parser import parse - return parse(string).date() - except ImportError: - return string - except ValueError: - raise rest.ApiException( - status=0, - reason="Failed to parse `{0}` as date object".format(string) - ) - - def __deserialize_datatime(self, string): - """Deserializes string to datetime. - - The string should be in iso8601 datetime format. - - :param string: str. - :return: datetime. - """ - try: - from dateutil.parser import parse - return parse(string) - except ImportError: - return string - except ValueError: - raise rest.ApiException( - status=0, - reason=( - "Failed to parse `{0}` as datetime object" - .format(string) - ) - ) - - def __deserialize_model(self, data, klass): - """Deserializes list or dict to model. - - :param data: dict, list. - :param klass: class literal. - :return: model object. - """ - - if not klass.swagger_types and not hasattr(klass, - 'get_real_child_model'): - return data - - kwargs = {} - if klass.swagger_types is not None: - for attr, attr_type in six.iteritems(klass.swagger_types): - if (data is not None and - klass.attribute_map[attr] in data and - isinstance(data, (list, dict))): - value = data[klass.attribute_map[attr]] - kwargs[attr] = self.__deserialize(value, attr_type) - - instance = klass(**kwargs) - - if hasattr(instance, 'get_real_child_model'): - klass_name = instance.get_real_child_model(data) - if klass_name: - instance = self.__deserialize(data, klass_name) - return instance diff --git a/ynab/configuration.py b/ynab/configuration.py deleted file mode 100644 index c354b07..0000000 --- a/ynab/configuration.py +++ /dev/null @@ -1,247 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import copy -import logging -import multiprocessing -import sys -import urllib3 - -import six -from six.moves import http_client as httplib - - -class TypeWithDefault(type): - def __init__(cls, name, bases, dct): - super(TypeWithDefault, cls).__init__(name, bases, dct) - cls._default = None - - def __call__(cls): - if cls._default is None: - cls._default = type.__call__(cls) - return copy.copy(cls._default) - - def set_default(cls, default): - cls._default = copy.copy(default) - - -class Configuration(six.with_metaclass(TypeWithDefault, object)): - """NOTE: This class is auto generated by the swagger code generator program. - - Ref: https://github.com/swagger-api/swagger-codegen - Do not edit the class manually. - """ - - def __init__(self): - """Constructor""" - # Default Base url - self.host = "https://api.youneedabudget.com/v1" - # Temp file folder for downloading files - self.temp_folder_path = None - - # Authentication Settings - # dict to store API key(s) - self.api_key = {} - # dict to store API prefix (e.g. Bearer) - self.api_key_prefix = {} - # Username for HTTP basic authentication - self.username = "" - # Password for HTTP basic authentication - self.password = "" - - # Logging Settings - self.logger = {} - self.logger["package_logger"] = logging.getLogger("ynab") - self.logger["urllib3_logger"] = logging.getLogger("urllib3") - # Log format - self.logger_format = '%(asctime)s %(levelname)s %(message)s' - # Log stream handler - self.logger_stream_handler = None - # Log file handler - self.logger_file_handler = None - # Debug file location - self.logger_file = None - # Debug switch - self.debug = False - - # SSL/TLS verification - # Set this to false to skip verifying SSL certificate when calling API - # from https server. - self.verify_ssl = True - # Set this to customize the certificate file to verify the peer. - self.ssl_ca_cert = None - # client certificate file - self.cert_file = None - # client key file - self.key_file = None - # Set this to True/False to enable/disable SSL hostname verification. - self.assert_hostname = None - - # urllib3 connection pool's maximum number of connections saved - # per pool. urllib3 uses 1 connection as default value, but this is - # not the best value when you are making a lot of possibly parallel - # requests to the same host, which is often the case here. - # cpu_count * 5 is used as default value to increase performance. - self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 - - # Proxy URL - self.proxy = None - # Safe chars for path_param - self.safe_chars_for_path_param = '' - - @property - def logger_file(self): - """The logger file. - - If the logger_file is None, then add stream handler and remove file - handler. Otherwise, add file handler and remove stream handler. - - :param value: The logger_file path. - :type: str - """ - return self.__logger_file - - @logger_file.setter - def logger_file(self, value): - """The logger file. - - If the logger_file is None, then add stream handler and remove file - handler. Otherwise, add file handler and remove stream handler. - - :param value: The logger_file path. - :type: str - """ - self.__logger_file = value - if self.__logger_file: - # If set logging file, - # then add file handler and remove stream handler. - self.logger_file_handler = logging.FileHandler(self.__logger_file) - self.logger_file_handler.setFormatter(self.logger_formatter) - for _, logger in six.iteritems(self.logger): - logger.addHandler(self.logger_file_handler) - if self.logger_stream_handler: - logger.removeHandler(self.logger_stream_handler) - else: - # If not set logging file, - # then add stream handler and remove file handler. - self.logger_stream_handler = logging.StreamHandler() - self.logger_stream_handler.setFormatter(self.logger_formatter) - for _, logger in six.iteritems(self.logger): - logger.addHandler(self.logger_stream_handler) - if self.logger_file_handler: - logger.removeHandler(self.logger_file_handler) - - @property - def debug(self): - """Debug status - - :param value: The debug status, True or False. - :type: bool - """ - return self.__debug - - @debug.setter - def debug(self, value): - """Debug status - - :param value: The debug status, True or False. - :type: bool - """ - self.__debug = value - if self.__debug: - # if debug status is True, turn on debug logging - for _, logger in six.iteritems(self.logger): - logger.setLevel(logging.DEBUG) - # turn on httplib debug - httplib.HTTPConnection.debuglevel = 1 - else: - # if debug status is False, turn off debug logging, - # setting log level to default `logging.WARNING` - for _, logger in six.iteritems(self.logger): - logger.setLevel(logging.WARNING) - # turn off httplib debug - httplib.HTTPConnection.debuglevel = 0 - - @property - def logger_format(self): - """The logger format. - - The logger_formatter will be updated when sets logger_format. - - :param value: The format string. - :type: str - """ - return self.__logger_format - - @logger_format.setter - def logger_format(self, value): - """The logger format. - - The logger_formatter will be updated when sets logger_format. - - :param value: The format string. - :type: str - """ - self.__logger_format = value - self.logger_formatter = logging.Formatter(self.__logger_format) - - def get_api_key_with_prefix(self, identifier): - """Gets API key (with prefix if set). - - :param identifier: The identifier of apiKey. - :return: The token for api key authentication. - """ - if (self.api_key.get(identifier) and - self.api_key_prefix.get(identifier)): - return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] # noqa: E501 - elif self.api_key.get(identifier): - return self.api_key[identifier] - - def get_basic_auth_token(self): - """Gets HTTP basic authentication header (string). - - :return: The token for basic HTTP authentication. - """ - return urllib3.util.make_headers( - basic_auth=self.username + ':' + self.password - ).get('authorization') - - def auth_settings(self): - """Gets Auth Settings dict for api client. - - :return: The Auth Settings information dict. - """ - return { - 'bearer': - { - 'type': 'api_key', - 'in': 'header', - 'key': 'Authorization', - 'value': self.get_api_key_with_prefix('Authorization') - }, - - } - - def to_debug_report(self): - """Gets the essential information for debugging. - - :return: The report for debugging. - """ - return "Python SDK Debug Report:\n"\ - "OS: {env}\n"\ - "Python Version: {pyversion}\n"\ - "Version of the API: 1.0.0\n"\ - "SDK Package Version: 1.0.0".\ - format(env=sys.platform, pyversion=sys.version) diff --git a/ynab/models/__init__.py b/ynab/models/__init__.py deleted file mode 100644 index eff9612..0000000 --- a/ynab/models/__init__.py +++ /dev/null @@ -1,81 +0,0 @@ -# coding: utf-8 - -# flake8: noqa -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -# import models into model package -from ynab.models.account import Account -from ynab.models.account_response import AccountResponse -from ynab.models.account_wrapper import AccountWrapper -from ynab.models.accounts_response import AccountsResponse -from ynab.models.accounts_wrapper import AccountsWrapper -from ynab.models.budget_detail_response import BudgetDetailResponse -from ynab.models.budget_detail_wrapper import BudgetDetailWrapper -from ynab.models.budget_summary import BudgetSummary -from ynab.models.budget_summary_response import BudgetSummaryResponse -from ynab.models.budget_summary_wrapper import BudgetSummaryWrapper -from ynab.models.bulk_id_wrapper import BulkIdWrapper -from ynab.models.bulk_ids import BulkIds -from ynab.models.bulk_response import BulkResponse -from ynab.models.bulk_transactions import BulkTransactions -from ynab.models.categories_response import CategoriesResponse -from ynab.models.category import Category -from ynab.models.category_group import CategoryGroup -from ynab.models.category_groups_wrapper import CategoryGroupsWrapper -from ynab.models.category_response import CategoryResponse -from ynab.models.category_wrapper import CategoryWrapper -from ynab.models.currency_format import CurrencyFormat -from ynab.models.date_format import DateFormat -from ynab.models.error_detail import ErrorDetail -from ynab.models.error_response import ErrorResponse -from ynab.models.hybrid_transactions_response import HybridTransactionsResponse -from ynab.models.hybrid_transactions_wrapper import HybridTransactionsWrapper -from ynab.models.month_detail_response import MonthDetailResponse -from ynab.models.month_detail_wrapper import MonthDetailWrapper -from ynab.models.month_summaries_response import MonthSummariesResponse -from ynab.models.month_summaries_wrapper import MonthSummariesWrapper -from ynab.models.month_summary import MonthSummary -from ynab.models.payee import Payee -from ynab.models.payee_location import PayeeLocation -from ynab.models.payee_location_response import PayeeLocationResponse -from ynab.models.payee_location_wrapper import PayeeLocationWrapper -from ynab.models.payee_locations_response import PayeeLocationsResponse -from ynab.models.payee_locations_wrapper import PayeeLocationsWrapper -from ynab.models.payee_response import PayeeResponse -from ynab.models.payee_wrapper import PayeeWrapper -from ynab.models.payees_response import PayeesResponse -from ynab.models.payees_wrapper import PayeesWrapper -from ynab.models.save_transaction import SaveTransaction -from ynab.models.save_transaction_wrapper import SaveTransactionWrapper -from ynab.models.scheduled_sub_transaction import ScheduledSubTransaction -from ynab.models.scheduled_transaction_response import ScheduledTransactionResponse -from ynab.models.scheduled_transaction_summary import ScheduledTransactionSummary -from ynab.models.scheduled_transaction_wrapper import ScheduledTransactionWrapper -from ynab.models.scheduled_transactions_response import ScheduledTransactionsResponse -from ynab.models.scheduled_transactions_wrapper import ScheduledTransactionsWrapper -from ynab.models.sub_transaction import SubTransaction -from ynab.models.transaction_response import TransactionResponse -from ynab.models.transaction_summary import TransactionSummary -from ynab.models.transaction_wrapper import TransactionWrapper -from ynab.models.transactions_response import TransactionsResponse -from ynab.models.transactions_wrapper import TransactionsWrapper -from ynab.models.user import User -from ynab.models.user_response import UserResponse -from ynab.models.user_wrapper import UserWrapper -from ynab.models.budget_detail import BudgetDetail -from ynab.models.category_group_with_categories import CategoryGroupWithCategories -from ynab.models.hybrid_transaction import HybridTransaction -from ynab.models.month_detail import MonthDetail -from ynab.models.scheduled_transaction_detail import ScheduledTransactionDetail -from ynab.models.transaction_detail import TransactionDetail diff --git a/ynab/models/account.py b/ynab/models/account.py deleted file mode 100644 index 47f6f5c..0000000 --- a/ynab/models/account.py +++ /dev/null @@ -1,357 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class Account(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'name': 'str', - 'type': 'str', - 'on_budget': 'bool', - 'closed': 'bool', - 'note': 'str', - 'balance': 'float', - 'cleared_balance': 'float', - 'uncleared_balance': 'float', - 'transfer_payee_id': 'str' - } - - attribute_map = { - 'id': 'id', - 'name': 'name', - 'type': 'type', - 'on_budget': 'on_budget', - 'closed': 'closed', - 'note': 'note', - 'balance': 'balance', - 'cleared_balance': 'cleared_balance', - 'uncleared_balance': 'uncleared_balance', - 'transfer_payee_id': 'transfer_payee_id' - } - - def __init__(self, id=None, name=None, type=None, on_budget=None, closed=None, note=None, balance=None, cleared_balance=None, uncleared_balance=None, transfer_payee_id=None): # noqa: E501 - """Account - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._name = None - self._type = None - self._on_budget = None - self._closed = None - self._note = None - self._balance = None - self._cleared_balance = None - self._uncleared_balance = None - self._transfer_payee_id = None - self.discriminator = None - - self.id = id - self.name = name - self.type = type - self.on_budget = on_budget - self.closed = closed - self.note = note - self.balance = balance - self.cleared_balance = cleared_balance - self.uncleared_balance = uncleared_balance - self.transfer_payee_id = transfer_payee_id - - @property - def transfer_payee_id(self): - return self._transfer_payee_id - - @transfer_payee_id.setter - def transfer_payee_id(self, transfer_payee_id): - if transfer_payee_id is None: - raise ValueError("Invalid value for 'transfer_payee_id', must not be None") - - self._transfer_payee_id = transfer_payee_id - - @property - def id(self): - """Gets the id of this Account. # noqa: E501 - - - :return: The id of this Account. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Account. - - - :param id: The id of this Account. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def name(self): - """Gets the name of this Account. # noqa: E501 - - - :return: The name of this Account. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this Account. - - - :param name: The name of this Account. # noqa: E501 - :type: str - """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - - self._name = name - - @property - def type(self): - """Gets the type of this Account. # noqa: E501 - - - :return: The type of this Account. # noqa: E501 - :rtype: str - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this Account. - - - :param type: The type of this Account. # noqa: E501 - :type: str - """ - if type is None: - raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 - allowed_values = ["checking", "savings", "creditCard", "cash", "lineOfCredit", "merchantAccount", "payPal", "investmentAccount", "mortgage", "otherAsset", "otherLiability"] # noqa: E501 - if type not in allowed_values: - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) - ) - - self._type = type - - @property - def on_budget(self): - """Gets the on_budget of this Account. # noqa: E501 - - Whether this account is on budget or not # noqa: E501 - - :return: The on_budget of this Account. # noqa: E501 - :rtype: bool - """ - return self._on_budget - - @on_budget.setter - def on_budget(self, on_budget): - """Sets the on_budget of this Account. - - Whether this account is on budget or not # noqa: E501 - - :param on_budget: The on_budget of this Account. # noqa: E501 - :type: bool - """ - if on_budget is None: - raise ValueError("Invalid value for `on_budget`, must not be `None`") # noqa: E501 - - self._on_budget = on_budget - - @property - def closed(self): - """Gets the closed of this Account. # noqa: E501 - - Whether this account is closed or not # noqa: E501 - - :return: The closed of this Account. # noqa: E501 - :rtype: bool - """ - return self._closed - - @closed.setter - def closed(self, closed): - """Sets the closed of this Account. - - Whether this account is closed or not # noqa: E501 - - :param closed: The closed of this Account. # noqa: E501 - :type: bool - """ - if closed is None: - raise ValueError("Invalid value for `closed`, must not be `None`") # noqa: E501 - - self._closed = closed - - @property - def note(self): - """Gets the note of this Account. # noqa: E501 - - - :return: The note of this Account. # noqa: E501 - :rtype: str - """ - return self._note - - @note.setter - def note(self, note): - """Sets the note of this Account. - - - :param note: The note of this Account. # noqa: E501 - :type: str - """ - self._note = note - - @property - def balance(self): - """Gets the balance of this Account. # noqa: E501 - - The current balance of the account in milliunits format # noqa: E501 - - :return: The balance of this Account. # noqa: E501 - :rtype: float - """ - return self._balance - - @balance.setter - def balance(self, balance): - """Sets the balance of this Account. - - The current balance of the account in milliunits format # noqa: E501 - - :param balance: The balance of this Account. # noqa: E501 - :type: float - """ - if balance is None: - raise ValueError("Invalid value for `balance`, must not be `None`") # noqa: E501 - - self._balance = balance - - @property - def cleared_balance(self): - """Gets the cleared_balance of this Account. # noqa: E501 - - The current cleared balance of the account in milliunits format # noqa: E501 - - :return: The cleared_balance of this Account. # noqa: E501 - :rtype: float - """ - return self._cleared_balance - - @cleared_balance.setter - def cleared_balance(self, cleared_balance): - """Sets the cleared_balance of this Account. - - The current cleared balance of the account in milliunits format # noqa: E501 - - :param cleared_balance: The cleared_balance of this Account. # noqa: E501 - :type: float - """ - if cleared_balance is None: - raise ValueError("Invalid value for `cleared_balance`, must not be `None`") # noqa: E501 - - self._cleared_balance = cleared_balance - - @property - def uncleared_balance(self): - """Gets the uncleared_balance of this Account. # noqa: E501 - - The current uncleared balance of the account in milliunits format # noqa: E501 - - :return: The uncleared_balance of this Account. # noqa: E501 - :rtype: float - """ - return self._uncleared_balance - - @uncleared_balance.setter - def uncleared_balance(self, uncleared_balance): - """Sets the uncleared_balance of this Account. - - The current uncleared balance of the account in milliunits format # noqa: E501 - - :param uncleared_balance: The uncleared_balance of this Account. # noqa: E501 - :type: float - """ - if uncleared_balance is None: - raise ValueError("Invalid value for `uncleared_balance`, must not be `None`") # noqa: E501 - - self._uncleared_balance = uncleared_balance - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Account): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/account_response.py b/ynab/models/account_response.py deleted file mode 100644 index 7fdb5cb..0000000 --- a/ynab/models/account_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.account_wrapper import AccountWrapper # noqa: F401,E501 - - -class AccountResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'AccountWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """AccountResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this AccountResponse. # noqa: E501 - - - :return: The data of this AccountResponse. # noqa: E501 - :rtype: AccountWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this AccountResponse. - - - :param data: The data of this AccountResponse. # noqa: E501 - :type: AccountWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AccountResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/account_wrapper.py b/ynab/models/account_wrapper.py deleted file mode 100644 index 796922c..0000000 --- a/ynab/models/account_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.account import Account # noqa: F401,E501 - - -class AccountWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'account': 'Account' - } - - attribute_map = { - 'account': 'account' - } - - def __init__(self, account=None): # noqa: E501 - """AccountWrapper - a model defined in Swagger""" # noqa: E501 - - self._account = None - self.discriminator = None - - self.account = account - - @property - def account(self): - """Gets the account of this AccountWrapper. # noqa: E501 - - - :return: The account of this AccountWrapper. # noqa: E501 - :rtype: Account - """ - return self._account - - @account.setter - def account(self, account): - """Sets the account of this AccountWrapper. - - - :param account: The account of this AccountWrapper. # noqa: E501 - :type: Account - """ - if account is None: - raise ValueError("Invalid value for `account`, must not be `None`") # noqa: E501 - - self._account = account - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AccountWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/accounts_response.py b/ynab/models/accounts_response.py deleted file mode 100644 index a8e9edc..0000000 --- a/ynab/models/accounts_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.accounts_wrapper import AccountsWrapper # noqa: F401,E501 - - -class AccountsResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'AccountsWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """AccountsResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this AccountsResponse. # noqa: E501 - - - :return: The data of this AccountsResponse. # noqa: E501 - :rtype: AccountsWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this AccountsResponse. - - - :param data: The data of this AccountsResponse. # noqa: E501 - :type: AccountsWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AccountsResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/accounts_wrapper.py b/ynab/models/accounts_wrapper.py deleted file mode 100644 index e6757f6..0000000 --- a/ynab/models/accounts_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.account import Account # noqa: F401,E501 - - -class AccountsWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'accounts': 'list[Account]' - } - - attribute_map = { - 'accounts': 'accounts' - } - - def __init__(self, accounts=None): # noqa: E501 - """AccountsWrapper - a model defined in Swagger""" # noqa: E501 - - self._accounts = None - self.discriminator = None - - self.accounts = accounts - - @property - def accounts(self): - """Gets the accounts of this AccountsWrapper. # noqa: E501 - - - :return: The accounts of this AccountsWrapper. # noqa: E501 - :rtype: list[Account] - """ - return self._accounts - - @accounts.setter - def accounts(self, accounts): - """Sets the accounts of this AccountsWrapper. - - - :param accounts: The accounts of this AccountsWrapper. # noqa: E501 - :type: list[Account] - """ - if accounts is None: - raise ValueError("Invalid value for `accounts`, must not be `None`") # noqa: E501 - - self._accounts = accounts - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AccountsWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/budget_detail.py b/ynab/models/budget_detail.py deleted file mode 100644 index 1a558d9..0000000 --- a/ynab/models/budget_detail.py +++ /dev/null @@ -1,494 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.account import Account # noqa: F401,E501 -from ynab.models.budget_summary import BudgetSummary # noqa: F401,E501 -from ynab.models.category import Category # noqa: F401,E501 -from ynab.models.category_group import CategoryGroup # noqa: F401,E501 -from ynab.models.currency_format import CurrencyFormat # noqa: F401,E501 -from ynab.models.date_format import DateFormat # noqa: F401,E501 -from ynab.models.month_detail import MonthDetail # noqa: F401,E501 -from ynab.models.payee import Payee # noqa: F401,E501 -from ynab.models.payee_location import PayeeLocation # noqa: F401,E501 -from ynab.models.scheduled_sub_transaction import ScheduledSubTransaction # noqa: F401,E501 -from ynab.models.scheduled_transaction_summary import ScheduledTransactionSummary # noqa: F401,E501 -from ynab.models.sub_transaction import SubTransaction # noqa: F401,E501 -from ynab.models.transaction_summary import TransactionSummary # noqa: F401,E501 - - -class BudgetDetail(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'name': 'str', - 'last_modified_on': 'datetime', - 'date_format': 'DateFormat', - 'currency_format': 'CurrencyFormat', - 'accounts': 'list[Account]', - 'payees': 'list[Payee]', - 'payee_locations': 'list[PayeeLocation]', - 'category_groups': 'list[CategoryGroup]', - 'categories': 'list[Category]', - 'months': 'list[MonthDetail]', - 'transactions': 'list[TransactionSummary]', - 'subtransactions': 'list[SubTransaction]', - 'scheduled_transactions': 'list[ScheduledTransactionSummary]', - 'scheduled_subtransactions': 'list[ScheduledSubTransaction]' - } - - attribute_map = { - 'id': 'id', - 'name': 'name', - 'last_modified_on': 'last_modified_on', - 'date_format': 'date_format', - 'currency_format': 'currency_format', - 'accounts': 'accounts', - 'payees': 'payees', - 'payee_locations': 'payee_locations', - 'category_groups': 'category_groups', - 'categories': 'categories', - 'months': 'months', - 'transactions': 'transactions', - 'subtransactions': 'subtransactions', - 'scheduled_transactions': 'scheduled_transactions', - 'scheduled_subtransactions': 'scheduled_subtransactions' - } - - def __init__(self, id=None, name=None, last_modified_on=None, date_format=None, currency_format=None, accounts=None, payees=None, payee_locations=None, category_groups=None, categories=None, months=None, transactions=None, subtransactions=None, scheduled_transactions=None, scheduled_subtransactions=None): # noqa: E501 - """BudgetDetail - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._name = None - self._last_modified_on = None - self._date_format = None - self._currency_format = None - self._accounts = None - self._payees = None - self._payee_locations = None - self._category_groups = None - self._categories = None - self._months = None - self._transactions = None - self._subtransactions = None - self._scheduled_transactions = None - self._scheduled_subtransactions = None - self.discriminator = None - - self.id = id - self.name = name - if last_modified_on is not None: - self.last_modified_on = last_modified_on - if date_format is not None: - self.date_format = date_format - if currency_format is not None: - self.currency_format = currency_format - if accounts is not None: - self.accounts = accounts - if payees is not None: - self.payees = payees - if payee_locations is not None: - self.payee_locations = payee_locations - if category_groups is not None: - self.category_groups = category_groups - if categories is not None: - self.categories = categories - if months is not None: - self.months = months - if transactions is not None: - self.transactions = transactions - if subtransactions is not None: - self.subtransactions = subtransactions - if scheduled_transactions is not None: - self.scheduled_transactions = scheduled_transactions - if scheduled_subtransactions is not None: - self.scheduled_subtransactions = scheduled_subtransactions - - @property - def id(self): - """Gets the id of this BudgetDetail. # noqa: E501 - - - :return: The id of this BudgetDetail. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this BudgetDetail. - - - :param id: The id of this BudgetDetail. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def name(self): - """Gets the name of this BudgetDetail. # noqa: E501 - - - :return: The name of this BudgetDetail. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this BudgetDetail. - - - :param name: The name of this BudgetDetail. # noqa: E501 - :type: str - """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - - self._name = name - - @property - def last_modified_on(self): - """Gets the last_modified_on of this BudgetDetail. # noqa: E501 - - The last time any changes were made to the budget from either a web or mobile client. # noqa: E501 - - :return: The last_modified_on of this BudgetDetail. # noqa: E501 - :rtype: datetime - """ - return self._last_modified_on - - @last_modified_on.setter - def last_modified_on(self, last_modified_on): - """Sets the last_modified_on of this BudgetDetail. - - The last time any changes were made to the budget from either a web or mobile client. # noqa: E501 - - :param last_modified_on: The last_modified_on of this BudgetDetail. # noqa: E501 - :type: datetime - """ - - self._last_modified_on = last_modified_on - - @property - def date_format(self): - """Gets the date_format of this BudgetDetail. # noqa: E501 - - - :return: The date_format of this BudgetDetail. # noqa: E501 - :rtype: DateFormat - """ - return self._date_format - - @date_format.setter - def date_format(self, date_format): - """Sets the date_format of this BudgetDetail. - - - :param date_format: The date_format of this BudgetDetail. # noqa: E501 - :type: DateFormat - """ - - self._date_format = date_format - - @property - def currency_format(self): - """Gets the currency_format of this BudgetDetail. # noqa: E501 - - - :return: The currency_format of this BudgetDetail. # noqa: E501 - :rtype: CurrencyFormat - """ - return self._currency_format - - @currency_format.setter - def currency_format(self, currency_format): - """Sets the currency_format of this BudgetDetail. - - - :param currency_format: The currency_format of this BudgetDetail. # noqa: E501 - :type: CurrencyFormat - """ - - self._currency_format = currency_format - - @property - def accounts(self): - """Gets the accounts of this BudgetDetail. # noqa: E501 - - - :return: The accounts of this BudgetDetail. # noqa: E501 - :rtype: list[Account] - """ - return self._accounts - - @accounts.setter - def accounts(self, accounts): - """Sets the accounts of this BudgetDetail. - - - :param accounts: The accounts of this BudgetDetail. # noqa: E501 - :type: list[Account] - """ - - self._accounts = accounts - - @property - def payees(self): - """Gets the payees of this BudgetDetail. # noqa: E501 - - - :return: The payees of this BudgetDetail. # noqa: E501 - :rtype: list[Payee] - """ - return self._payees - - @payees.setter - def payees(self, payees): - """Sets the payees of this BudgetDetail. - - - :param payees: The payees of this BudgetDetail. # noqa: E501 - :type: list[Payee] - """ - - self._payees = payees - - @property - def payee_locations(self): - """Gets the payee_locations of this BudgetDetail. # noqa: E501 - - - :return: The payee_locations of this BudgetDetail. # noqa: E501 - :rtype: list[PayeeLocation] - """ - return self._payee_locations - - @payee_locations.setter - def payee_locations(self, payee_locations): - """Sets the payee_locations of this BudgetDetail. - - - :param payee_locations: The payee_locations of this BudgetDetail. # noqa: E501 - :type: list[PayeeLocation] - """ - - self._payee_locations = payee_locations - - @property - def category_groups(self): - """Gets the category_groups of this BudgetDetail. # noqa: E501 - - - :return: The category_groups of this BudgetDetail. # noqa: E501 - :rtype: list[CategoryGroup] - """ - return self._category_groups - - @category_groups.setter - def category_groups(self, category_groups): - """Sets the category_groups of this BudgetDetail. - - - :param category_groups: The category_groups of this BudgetDetail. # noqa: E501 - :type: list[CategoryGroup] - """ - - self._category_groups = category_groups - - @property - def categories(self): - """Gets the categories of this BudgetDetail. # noqa: E501 - - - :return: The categories of this BudgetDetail. # noqa: E501 - :rtype: list[Category] - """ - return self._categories - - @categories.setter - def categories(self, categories): - """Sets the categories of this BudgetDetail. - - - :param categories: The categories of this BudgetDetail. # noqa: E501 - :type: list[Category] - """ - - self._categories = categories - - @property - def months(self): - """Gets the months of this BudgetDetail. # noqa: E501 - - - :return: The months of this BudgetDetail. # noqa: E501 - :rtype: list[MonthDetail] - """ - return self._months - - @months.setter - def months(self, months): - """Sets the months of this BudgetDetail. - - - :param months: The months of this BudgetDetail. # noqa: E501 - :type: list[MonthDetail] - """ - - self._months = months - - @property - def transactions(self): - """Gets the transactions of this BudgetDetail. # noqa: E501 - - - :return: The transactions of this BudgetDetail. # noqa: E501 - :rtype: list[TransactionSummary] - """ - return self._transactions - - @transactions.setter - def transactions(self, transactions): - """Sets the transactions of this BudgetDetail. - - - :param transactions: The transactions of this BudgetDetail. # noqa: E501 - :type: list[TransactionSummary] - """ - - self._transactions = transactions - - @property - def subtransactions(self): - """Gets the subtransactions of this BudgetDetail. # noqa: E501 - - - :return: The subtransactions of this BudgetDetail. # noqa: E501 - :rtype: list[SubTransaction] - """ - return self._subtransactions - - @subtransactions.setter - def subtransactions(self, subtransactions): - """Sets the subtransactions of this BudgetDetail. - - - :param subtransactions: The subtransactions of this BudgetDetail. # noqa: E501 - :type: list[SubTransaction] - """ - - self._subtransactions = subtransactions - - @property - def scheduled_transactions(self): - """Gets the scheduled_transactions of this BudgetDetail. # noqa: E501 - - - :return: The scheduled_transactions of this BudgetDetail. # noqa: E501 - :rtype: list[ScheduledTransactionSummary] - """ - return self._scheduled_transactions - - @scheduled_transactions.setter - def scheduled_transactions(self, scheduled_transactions): - """Sets the scheduled_transactions of this BudgetDetail. - - - :param scheduled_transactions: The scheduled_transactions of this BudgetDetail. # noqa: E501 - :type: list[ScheduledTransactionSummary] - """ - - self._scheduled_transactions = scheduled_transactions - - @property - def scheduled_subtransactions(self): - """Gets the scheduled_subtransactions of this BudgetDetail. # noqa: E501 - - - :return: The scheduled_subtransactions of this BudgetDetail. # noqa: E501 - :rtype: list[ScheduledSubTransaction] - """ - return self._scheduled_subtransactions - - @scheduled_subtransactions.setter - def scheduled_subtransactions(self, scheduled_subtransactions): - """Sets the scheduled_subtransactions of this BudgetDetail. - - - :param scheduled_subtransactions: The scheduled_subtransactions of this BudgetDetail. # noqa: E501 - :type: list[ScheduledSubTransaction] - """ - - self._scheduled_subtransactions = scheduled_subtransactions - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, BudgetDetail): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/budget_detail_response.py b/ynab/models/budget_detail_response.py deleted file mode 100644 index f020f1f..0000000 --- a/ynab/models/budget_detail_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.budget_detail_wrapper import BudgetDetailWrapper # noqa: F401,E501 - - -class BudgetDetailResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'BudgetDetailWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """BudgetDetailResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this BudgetDetailResponse. # noqa: E501 - - - :return: The data of this BudgetDetailResponse. # noqa: E501 - :rtype: BudgetDetailWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this BudgetDetailResponse. - - - :param data: The data of this BudgetDetailResponse. # noqa: E501 - :type: BudgetDetailWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, BudgetDetailResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/budget_detail_wrapper.py b/ynab/models/budget_detail_wrapper.py deleted file mode 100644 index b5e1f75..0000000 --- a/ynab/models/budget_detail_wrapper.py +++ /dev/null @@ -1,144 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.budget_detail import BudgetDetail # noqa: F401,E501 - - -class BudgetDetailWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'budget': 'BudgetDetail', - 'server_knowledge': 'float' - } - - attribute_map = { - 'budget': 'budget', - 'server_knowledge': 'server_knowledge' - } - - def __init__(self, budget=None, server_knowledge=None): # noqa: E501 - """BudgetDetailWrapper - a model defined in Swagger""" # noqa: E501 - - self._budget = None - self._server_knowledge = None - self.discriminator = None - - self.budget = budget - self.server_knowledge = server_knowledge - - @property - def budget(self): - """Gets the budget of this BudgetDetailWrapper. # noqa: E501 - - - :return: The budget of this BudgetDetailWrapper. # noqa: E501 - :rtype: BudgetDetail - """ - return self._budget - - @budget.setter - def budget(self, budget): - """Sets the budget of this BudgetDetailWrapper. - - - :param budget: The budget of this BudgetDetailWrapper. # noqa: E501 - :type: BudgetDetail - """ - if budget is None: - raise ValueError("Invalid value for `budget`, must not be `None`") # noqa: E501 - - self._budget = budget - - @property - def server_knowledge(self): - """Gets the server_knowledge of this BudgetDetailWrapper. # noqa: E501 - - The knowledge of the server # noqa: E501 - - :return: The server_knowledge of this BudgetDetailWrapper. # noqa: E501 - :rtype: float - """ - return self._server_knowledge - - @server_knowledge.setter - def server_knowledge(self, server_knowledge): - """Sets the server_knowledge of this BudgetDetailWrapper. - - The knowledge of the server # noqa: E501 - - :param server_knowledge: The server_knowledge of this BudgetDetailWrapper. # noqa: E501 - :type: float - """ - if server_knowledge is None: - raise ValueError("Invalid value for `server_knowledge`, must not be `None`") # noqa: E501 - - self._server_knowledge = server_knowledge - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, BudgetDetailWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/budget_summary.py b/ynab/models/budget_summary.py deleted file mode 100644 index 9adb640..0000000 --- a/ynab/models/budget_summary.py +++ /dev/null @@ -1,223 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.currency_format import CurrencyFormat # noqa: F401,E501 -from ynab.models.date_format import DateFormat # noqa: F401,E501 - - -class BudgetSummary(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'name': 'str', - 'last_modified_on': 'datetime', - 'date_format': 'DateFormat', - 'currency_format': 'CurrencyFormat' - } - - attribute_map = { - 'id': 'id', - 'name': 'name', - 'last_modified_on': 'last_modified_on', - 'date_format': 'date_format', - 'currency_format': 'currency_format' - } - - def __init__(self, id=None, name=None, last_modified_on=None, date_format=None, currency_format=None): # noqa: E501 - """BudgetSummary - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._name = None - self._last_modified_on = None - self._date_format = None - self._currency_format = None - self.discriminator = None - - self.id = id - self.name = name - if last_modified_on is not None: - self.last_modified_on = last_modified_on - if date_format is not None: - self.date_format = date_format - if currency_format is not None: - self.currency_format = currency_format - - @property - def id(self): - """Gets the id of this BudgetSummary. # noqa: E501 - - - :return: The id of this BudgetSummary. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this BudgetSummary. - - - :param id: The id of this BudgetSummary. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def name(self): - """Gets the name of this BudgetSummary. # noqa: E501 - - - :return: The name of this BudgetSummary. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this BudgetSummary. - - - :param name: The name of this BudgetSummary. # noqa: E501 - :type: str - """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - - self._name = name - - @property - def last_modified_on(self): - """Gets the last_modified_on of this BudgetSummary. # noqa: E501 - - The last time any changes were made to the budget from either a web or mobile client. # noqa: E501 - - :return: The last_modified_on of this BudgetSummary. # noqa: E501 - :rtype: datetime - """ - return self._last_modified_on - - @last_modified_on.setter - def last_modified_on(self, last_modified_on): - """Sets the last_modified_on of this BudgetSummary. - - The last time any changes were made to the budget from either a web or mobile client. # noqa: E501 - - :param last_modified_on: The last_modified_on of this BudgetSummary. # noqa: E501 - :type: datetime - """ - - self._last_modified_on = last_modified_on - - @property - def date_format(self): - """Gets the date_format of this BudgetSummary. # noqa: E501 - - - :return: The date_format of this BudgetSummary. # noqa: E501 - :rtype: DateFormat - """ - return self._date_format - - @date_format.setter - def date_format(self, date_format): - """Sets the date_format of this BudgetSummary. - - - :param date_format: The date_format of this BudgetSummary. # noqa: E501 - :type: DateFormat - """ - - self._date_format = date_format - - @property - def currency_format(self): - """Gets the currency_format of this BudgetSummary. # noqa: E501 - - - :return: The currency_format of this BudgetSummary. # noqa: E501 - :rtype: CurrencyFormat - """ - return self._currency_format - - @currency_format.setter - def currency_format(self, currency_format): - """Sets the currency_format of this BudgetSummary. - - - :param currency_format: The currency_format of this BudgetSummary. # noqa: E501 - :type: CurrencyFormat - """ - - self._currency_format = currency_format - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, BudgetSummary): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/budget_summary_response.py b/ynab/models/budget_summary_response.py deleted file mode 100644 index bedb0ae..0000000 --- a/ynab/models/budget_summary_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.budget_summary_wrapper import BudgetSummaryWrapper # noqa: F401,E501 - - -class BudgetSummaryResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'BudgetSummaryWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """BudgetSummaryResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this BudgetSummaryResponse. # noqa: E501 - - - :return: The data of this BudgetSummaryResponse. # noqa: E501 - :rtype: BudgetSummaryWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this BudgetSummaryResponse. - - - :param data: The data of this BudgetSummaryResponse. # noqa: E501 - :type: BudgetSummaryWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, BudgetSummaryResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/budget_summary_wrapper.py b/ynab/models/budget_summary_wrapper.py deleted file mode 100644 index a45abdc..0000000 --- a/ynab/models/budget_summary_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.budget_summary import BudgetSummary # noqa: F401,E501 - - -class BudgetSummaryWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'budgets': 'list[BudgetSummary]' - } - - attribute_map = { - 'budgets': 'budgets' - } - - def __init__(self, budgets=None): # noqa: E501 - """BudgetSummaryWrapper - a model defined in Swagger""" # noqa: E501 - - self._budgets = None - self.discriminator = None - - self.budgets = budgets - - @property - def budgets(self): - """Gets the budgets of this BudgetSummaryWrapper. # noqa: E501 - - - :return: The budgets of this BudgetSummaryWrapper. # noqa: E501 - :rtype: list[BudgetSummary] - """ - return self._budgets - - @budgets.setter - def budgets(self, budgets): - """Sets the budgets of this BudgetSummaryWrapper. - - - :param budgets: The budgets of this BudgetSummaryWrapper. # noqa: E501 - :type: list[BudgetSummary] - """ - if budgets is None: - raise ValueError("Invalid value for `budgets`, must not be `None`") # noqa: E501 - - self._budgets = budgets - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, BudgetSummaryWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/bulk_id_wrapper.py b/ynab/models/bulk_id_wrapper.py deleted file mode 100644 index f8df22d..0000000 --- a/ynab/models/bulk_id_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.bulk_ids import BulkIds # noqa: F401,E501 - - -class BulkIdWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'bulk': 'BulkIds' - } - - attribute_map = { - 'bulk': 'bulk' - } - - def __init__(self, bulk=None): # noqa: E501 - """BulkIdWrapper - a model defined in Swagger""" # noqa: E501 - - self._bulk = None - self.discriminator = None - - self.bulk = bulk - - @property - def bulk(self): - """Gets the bulk of this BulkIdWrapper. # noqa: E501 - - - :return: The bulk of this BulkIdWrapper. # noqa: E501 - :rtype: BulkIds - """ - return self._bulk - - @bulk.setter - def bulk(self, bulk): - """Sets the bulk of this BulkIdWrapper. - - - :param bulk: The bulk of this BulkIdWrapper. # noqa: E501 - :type: BulkIds - """ - if bulk is None: - raise ValueError("Invalid value for `bulk`, must not be `None`") # noqa: E501 - - self._bulk = bulk - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, BulkIdWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/bulk_ids.py b/ynab/models/bulk_ids.py deleted file mode 100644 index 7c45c3d..0000000 --- a/ynab/models/bulk_ids.py +++ /dev/null @@ -1,144 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class BulkIds(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'transaction_ids': 'list[str]', - 'duplicate_import_ids': 'list[str]' - } - - attribute_map = { - 'transaction_ids': 'transaction_ids', - 'duplicate_import_ids': 'duplicate_import_ids' - } - - def __init__(self, transaction_ids=None, duplicate_import_ids=None): # noqa: E501 - """BulkIds - a model defined in Swagger""" # noqa: E501 - - self._transaction_ids = None - self._duplicate_import_ids = None - self.discriminator = None - - self.transaction_ids = transaction_ids - self.duplicate_import_ids = duplicate_import_ids - - @property - def transaction_ids(self): - """Gets the transaction_ids of this BulkIds. # noqa: E501 - - The list of Transaction IDs that were created. # noqa: E501 - - :return: The transaction_ids of this BulkIds. # noqa: E501 - :rtype: list[str] - """ - return self._transaction_ids - - @transaction_ids.setter - def transaction_ids(self, transaction_ids): - """Sets the transaction_ids of this BulkIds. - - The list of Transaction IDs that were created. # noqa: E501 - - :param transaction_ids: The transaction_ids of this BulkIds. # noqa: E501 - :type: list[str] - """ - if transaction_ids is None: - raise ValueError("Invalid value for `transaction_ids`, must not be `None`") # noqa: E501 - - self._transaction_ids = transaction_ids - - @property - def duplicate_import_ids(self): - """Gets the duplicate_import_ids of this BulkIds. # noqa: E501 - - If any Transactions were not created because they had an import_id matching a transaction already on the same account, the specified import_id(s) will be included in this list. # noqa: E501 - - :return: The duplicate_import_ids of this BulkIds. # noqa: E501 - :rtype: list[str] - """ - return self._duplicate_import_ids - - @duplicate_import_ids.setter - def duplicate_import_ids(self, duplicate_import_ids): - """Sets the duplicate_import_ids of this BulkIds. - - If any Transactions were not created because they had an import_id matching a transaction already on the same account, the specified import_id(s) will be included in this list. # noqa: E501 - - :param duplicate_import_ids: The duplicate_import_ids of this BulkIds. # noqa: E501 - :type: list[str] - """ - if duplicate_import_ids is None: - raise ValueError("Invalid value for `duplicate_import_ids`, must not be `None`") # noqa: E501 - - self._duplicate_import_ids = duplicate_import_ids - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, BulkIds): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/bulk_response.py b/ynab/models/bulk_response.py deleted file mode 100644 index eb90a05..0000000 --- a/ynab/models/bulk_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.bulk_id_wrapper import BulkIdWrapper # noqa: F401,E501 - - -class BulkResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'BulkIdWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """BulkResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this BulkResponse. # noqa: E501 - - - :return: The data of this BulkResponse. # noqa: E501 - :rtype: BulkIdWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this BulkResponse. - - - :param data: The data of this BulkResponse. # noqa: E501 - :type: BulkIdWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, BulkResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/bulk_transactions.py b/ynab/models/bulk_transactions.py deleted file mode 100644 index c94005d..0000000 --- a/ynab/models/bulk_transactions.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.save_transaction import SaveTransaction # noqa: F401,E501 - - -class BulkTransactions(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'transactions': 'list[SaveTransaction]' - } - - attribute_map = { - 'transactions': 'transactions' - } - - def __init__(self, transactions=None): # noqa: E501 - """BulkTransactions - a model defined in Swagger""" # noqa: E501 - - self._transactions = None - self.discriminator = None - - self.transactions = transactions - - @property - def transactions(self): - """Gets the transactions of this BulkTransactions. # noqa: E501 - - - :return: The transactions of this BulkTransactions. # noqa: E501 - :rtype: list[SaveTransaction] - """ - return self._transactions - - @transactions.setter - def transactions(self, transactions): - """Sets the transactions of this BulkTransactions. - - - :param transactions: The transactions of this BulkTransactions. # noqa: E501 - :type: list[SaveTransaction] - """ - if transactions is None: - raise ValueError("Invalid value for `transactions`, must not be `None`") # noqa: E501 - - self._transactions = transactions - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, BulkTransactions): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/categories_response.py b/ynab/models/categories_response.py deleted file mode 100644 index 8c7ce6b..0000000 --- a/ynab/models/categories_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.category_groups_wrapper import CategoryGroupsWrapper # noqa: F401,E501 - - -class CategoriesResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'CategoryGroupsWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """CategoriesResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this CategoriesResponse. # noqa: E501 - - - :return: The data of this CategoriesResponse. # noqa: E501 - :rtype: CategoryGroupsWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this CategoriesResponse. - - - :param data: The data of this CategoriesResponse. # noqa: E501 - :type: CategoryGroupsWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CategoriesResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/category.py b/ynab/models/category.py deleted file mode 100644 index f9381f4..0000000 --- a/ynab/models/category.py +++ /dev/null @@ -1,307 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class Category(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'category_group_id': 'str', - 'name': 'str', - 'hidden': 'bool', - 'note': 'str', - 'budgeted': 'float', - 'activity': 'float', - 'balance': 'float' - } - - attribute_map = { - 'id': 'id', - 'category_group_id': 'category_group_id', - 'name': 'name', - 'hidden': 'hidden', - 'note': 'note', - 'budgeted': 'budgeted', - 'activity': 'activity', - 'balance': 'balance' - } - - def __init__(self, id=None, category_group_id=None, name=None, hidden=None, note=None, budgeted=None, activity=None, balance=None): # noqa: E501 - """Category - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._category_group_id = None - self._name = None - self._hidden = None - self._note = None - self._budgeted = None - self._activity = None - self._balance = None - self.discriminator = None - - self.id = id - self.category_group_id = category_group_id - self.name = name - self.hidden = hidden - self.note = note - self.budgeted = budgeted - self.activity = activity - self.balance = balance - - @property - def id(self): - """Gets the id of this Category. # noqa: E501 - - - :return: The id of this Category. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Category. - - - :param id: The id of this Category. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def category_group_id(self): - """Gets the category_group_id of this Category. # noqa: E501 - - - :return: The category_group_id of this Category. # noqa: E501 - :rtype: str - """ - return self._category_group_id - - @category_group_id.setter - def category_group_id(self, category_group_id): - """Sets the category_group_id of this Category. - - - :param category_group_id: The category_group_id of this Category. # noqa: E501 - :type: str - """ - if category_group_id is None: - raise ValueError("Invalid value for `category_group_id`, must not be `None`") # noqa: E501 - - self._category_group_id = category_group_id - - @property - def name(self): - """Gets the name of this Category. # noqa: E501 - - - :return: The name of this Category. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this Category. - - - :param name: The name of this Category. # noqa: E501 - :type: str - """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - - self._name = name - - @property - def hidden(self): - """Gets the hidden of this Category. # noqa: E501 - - Whether or not the category is hidden # noqa: E501 - - :return: The hidden of this Category. # noqa: E501 - :rtype: bool - """ - return self._hidden - - @hidden.setter - def hidden(self, hidden): - """Sets the hidden of this Category. - - Whether or not the category is hidden # noqa: E501 - - :param hidden: The hidden of this Category. # noqa: E501 - :type: bool - """ - if hidden is None: - raise ValueError("Invalid value for `hidden`, must not be `None`") # noqa: E501 - - self._hidden = hidden - - @property - def note(self): - """Gets the note of this Category. # noqa: E501 - - - :return: The note of this Category. # noqa: E501 - :rtype: str - """ - return self._note - - @note.setter - def note(self, note): - """Sets the note of this Category. - - - :param note: The note of this Category. # noqa: E501 - :type: str - """ - self._note = note - - @property - def budgeted(self): - """Gets the budgeted of this Category. # noqa: E501 - - Budgeted amount in current month in milliunits format # noqa: E501 - - :return: The budgeted of this Category. # noqa: E501 - :rtype: float - """ - return self._budgeted - - @budgeted.setter - def budgeted(self, budgeted): - """Sets the budgeted of this Category. - - Budgeted amount in current month in milliunits format # noqa: E501 - - :param budgeted: The budgeted of this Category. # noqa: E501 - :type: float - """ - if budgeted is None: - raise ValueError("Invalid value for `budgeted`, must not be `None`") # noqa: E501 - - self._budgeted = budgeted - - @property - def activity(self): - """Gets the activity of this Category. # noqa: E501 - - Activity amount in current month in milliunits format # noqa: E501 - - :return: The activity of this Category. # noqa: E501 - :rtype: float - """ - return self._activity - - @activity.setter - def activity(self, activity): - """Sets the activity of this Category. - - Activity amount in current month in milliunits format # noqa: E501 - - :param activity: The activity of this Category. # noqa: E501 - :type: float - """ - if activity is None: - raise ValueError("Invalid value for `activity`, must not be `None`") # noqa: E501 - - self._activity = activity - - @property - def balance(self): - """Gets the balance of this Category. # noqa: E501 - - Balance in current month in milliunits format # noqa: E501 - - :return: The balance of this Category. # noqa: E501 - :rtype: float - """ - return self._balance - - @balance.setter - def balance(self, balance): - """Sets the balance of this Category. - - Balance in current month in milliunits format # noqa: E501 - - :param balance: The balance of this Category. # noqa: E501 - :type: float - """ - if balance is None: - raise ValueError("Invalid value for `balance`, must not be `None`") # noqa: E501 - - self._balance = balance - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Category): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/category_group.py b/ynab/models/category_group.py deleted file mode 100644 index 93ffe84..0000000 --- a/ynab/models/category_group.py +++ /dev/null @@ -1,169 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class CategoryGroup(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'name': 'str', - 'hidden': 'bool' - } - - attribute_map = { - 'id': 'id', - 'name': 'name', - 'hidden': 'hidden' - } - - def __init__(self, id=None, name=None, hidden=None): # noqa: E501 - """CategoryGroup - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._name = None - self._hidden = None - self.discriminator = None - - self.id = id - self.name = name - self.hidden = hidden - - @property - def id(self): - """Gets the id of this CategoryGroup. # noqa: E501 - - - :return: The id of this CategoryGroup. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this CategoryGroup. - - - :param id: The id of this CategoryGroup. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def name(self): - """Gets the name of this CategoryGroup. # noqa: E501 - - - :return: The name of this CategoryGroup. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this CategoryGroup. - - - :param name: The name of this CategoryGroup. # noqa: E501 - :type: str - """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - - self._name = name - - @property - def hidden(self): - """Gets the hidden of this CategoryGroup. # noqa: E501 - - Whether or not the category group is hidden # noqa: E501 - - :return: The hidden of this CategoryGroup. # noqa: E501 - :rtype: bool - """ - return self._hidden - - @hidden.setter - def hidden(self, hidden): - """Sets the hidden of this CategoryGroup. - - Whether or not the category group is hidden # noqa: E501 - - :param hidden: The hidden of this CategoryGroup. # noqa: E501 - :type: bool - """ - if hidden is None: - raise ValueError("Invalid value for `hidden`, must not be `None`") # noqa: E501 - - self._hidden = hidden - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CategoryGroup): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/category_group_with_categories.py b/ynab/models/category_group_with_categories.py deleted file mode 100644 index cc5d191..0000000 --- a/ynab/models/category_group_with_categories.py +++ /dev/null @@ -1,201 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.category import Category # noqa: F401,E501 -from ynab.models.category_group import CategoryGroup # noqa: F401,E501 - - -class CategoryGroupWithCategories(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'name': 'str', - 'hidden': 'bool', - 'categories': 'list[Category]' - } - - attribute_map = { - 'id': 'id', - 'name': 'name', - 'hidden': 'hidden', - 'categories': 'categories' - } - - def __init__(self, id=None, name=None, hidden=None, categories=None): # noqa: E501 - """CategoryGroupWithCategories - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._name = None - self._hidden = None - self._categories = None - self.discriminator = None - - self.id = id - self.name = name - self.hidden = hidden - self.categories = categories - - @property - def id(self): - """Gets the id of this CategoryGroupWithCategories. # noqa: E501 - - - :return: The id of this CategoryGroupWithCategories. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this CategoryGroupWithCategories. - - - :param id: The id of this CategoryGroupWithCategories. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def name(self): - """Gets the name of this CategoryGroupWithCategories. # noqa: E501 - - - :return: The name of this CategoryGroupWithCategories. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this CategoryGroupWithCategories. - - - :param name: The name of this CategoryGroupWithCategories. # noqa: E501 - :type: str - """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - - self._name = name - - @property - def hidden(self): - """Gets the hidden of this CategoryGroupWithCategories. # noqa: E501 - - Whether or not the category group is hidden # noqa: E501 - - :return: The hidden of this CategoryGroupWithCategories. # noqa: E501 - :rtype: bool - """ - return self._hidden - - @hidden.setter - def hidden(self, hidden): - """Sets the hidden of this CategoryGroupWithCategories. - - Whether or not the category group is hidden # noqa: E501 - - :param hidden: The hidden of this CategoryGroupWithCategories. # noqa: E501 - :type: bool - """ - if hidden is None: - raise ValueError("Invalid value for `hidden`, must not be `None`") # noqa: E501 - - self._hidden = hidden - - @property - def categories(self): - """Gets the categories of this CategoryGroupWithCategories. # noqa: E501 - - Category group categories # noqa: E501 - - :return: The categories of this CategoryGroupWithCategories. # noqa: E501 - :rtype: list[Category] - """ - return self._categories - - @categories.setter - def categories(self, categories): - """Sets the categories of this CategoryGroupWithCategories. - - Category group categories # noqa: E501 - - :param categories: The categories of this CategoryGroupWithCategories. # noqa: E501 - :type: list[Category] - """ - if categories is None: - raise ValueError("Invalid value for `categories`, must not be `None`") # noqa: E501 - - self._categories = categories - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CategoryGroupWithCategories): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/category_groups_wrapper.py b/ynab/models/category_groups_wrapper.py deleted file mode 100644 index 6ed6bb5..0000000 --- a/ynab/models/category_groups_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.category_group_with_categories import CategoryGroupWithCategories # noqa: F401,E501 - - -class CategoryGroupsWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'category_groups': 'list[CategoryGroupWithCategories]' - } - - attribute_map = { - 'category_groups': 'category_groups' - } - - def __init__(self, category_groups=None): # noqa: E501 - """CategoryGroupsWrapper - a model defined in Swagger""" # noqa: E501 - - self._category_groups = None - self.discriminator = None - - self.category_groups = category_groups - - @property - def category_groups(self): - """Gets the category_groups of this CategoryGroupsWrapper. # noqa: E501 - - - :return: The category_groups of this CategoryGroupsWrapper. # noqa: E501 - :rtype: list[CategoryGroupWithCategories] - """ - return self._category_groups - - @category_groups.setter - def category_groups(self, category_groups): - """Sets the category_groups of this CategoryGroupsWrapper. - - - :param category_groups: The category_groups of this CategoryGroupsWrapper. # noqa: E501 - :type: list[CategoryGroupWithCategories] - """ - if category_groups is None: - raise ValueError("Invalid value for `category_groups`, must not be `None`") # noqa: E501 - - self._category_groups = category_groups - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CategoryGroupsWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/category_response.py b/ynab/models/category_response.py deleted file mode 100644 index bfffa81..0000000 --- a/ynab/models/category_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.category_wrapper import CategoryWrapper # noqa: F401,E501 - - -class CategoryResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'CategoryWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """CategoryResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this CategoryResponse. # noqa: E501 - - - :return: The data of this CategoryResponse. # noqa: E501 - :rtype: CategoryWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this CategoryResponse. - - - :param data: The data of this CategoryResponse. # noqa: E501 - :type: CategoryWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CategoryResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/category_wrapper.py b/ynab/models/category_wrapper.py deleted file mode 100644 index ad0629f..0000000 --- a/ynab/models/category_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.category import Category # noqa: F401,E501 - - -class CategoryWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'category': 'Category' - } - - attribute_map = { - 'category': 'category' - } - - def __init__(self, category=None): # noqa: E501 - """CategoryWrapper - a model defined in Swagger""" # noqa: E501 - - self._category = None - self.discriminator = None - - self.category = category - - @property - def category(self): - """Gets the category of this CategoryWrapper. # noqa: E501 - - - :return: The category of this CategoryWrapper. # noqa: E501 - :rtype: Category - """ - return self._category - - @category.setter - def category(self, category): - """Sets the category of this CategoryWrapper. - - - :param category: The category of this CategoryWrapper. # noqa: E501 - :type: Category - """ - if category is None: - raise ValueError("Invalid value for `category`, must not be `None`") # noqa: E501 - - self._category = category - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CategoryWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/currency_format.py b/ynab/models/currency_format.py deleted file mode 100644 index f9a01d2..0000000 --- a/ynab/models/currency_format.py +++ /dev/null @@ -1,302 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class CurrencyFormat(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'iso_code': 'str', - 'example_format': 'str', - 'decimal_digits': 'float', - 'decimal_separator': 'str', - 'symbol_first': 'bool', - 'group_separator': 'str', - 'currency_symbol': 'str', - 'display_symbol': 'bool' - } - - attribute_map = { - 'iso_code': 'iso_code', - 'example_format': 'example_format', - 'decimal_digits': 'decimal_digits', - 'decimal_separator': 'decimal_separator', - 'symbol_first': 'symbol_first', - 'group_separator': 'group_separator', - 'currency_symbol': 'currency_symbol', - 'display_symbol': 'display_symbol' - } - - def __init__(self, iso_code=None, example_format=None, decimal_digits=None, decimal_separator=None, symbol_first=None, group_separator=None, currency_symbol=None, display_symbol=None): # noqa: E501 - """CurrencyFormat - a model defined in Swagger""" # noqa: E501 - - self._iso_code = None - self._example_format = None - self._decimal_digits = None - self._decimal_separator = None - self._symbol_first = None - self._group_separator = None - self._currency_symbol = None - self._display_symbol = None - self.discriminator = None - - self.iso_code = iso_code - self.example_format = example_format - self.decimal_digits = decimal_digits - self.decimal_separator = decimal_separator - self.symbol_first = symbol_first - self.group_separator = group_separator - self.currency_symbol = currency_symbol - self.display_symbol = display_symbol - - @property - def iso_code(self): - """Gets the iso_code of this CurrencyFormat. # noqa: E501 - - - :return: The iso_code of this CurrencyFormat. # noqa: E501 - :rtype: str - """ - return self._iso_code - - @iso_code.setter - def iso_code(self, iso_code): - """Sets the iso_code of this CurrencyFormat. - - - :param iso_code: The iso_code of this CurrencyFormat. # noqa: E501 - :type: str - """ - if iso_code is None: - raise ValueError("Invalid value for `iso_code`, must not be `None`") # noqa: E501 - - self._iso_code = iso_code - - @property - def example_format(self): - """Gets the example_format of this CurrencyFormat. # noqa: E501 - - - :return: The example_format of this CurrencyFormat. # noqa: E501 - :rtype: str - """ - return self._example_format - - @example_format.setter - def example_format(self, example_format): - """Sets the example_format of this CurrencyFormat. - - - :param example_format: The example_format of this CurrencyFormat. # noqa: E501 - :type: str - """ - if example_format is None: - raise ValueError("Invalid value for `example_format`, must not be `None`") # noqa: E501 - - self._example_format = example_format - - @property - def decimal_digits(self): - """Gets the decimal_digits of this CurrencyFormat. # noqa: E501 - - - :return: The decimal_digits of this CurrencyFormat. # noqa: E501 - :rtype: float - """ - return self._decimal_digits - - @decimal_digits.setter - def decimal_digits(self, decimal_digits): - """Sets the decimal_digits of this CurrencyFormat. - - - :param decimal_digits: The decimal_digits of this CurrencyFormat. # noqa: E501 - :type: float - """ - if decimal_digits is None: - raise ValueError("Invalid value for `decimal_digits`, must not be `None`") # noqa: E501 - - self._decimal_digits = decimal_digits - - @property - def decimal_separator(self): - """Gets the decimal_separator of this CurrencyFormat. # noqa: E501 - - - :return: The decimal_separator of this CurrencyFormat. # noqa: E501 - :rtype: str - """ - return self._decimal_separator - - @decimal_separator.setter - def decimal_separator(self, decimal_separator): - """Sets the decimal_separator of this CurrencyFormat. - - - :param decimal_separator: The decimal_separator of this CurrencyFormat. # noqa: E501 - :type: str - """ - if decimal_separator is None: - raise ValueError("Invalid value for `decimal_separator`, must not be `None`") # noqa: E501 - - self._decimal_separator = decimal_separator - - @property - def symbol_first(self): - """Gets the symbol_first of this CurrencyFormat. # noqa: E501 - - - :return: The symbol_first of this CurrencyFormat. # noqa: E501 - :rtype: bool - """ - return self._symbol_first - - @symbol_first.setter - def symbol_first(self, symbol_first): - """Sets the symbol_first of this CurrencyFormat. - - - :param symbol_first: The symbol_first of this CurrencyFormat. # noqa: E501 - :type: bool - """ - if symbol_first is None: - raise ValueError("Invalid value for `symbol_first`, must not be `None`") # noqa: E501 - - self._symbol_first = symbol_first - - @property - def group_separator(self): - """Gets the group_separator of this CurrencyFormat. # noqa: E501 - - - :return: The group_separator of this CurrencyFormat. # noqa: E501 - :rtype: str - """ - return self._group_separator - - @group_separator.setter - def group_separator(self, group_separator): - """Sets the group_separator of this CurrencyFormat. - - - :param group_separator: The group_separator of this CurrencyFormat. # noqa: E501 - :type: str - """ - if group_separator is None: - raise ValueError("Invalid value for `group_separator`, must not be `None`") # noqa: E501 - - self._group_separator = group_separator - - @property - def currency_symbol(self): - """Gets the currency_symbol of this CurrencyFormat. # noqa: E501 - - - :return: The currency_symbol of this CurrencyFormat. # noqa: E501 - :rtype: str - """ - return self._currency_symbol - - @currency_symbol.setter - def currency_symbol(self, currency_symbol): - """Sets the currency_symbol of this CurrencyFormat. - - - :param currency_symbol: The currency_symbol of this CurrencyFormat. # noqa: E501 - :type: str - """ - if currency_symbol is None: - raise ValueError("Invalid value for `currency_symbol`, must not be `None`") # noqa: E501 - - self._currency_symbol = currency_symbol - - @property - def display_symbol(self): - """Gets the display_symbol of this CurrencyFormat. # noqa: E501 - - - :return: The display_symbol of this CurrencyFormat. # noqa: E501 - :rtype: bool - """ - return self._display_symbol - - @display_symbol.setter - def display_symbol(self, display_symbol): - """Sets the display_symbol of this CurrencyFormat. - - - :param display_symbol: The display_symbol of this CurrencyFormat. # noqa: E501 - :type: bool - """ - if display_symbol is None: - raise ValueError("Invalid value for `display_symbol`, must not be `None`") # noqa: E501 - - self._display_symbol = display_symbol - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CurrencyFormat): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/date_format.py b/ynab/models/date_format.py deleted file mode 100644 index 966dcf5..0000000 --- a/ynab/models/date_format.py +++ /dev/null @@ -1,113 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class DateFormat(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'format': 'str' - } - - attribute_map = { - 'format': 'format' - } - - def __init__(self, format=None): # noqa: E501 - """DateFormat - a model defined in Swagger""" # noqa: E501 - - self._format = None - self.discriminator = None - - self.format = format - - @property - def format(self): - """Gets the format of this DateFormat. # noqa: E501 - - - :return: The format of this DateFormat. # noqa: E501 - :rtype: str - """ - return self._format - - @format.setter - def format(self, format): - """Sets the format of this DateFormat. - - - :param format: The format of this DateFormat. # noqa: E501 - :type: str - """ - if format is None: - raise ValueError("Invalid value for `format`, must not be `None`") # noqa: E501 - - self._format = format - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, DateFormat): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/error_detail.py b/ynab/models/error_detail.py deleted file mode 100644 index 1751760..0000000 --- a/ynab/models/error_detail.py +++ /dev/null @@ -1,167 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class ErrorDetail(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'name': 'str', - 'detail': 'str' - } - - attribute_map = { - 'id': 'id', - 'name': 'name', - 'detail': 'detail' - } - - def __init__(self, id=None, name=None, detail=None): # noqa: E501 - """ErrorDetail - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._name = None - self._detail = None - self.discriminator = None - - self.id = id - self.name = name - self.detail = detail - - @property - def id(self): - """Gets the id of this ErrorDetail. # noqa: E501 - - - :return: The id of this ErrorDetail. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this ErrorDetail. - - - :param id: The id of this ErrorDetail. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def name(self): - """Gets the name of this ErrorDetail. # noqa: E501 - - - :return: The name of this ErrorDetail. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this ErrorDetail. - - - :param name: The name of this ErrorDetail. # noqa: E501 - :type: str - """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - - self._name = name - - @property - def detail(self): - """Gets the detail of this ErrorDetail. # noqa: E501 - - - :return: The detail of this ErrorDetail. # noqa: E501 - :rtype: str - """ - return self._detail - - @detail.setter - def detail(self, detail): - """Sets the detail of this ErrorDetail. - - - :param detail: The detail of this ErrorDetail. # noqa: E501 - :type: str - """ - if detail is None: - raise ValueError("Invalid value for `detail`, must not be `None`") # noqa: E501 - - self._detail = detail - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ErrorDetail): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/error_response.py b/ynab/models/error_response.py deleted file mode 100644 index 94a6458..0000000 --- a/ynab/models/error_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.error_detail import ErrorDetail # noqa: F401,E501 - - -class ErrorResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'error': 'ErrorDetail' - } - - attribute_map = { - 'error': 'error' - } - - def __init__(self, error=None): # noqa: E501 - """ErrorResponse - a model defined in Swagger""" # noqa: E501 - - self._error = None - self.discriminator = None - - self.error = error - - @property - def error(self): - """Gets the error of this ErrorResponse. # noqa: E501 - - - :return: The error of this ErrorResponse. # noqa: E501 - :rtype: ErrorDetail - """ - return self._error - - @error.setter - def error(self, error): - """Sets the error of this ErrorResponse. - - - :param error: The error of this ErrorResponse. # noqa: E501 - :type: ErrorDetail - """ - if error is None: - raise ValueError("Invalid value for `error`, must not be `None`") # noqa: E501 - - self._error = error - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ErrorResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/hybrid_transaction.py b/ynab/models/hybrid_transaction.py deleted file mode 100644 index b198820..0000000 --- a/ynab/models/hybrid_transaction.py +++ /dev/null @@ -1,579 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.transaction_summary import TransactionSummary # noqa: F401,E501 - - -class HybridTransaction(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'date': 'date', - 'amount': 'float', - 'memo': 'str', - 'cleared': 'str', - 'approved': 'bool', - 'flag_color': 'str', - 'account_id': 'str', - 'payee_id': 'str', - 'category_id': 'str', - 'transfer_account_id': 'str', - 'import_id': 'str', - 'type': 'str', - 'parent_transaction_id': 'str', - 'account_name': 'str', - 'payee_name': 'str', - 'category_name': 'str' - } - - attribute_map = { - 'id': 'id', - 'date': 'date', - 'amount': 'amount', - 'memo': 'memo', - 'cleared': 'cleared', - 'approved': 'approved', - 'flag_color': 'flag_color', - 'account_id': 'account_id', - 'payee_id': 'payee_id', - 'category_id': 'category_id', - 'transfer_account_id': 'transfer_account_id', - 'import_id': 'import_id', - 'type': 'type', - 'parent_transaction_id': 'parent_transaction_id', - 'account_name': 'account_name', - 'payee_name': 'payee_name', - 'category_name': 'category_name' - } - - def __init__(self, id=None, date=None, amount=None, memo=None, cleared=None, approved=None, flag_color=None, account_id=None, payee_id=None, category_id=None, transfer_account_id=None, import_id=None, type=None, parent_transaction_id=None, account_name=None, payee_name=None, category_name=None): # noqa: E501 - """HybridTransaction - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._date = None - self._amount = None - self._memo = None - self._cleared = None - self._approved = None - self._flag_color = None - self._account_id = None - self._payee_id = None - self._category_id = None - self._transfer_account_id = None - self._import_id = None - self._type = None - self._parent_transaction_id = None - self._account_name = None - self._payee_name = None - self._category_name = None - self.discriminator = None - - self.id = id - self.date = date - self.amount = amount - self.memo = memo - self.cleared = cleared - self.approved = approved - self.flag_color = flag_color - self.account_id = account_id - self.payee_id = payee_id - self.category_id = category_id - self.transfer_account_id = transfer_account_id - self.import_id = import_id - self.type = type - self.parent_transaction_id = parent_transaction_id - self.account_name = account_name - self.payee_name = payee_name - self.category_name = category_name - - @property - def id(self): - """Gets the id of this HybridTransaction. # noqa: E501 - - - :return: The id of this HybridTransaction. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this HybridTransaction. - - - :param id: The id of this HybridTransaction. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def date(self): - """Gets the date of this HybridTransaction. # noqa: E501 - - - :return: The date of this HybridTransaction. # noqa: E501 - :rtype: date - """ - return self._date - - @date.setter - def date(self, date): - """Sets the date of this HybridTransaction. - - - :param date: The date of this HybridTransaction. # noqa: E501 - :type: date - """ - if date is None: - raise ValueError("Invalid value for `date`, must not be `None`") # noqa: E501 - - self._date = date - - @property - def amount(self): - """Gets the amount of this HybridTransaction. # noqa: E501 - - The transaction amount in milliunits format # noqa: E501 - - :return: The amount of this HybridTransaction. # noqa: E501 - :rtype: float - """ - return self._amount - - @amount.setter - def amount(self, amount): - """Sets the amount of this HybridTransaction. - - The transaction amount in milliunits format # noqa: E501 - - :param amount: The amount of this HybridTransaction. # noqa: E501 - :type: float - """ - if amount is None: - raise ValueError("Invalid value for `amount`, must not be `None`") # noqa: E501 - - self._amount = amount - - @property - def memo(self): - """Gets the memo of this HybridTransaction. # noqa: E501 - - - :return: The memo of this HybridTransaction. # noqa: E501 - :rtype: str - """ - return self._memo - - @memo.setter - def memo(self, memo): - """Sets the memo of this HybridTransaction. - - - :param memo: The memo of this HybridTransaction. # noqa: E501 - :type: str - """ - if memo is None: - raise ValueError("Invalid value for `memo`, must not be `None`") # noqa: E501 - - self._memo = memo - - @property - def cleared(self): - """Gets the cleared of this HybridTransaction. # noqa: E501 - - The cleared status of the transaction # noqa: E501 - - :return: The cleared of this HybridTransaction. # noqa: E501 - :rtype: str - """ - return self._cleared - - @cleared.setter - def cleared(self, cleared): - """Sets the cleared of this HybridTransaction. - - The cleared status of the transaction # noqa: E501 - - :param cleared: The cleared of this HybridTransaction. # noqa: E501 - :type: str - """ - if cleared is None: - raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 - allowed_values = ["cleared", "uncleared", "reconciled"] # noqa: E501 - if cleared not in allowed_values: - raise ValueError( - "Invalid value for `cleared` ({0}), must be one of {1}" # noqa: E501 - .format(cleared, allowed_values) - ) - - self._cleared = cleared - - @property - def approved(self): - """Gets the approved of this HybridTransaction. # noqa: E501 - - Whether or not the transaction is approved # noqa: E501 - - :return: The approved of this HybridTransaction. # noqa: E501 - :rtype: bool - """ - return self._approved - - @approved.setter - def approved(self, approved): - """Sets the approved of this HybridTransaction. - - Whether or not the transaction is approved # noqa: E501 - - :param approved: The approved of this HybridTransaction. # noqa: E501 - :type: bool - """ - if approved is None: - raise ValueError("Invalid value for `approved`, must not be `None`") # noqa: E501 - - self._approved = approved - - @property - def flag_color(self): - """Gets the flag_color of this HybridTransaction. # noqa: E501 - - The transaction flag # noqa: E501 - - :return: The flag_color of this HybridTransaction. # noqa: E501 - :rtype: str - """ - return self._flag_color - - @flag_color.setter - def flag_color(self, flag_color): - """Sets the flag_color of this HybridTransaction. - - The transaction flag # noqa: E501 - - :param flag_color: The flag_color of this HybridTransaction. # noqa: E501 - :type: str - """ - if flag_color is None: - raise ValueError("Invalid value for `flag_color`, must not be `None`") # noqa: E501 - allowed_values = ["red", "orange", "yellow", "green", "blue", "purple"] # noqa: E501 - if flag_color not in allowed_values: - raise ValueError( - "Invalid value for `flag_color` ({0}), must be one of {1}" # noqa: E501 - .format(flag_color, allowed_values) - ) - - self._flag_color = flag_color - - @property - def account_id(self): - """Gets the account_id of this HybridTransaction. # noqa: E501 - - - :return: The account_id of this HybridTransaction. # noqa: E501 - :rtype: str - """ - return self._account_id - - @account_id.setter - def account_id(self, account_id): - """Sets the account_id of this HybridTransaction. - - - :param account_id: The account_id of this HybridTransaction. # noqa: E501 - :type: str - """ - if account_id is None: - raise ValueError("Invalid value for `account_id`, must not be `None`") # noqa: E501 - - self._account_id = account_id - - @property - def payee_id(self): - """Gets the payee_id of this HybridTransaction. # noqa: E501 - - - :return: The payee_id of this HybridTransaction. # noqa: E501 - :rtype: str - """ - return self._payee_id - - @payee_id.setter - def payee_id(self, payee_id): - """Sets the payee_id of this HybridTransaction. - - - :param payee_id: The payee_id of this HybridTransaction. # noqa: E501 - :type: str - """ - if payee_id is None: - raise ValueError("Invalid value for `payee_id`, must not be `None`") # noqa: E501 - - self._payee_id = payee_id - - @property - def category_id(self): - """Gets the category_id of this HybridTransaction. # noqa: E501 - - - :return: The category_id of this HybridTransaction. # noqa: E501 - :rtype: str - """ - return self._category_id - - @category_id.setter - def category_id(self, category_id): - """Sets the category_id of this HybridTransaction. - - - :param category_id: The category_id of this HybridTransaction. # noqa: E501 - :type: str - """ - if category_id is None: - raise ValueError("Invalid value for `category_id`, must not be `None`") # noqa: E501 - - self._category_id = category_id - - @property - def transfer_account_id(self): - """Gets the transfer_account_id of this HybridTransaction. # noqa: E501 - - - :return: The transfer_account_id of this HybridTransaction. # noqa: E501 - :rtype: str - """ - return self._transfer_account_id - - @transfer_account_id.setter - def transfer_account_id(self, transfer_account_id): - """Sets the transfer_account_id of this HybridTransaction. - - - :param transfer_account_id: The transfer_account_id of this HybridTransaction. # noqa: E501 - :type: str - """ - if transfer_account_id is None: - raise ValueError("Invalid value for `transfer_account_id`, must not be `None`") # noqa: E501 - - self._transfer_account_id = transfer_account_id - - @property - def import_id(self): - """Gets the import_id of this HybridTransaction. # noqa: E501 - - If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have 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'. # noqa: E501 - - :return: The import_id of this HybridTransaction. # noqa: E501 - :rtype: str - """ - return self._import_id - - @import_id.setter - def import_id(self, import_id): - """Sets the import_id of this HybridTransaction. - - If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have 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'. # noqa: E501 - - :param import_id: The import_id of this HybridTransaction. # noqa: E501 - :type: str - """ - if import_id is None: - raise ValueError("Invalid value for `import_id`, must not be `None`") # noqa: E501 - - self._import_id = import_id - - @property - def type(self): - """Gets the type of this HybridTransaction. # noqa: E501 - - Whether the hybrid transaction represents a regular transaction or a subtransaction # noqa: E501 - - :return: The type of this HybridTransaction. # noqa: E501 - :rtype: str - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this HybridTransaction. - - Whether the hybrid transaction represents a regular transaction or a subtransaction # noqa: E501 - - :param type: The type of this HybridTransaction. # noqa: E501 - :type: str - """ - if type is None: - raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 - allowed_values = ["transaction", "subtransaction"] # noqa: E501 - if type not in allowed_values: - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) - ) - - self._type = type - - @property - def parent_transaction_id(self): - """Gets the parent_transaction_id of this HybridTransaction. # noqa: E501 - - For subtransaction types, this is the id of the pararent transaction. For transaction types, this id will be always be null. # noqa: E501 - - :return: The parent_transaction_id of this HybridTransaction. # noqa: E501 - :rtype: str - """ - return self._parent_transaction_id - - @parent_transaction_id.setter - def parent_transaction_id(self, parent_transaction_id): - """Sets the parent_transaction_id of this HybridTransaction. - - For subtransaction types, this is the id of the pararent transaction. For transaction types, this id will be always be null. # noqa: E501 - - :param parent_transaction_id: The parent_transaction_id of this HybridTransaction. # noqa: E501 - :type: str - """ - if parent_transaction_id is None: - raise ValueError("Invalid value for `parent_transaction_id`, must not be `None`") # noqa: E501 - - self._parent_transaction_id = parent_transaction_id - - @property - def account_name(self): - """Gets the account_name of this HybridTransaction. # noqa: E501 - - - :return: The account_name of this HybridTransaction. # noqa: E501 - :rtype: str - """ - return self._account_name - - @account_name.setter - def account_name(self, account_name): - """Sets the account_name of this HybridTransaction. - - - :param account_name: The account_name of this HybridTransaction. # noqa: E501 - :type: str - """ - if account_name is None: - raise ValueError("Invalid value for `account_name`, must not be `None`") # noqa: E501 - - self._account_name = account_name - - @property - def payee_name(self): - """Gets the payee_name of this HybridTransaction. # noqa: E501 - - - :return: The payee_name of this HybridTransaction. # noqa: E501 - :rtype: str - """ - return self._payee_name - - @payee_name.setter - def payee_name(self, payee_name): - """Sets the payee_name of this HybridTransaction. - - - :param payee_name: The payee_name of this HybridTransaction. # noqa: E501 - :type: str - """ - if payee_name is None: - raise ValueError("Invalid value for `payee_name`, must not be `None`") # noqa: E501 - - self._payee_name = payee_name - - @property - def category_name(self): - """Gets the category_name of this HybridTransaction. # noqa: E501 - - - :return: The category_name of this HybridTransaction. # noqa: E501 - :rtype: str - """ - return self._category_name - - @category_name.setter - def category_name(self, category_name): - """Sets the category_name of this HybridTransaction. - - - :param category_name: The category_name of this HybridTransaction. # noqa: E501 - :type: str - """ - if category_name is None: - raise ValueError("Invalid value for `category_name`, must not be `None`") # noqa: E501 - - self._category_name = category_name - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, HybridTransaction): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/hybrid_transactions_response.py b/ynab/models/hybrid_transactions_response.py deleted file mode 100644 index 7bd795c..0000000 --- a/ynab/models/hybrid_transactions_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.hybrid_transactions_wrapper import HybridTransactionsWrapper # noqa: F401,E501 - - -class HybridTransactionsResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'HybridTransactionsWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """HybridTransactionsResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this HybridTransactionsResponse. # noqa: E501 - - - :return: The data of this HybridTransactionsResponse. # noqa: E501 - :rtype: HybridTransactionsWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this HybridTransactionsResponse. - - - :param data: The data of this HybridTransactionsResponse. # noqa: E501 - :type: HybridTransactionsWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, HybridTransactionsResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/hybrid_transactions_wrapper.py b/ynab/models/hybrid_transactions_wrapper.py deleted file mode 100644 index 14e7fad..0000000 --- a/ynab/models/hybrid_transactions_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.hybrid_transaction import HybridTransaction # noqa: F401,E501 - - -class HybridTransactionsWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'transactions': 'list[HybridTransaction]' - } - - attribute_map = { - 'transactions': 'transactions' - } - - def __init__(self, transactions=None): # noqa: E501 - """HybridTransactionsWrapper - a model defined in Swagger""" # noqa: E501 - - self._transactions = None - self.discriminator = None - - self.transactions = transactions - - @property - def transactions(self): - """Gets the transactions of this HybridTransactionsWrapper. # noqa: E501 - - - :return: The transactions of this HybridTransactionsWrapper. # noqa: E501 - :rtype: list[HybridTransaction] - """ - return self._transactions - - @transactions.setter - def transactions(self, transactions): - """Sets the transactions of this HybridTransactionsWrapper. - - - :param transactions: The transactions of this HybridTransactionsWrapper. # noqa: E501 - :type: list[HybridTransaction] - """ - if transactions is None: - raise ValueError("Invalid value for `transactions`, must not be `None`") # noqa: E501 - - self._transactions = transactions - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, HybridTransactionsWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/month_detail.py b/ynab/models/month_detail.py deleted file mode 100644 index e277e48..0000000 --- a/ynab/models/month_detail.py +++ /dev/null @@ -1,225 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.category import Category # noqa: F401,E501 -from ynab.models.month_summary import MonthSummary # noqa: F401,E501 - - -class MonthDetail(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'month': 'date', - 'note': 'str', - 'to_be_budgeted': 'float', - 'age_of_money': 'float', - 'categories': 'list[Category]' - } - - attribute_map = { - 'month': 'month', - 'note': 'note', - 'to_be_budgeted': 'to_be_budgeted', - 'age_of_money': 'age_of_money', - 'categories': 'categories' - } - - def __init__(self, month=None, note=None, to_be_budgeted=None, age_of_money=None, categories=None): # noqa: E501 - """MonthDetail - a model defined in Swagger""" # noqa: E501 - - self._month = None - self._note = None - self._to_be_budgeted = None - self._age_of_money = None - self._categories = None - self.discriminator = None - - self.month = month - self.note = note - self.to_be_budgeted = to_be_budgeted - self.age_of_money = age_of_money - self.categories = categories - - @property - def month(self): - """Gets the month of this MonthDetail. # noqa: E501 - - - :return: The month of this MonthDetail. # noqa: E501 - :rtype: date - """ - return self._month - - @month.setter - def month(self, month): - """Sets the month of this MonthDetail. - - - :param month: The month of this MonthDetail. # noqa: E501 - :type: date - """ - if month is None: - raise ValueError("Invalid value for `month`, must not be `None`") # noqa: E501 - - self._month = month - - @property - def note(self): - """Gets the note of this MonthDetail. # noqa: E501 - - - :return: The note of this MonthDetail. # noqa: E501 - :rtype: str - """ - return self._note - - @note.setter - def note(self, note): - """Sets the note of this MonthDetail. - - - :param note: The note of this MonthDetail. # noqa: E501 - :type: str - """ - self._note = note - - @property - def to_be_budgeted(self): - """Gets the to_be_budgeted of this MonthDetail. # noqa: E501 - - The current balance of the account in milliunits format # noqa: E501 - - :return: The to_be_budgeted of this MonthDetail. # noqa: E501 - :rtype: float - """ - return self._to_be_budgeted - - @to_be_budgeted.setter - def to_be_budgeted(self, to_be_budgeted): - """Sets the to_be_budgeted of this MonthDetail. - - The current balance of the account in milliunits format # noqa: E501 - - :param to_be_budgeted: The to_be_budgeted of this MonthDetail. # noqa: E501 - :type: float - """ - if to_be_budgeted is None: - raise ValueError("Invalid value for `to_be_budgeted`, must not be `None`") # noqa: E501 - - self._to_be_budgeted = to_be_budgeted - - @property - def age_of_money(self): - """Gets the age_of_money of this MonthDetail. # noqa: E501 - - - :return: The age_of_money of this MonthDetail. # noqa: E501 - :rtype: float - """ - return self._age_of_money - - @age_of_money.setter - def age_of_money(self, age_of_money): - """Sets the age_of_money of this MonthDetail. - - - :param age_of_money: The age_of_money of this MonthDetail. # noqa: E501 - :type: float - """ - if age_of_money is None: - raise ValueError("Invalid value for `age_of_money`, must not be `None`") # noqa: E501 - - self._age_of_money = age_of_money - - @property - def categories(self): - """Gets the categories of this MonthDetail. # noqa: E501 - - The budget month categories # noqa: E501 - - :return: The categories of this MonthDetail. # noqa: E501 - :rtype: list[Category] - """ - return self._categories - - @categories.setter - def categories(self, categories): - """Sets the categories of this MonthDetail. - - The budget month categories # noqa: E501 - - :param categories: The categories of this MonthDetail. # noqa: E501 - :type: list[Category] - """ - if categories is None: - raise ValueError("Invalid value for `categories`, must not be `None`") # noqa: E501 - - self._categories = categories - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MonthDetail): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/month_detail_response.py b/ynab/models/month_detail_response.py deleted file mode 100644 index d391c14..0000000 --- a/ynab/models/month_detail_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.month_detail_wrapper import MonthDetailWrapper # noqa: F401,E501 - - -class MonthDetailResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'MonthDetailWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """MonthDetailResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this MonthDetailResponse. # noqa: E501 - - - :return: The data of this MonthDetailResponse. # noqa: E501 - :rtype: MonthDetailWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this MonthDetailResponse. - - - :param data: The data of this MonthDetailResponse. # noqa: E501 - :type: MonthDetailWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MonthDetailResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/month_detail_wrapper.py b/ynab/models/month_detail_wrapper.py deleted file mode 100644 index bc9c98c..0000000 --- a/ynab/models/month_detail_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.month_detail import MonthDetail # noqa: F401,E501 - - -class MonthDetailWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'month': 'MonthDetail' - } - - attribute_map = { - 'month': 'month' - } - - def __init__(self, month=None): # noqa: E501 - """MonthDetailWrapper - a model defined in Swagger""" # noqa: E501 - - self._month = None - self.discriminator = None - - self.month = month - - @property - def month(self): - """Gets the month of this MonthDetailWrapper. # noqa: E501 - - - :return: The month of this MonthDetailWrapper. # noqa: E501 - :rtype: MonthDetail - """ - return self._month - - @month.setter - def month(self, month): - """Sets the month of this MonthDetailWrapper. - - - :param month: The month of this MonthDetailWrapper. # noqa: E501 - :type: MonthDetail - """ - if month is None: - raise ValueError("Invalid value for `month`, must not be `None`") # noqa: E501 - - self._month = month - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MonthDetailWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/month_summaries_response.py b/ynab/models/month_summaries_response.py deleted file mode 100644 index c57bd48..0000000 --- a/ynab/models/month_summaries_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.month_summaries_wrapper import MonthSummariesWrapper # noqa: F401,E501 - - -class MonthSummariesResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'MonthSummariesWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """MonthSummariesResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this MonthSummariesResponse. # noqa: E501 - - - :return: The data of this MonthSummariesResponse. # noqa: E501 - :rtype: MonthSummariesWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this MonthSummariesResponse. - - - :param data: The data of this MonthSummariesResponse. # noqa: E501 - :type: MonthSummariesWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MonthSummariesResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/month_summaries_wrapper.py b/ynab/models/month_summaries_wrapper.py deleted file mode 100644 index ee9c750..0000000 --- a/ynab/models/month_summaries_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.month_summary import MonthSummary # noqa: F401,E501 - - -class MonthSummariesWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'months': 'list[MonthSummary]' - } - - attribute_map = { - 'months': 'months' - } - - def __init__(self, months=None): # noqa: E501 - """MonthSummariesWrapper - a model defined in Swagger""" # noqa: E501 - - self._months = None - self.discriminator = None - - self.months = months - - @property - def months(self): - """Gets the months of this MonthSummariesWrapper. # noqa: E501 - - - :return: The months of this MonthSummariesWrapper. # noqa: E501 - :rtype: list[MonthSummary] - """ - return self._months - - @months.setter - def months(self, months): - """Sets the months of this MonthSummariesWrapper. - - - :param months: The months of this MonthSummariesWrapper. # noqa: E501 - :type: list[MonthSummary] - """ - if months is None: - raise ValueError("Invalid value for `months`, must not be `None`") # noqa: E501 - - self._months = months - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MonthSummariesWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/month_summary.py b/ynab/models/month_summary.py deleted file mode 100644 index 633a98f..0000000 --- a/ynab/models/month_summary.py +++ /dev/null @@ -1,193 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class MonthSummary(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'month': 'date', - 'note': 'str', - 'to_be_budgeted': 'float', - 'age_of_money': 'float' - } - - attribute_map = { - 'month': 'month', - 'note': 'note', - 'to_be_budgeted': 'to_be_budgeted', - 'age_of_money': 'age_of_money' - } - - def __init__(self, month=None, note=None, to_be_budgeted=None, age_of_money=None): # noqa: E501 - """MonthSummary - a model defined in Swagger""" # noqa: E501 - - self._month = None - self._note = None - self._to_be_budgeted = None - self._age_of_money = None - self.discriminator = None - - self.month = month - self.note = note - self.to_be_budgeted = to_be_budgeted - self.age_of_money = age_of_money - - @property - def month(self): - """Gets the month of this MonthSummary. # noqa: E501 - - - :return: The month of this MonthSummary. # noqa: E501 - :rtype: date - """ - return self._month - - @month.setter - def month(self, month): - """Sets the month of this MonthSummary. - - - :param month: The month of this MonthSummary. # noqa: E501 - :type: date - """ - if month is None: - raise ValueError("Invalid value for `month`, must not be `None`") # noqa: E501 - - self._month = month - - @property - def note(self): - """Gets the note of this MonthSummary. # noqa: E501 - - - :return: The note of this MonthSummary. # noqa: E501 - :rtype: str - """ - return self._note - - @note.setter - def note(self, note): - """Sets the note of this MonthSummary. - - - :param note: The note of this MonthSummary. # noqa: E501 - :type: str - """ - self._note = note - - @property - def to_be_budgeted(self): - """Gets the to_be_budgeted of this MonthSummary. # noqa: E501 - - The current balance of the account in milliunits format # noqa: E501 - - :return: The to_be_budgeted of this MonthSummary. # noqa: E501 - :rtype: float - """ - return self._to_be_budgeted - - @to_be_budgeted.setter - def to_be_budgeted(self, to_be_budgeted): - """Sets the to_be_budgeted of this MonthSummary. - - The current balance of the account in milliunits format # noqa: E501 - - :param to_be_budgeted: The to_be_budgeted of this MonthSummary. # noqa: E501 - :type: float - """ - if to_be_budgeted is None: - raise ValueError("Invalid value for `to_be_budgeted`, must not be `None`") # noqa: E501 - - self._to_be_budgeted = to_be_budgeted - - @property - def age_of_money(self): - """Gets the age_of_money of this MonthSummary. # noqa: E501 - - - :return: The age_of_money of this MonthSummary. # noqa: E501 - :rtype: float - """ - return self._age_of_money - - @age_of_money.setter - def age_of_money(self, age_of_money): - """Sets the age_of_money of this MonthSummary. - - - :param age_of_money: The age_of_money of this MonthSummary. # noqa: E501 - :type: float - """ - if age_of_money is None: - raise ValueError("Invalid value for `age_of_money`, must not be `None`") # noqa: E501 - - self._age_of_money = age_of_money - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MonthSummary): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/payee.py b/ynab/models/payee.py deleted file mode 100644 index 20dea35..0000000 --- a/ynab/models/payee.py +++ /dev/null @@ -1,169 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class Payee(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'name': 'str', - 'transfer_account_id': 'str' - } - - attribute_map = { - 'id': 'id', - 'name': 'name', - 'transfer_account_id': 'transfer_account_id' - } - - def __init__(self, id=None, name=None, transfer_account_id=None): # noqa: E501 - """Payee - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._name = None - self._transfer_account_id = None - self.discriminator = None - - self.id = id - self.name = name - self.transfer_account_id = transfer_account_id - - @property - def id(self): - """Gets the id of this Payee. # noqa: E501 - - - :return: The id of this Payee. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Payee. - - - :param id: The id of this Payee. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def name(self): - """Gets the name of this Payee. # noqa: E501 - - - :return: The name of this Payee. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this Payee. - - - :param name: The name of this Payee. # noqa: E501 - :type: str - """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - - self._name = name - - @property - def transfer_account_id(self): - """Gets the transfer_account_id of this Payee. # noqa: E501 - - If a transfer payee, the account_id to which this payee transfers to # noqa: E501 - - :return: The transfer_account_id of this Payee. # noqa: E501 - :rtype: str - """ - return self._transfer_account_id - - @transfer_account_id.setter - def transfer_account_id(self, transfer_account_id): - """Sets the transfer_account_id of this Payee. - - If a transfer payee, the account_id to which this payee transfers to # noqa: E501 - - :param transfer_account_id: The transfer_account_id of this Payee. # noqa: E501 - :type: str - """ - if transfer_account_id is None: - raise ValueError("Invalid value for `transfer_account_id`, must not be `None`") # noqa: E501 - - self._transfer_account_id = transfer_account_id - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Payee): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/payee_location.py b/ynab/models/payee_location.py deleted file mode 100644 index 18f2152..0000000 --- a/ynab/models/payee_location.py +++ /dev/null @@ -1,194 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class PayeeLocation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'payee_id': 'str', - 'latitude': 'str', - 'longitude': 'str' - } - - attribute_map = { - 'id': 'id', - 'payee_id': 'payee_id', - 'latitude': 'latitude', - 'longitude': 'longitude' - } - - def __init__(self, id=None, payee_id=None, latitude=None, longitude=None): # noqa: E501 - """PayeeLocation - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._payee_id = None - self._latitude = None - self._longitude = None - self.discriminator = None - - self.id = id - self.payee_id = payee_id - self.latitude = latitude - self.longitude = longitude - - @property - def id(self): - """Gets the id of this PayeeLocation. # noqa: E501 - - - :return: The id of this PayeeLocation. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this PayeeLocation. - - - :param id: The id of this PayeeLocation. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def payee_id(self): - """Gets the payee_id of this PayeeLocation. # noqa: E501 - - - :return: The payee_id of this PayeeLocation. # noqa: E501 - :rtype: str - """ - return self._payee_id - - @payee_id.setter - def payee_id(self, payee_id): - """Sets the payee_id of this PayeeLocation. - - - :param payee_id: The payee_id of this PayeeLocation. # noqa: E501 - :type: str - """ - if payee_id is None: - raise ValueError("Invalid value for `payee_id`, must not be `None`") # noqa: E501 - - self._payee_id = payee_id - - @property - def latitude(self): - """Gets the latitude of this PayeeLocation. # noqa: E501 - - - :return: The latitude of this PayeeLocation. # noqa: E501 - :rtype: str - """ - return self._latitude - - @latitude.setter - def latitude(self, latitude): - """Sets the latitude of this PayeeLocation. - - - :param latitude: The latitude of this PayeeLocation. # noqa: E501 - :type: str - """ - if latitude is None: - raise ValueError("Invalid value for `latitude`, must not be `None`") # noqa: E501 - - self._latitude = latitude - - @property - def longitude(self): - """Gets the longitude of this PayeeLocation. # noqa: E501 - - - :return: The longitude of this PayeeLocation. # noqa: E501 - :rtype: str - """ - return self._longitude - - @longitude.setter - def longitude(self, longitude): - """Sets the longitude of this PayeeLocation. - - - :param longitude: The longitude of this PayeeLocation. # noqa: E501 - :type: str - """ - if longitude is None: - raise ValueError("Invalid value for `longitude`, must not be `None`") # noqa: E501 - - self._longitude = longitude - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PayeeLocation): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/payee_location_response.py b/ynab/models/payee_location_response.py deleted file mode 100644 index a96cf90..0000000 --- a/ynab/models/payee_location_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.payee_location_wrapper import PayeeLocationWrapper # noqa: F401,E501 - - -class PayeeLocationResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'PayeeLocationWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """PayeeLocationResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this PayeeLocationResponse. # noqa: E501 - - - :return: The data of this PayeeLocationResponse. # noqa: E501 - :rtype: PayeeLocationWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this PayeeLocationResponse. - - - :param data: The data of this PayeeLocationResponse. # noqa: E501 - :type: PayeeLocationWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PayeeLocationResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/payee_location_wrapper.py b/ynab/models/payee_location_wrapper.py deleted file mode 100644 index e31c5f9..0000000 --- a/ynab/models/payee_location_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.payee_location import PayeeLocation # noqa: F401,E501 - - -class PayeeLocationWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'payee_location': 'PayeeLocation' - } - - attribute_map = { - 'payee_location': 'payee_location' - } - - def __init__(self, payee_location=None): # noqa: E501 - """PayeeLocationWrapper - a model defined in Swagger""" # noqa: E501 - - self._payee_location = None - self.discriminator = None - - self.payee_location = payee_location - - @property - def payee_location(self): - """Gets the payee_location of this PayeeLocationWrapper. # noqa: E501 - - - :return: The payee_location of this PayeeLocationWrapper. # noqa: E501 - :rtype: PayeeLocation - """ - return self._payee_location - - @payee_location.setter - def payee_location(self, payee_location): - """Sets the payee_location of this PayeeLocationWrapper. - - - :param payee_location: The payee_location of this PayeeLocationWrapper. # noqa: E501 - :type: PayeeLocation - """ - if payee_location is None: - raise ValueError("Invalid value for `payee_location`, must not be `None`") # noqa: E501 - - self._payee_location = payee_location - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PayeeLocationWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/payee_locations_response.py b/ynab/models/payee_locations_response.py deleted file mode 100644 index 98d1bec..0000000 --- a/ynab/models/payee_locations_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.payee_locations_wrapper import PayeeLocationsWrapper # noqa: F401,E501 - - -class PayeeLocationsResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'PayeeLocationsWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """PayeeLocationsResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this PayeeLocationsResponse. # noqa: E501 - - - :return: The data of this PayeeLocationsResponse. # noqa: E501 - :rtype: PayeeLocationsWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this PayeeLocationsResponse. - - - :param data: The data of this PayeeLocationsResponse. # noqa: E501 - :type: PayeeLocationsWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PayeeLocationsResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/payee_locations_wrapper.py b/ynab/models/payee_locations_wrapper.py deleted file mode 100644 index 4838899..0000000 --- a/ynab/models/payee_locations_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.payee_location import PayeeLocation # noqa: F401,E501 - - -class PayeeLocationsWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'payee_locations': 'list[PayeeLocation]' - } - - attribute_map = { - 'payee_locations': 'payee_locations' - } - - def __init__(self, payee_locations=None): # noqa: E501 - """PayeeLocationsWrapper - a model defined in Swagger""" # noqa: E501 - - self._payee_locations = None - self.discriminator = None - - self.payee_locations = payee_locations - - @property - def payee_locations(self): - """Gets the payee_locations of this PayeeLocationsWrapper. # noqa: E501 - - - :return: The payee_locations of this PayeeLocationsWrapper. # noqa: E501 - :rtype: list[PayeeLocation] - """ - return self._payee_locations - - @payee_locations.setter - def payee_locations(self, payee_locations): - """Sets the payee_locations of this PayeeLocationsWrapper. - - - :param payee_locations: The payee_locations of this PayeeLocationsWrapper. # noqa: E501 - :type: list[PayeeLocation] - """ - if payee_locations is None: - raise ValueError("Invalid value for `payee_locations`, must not be `None`") # noqa: E501 - - self._payee_locations = payee_locations - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PayeeLocationsWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/payee_response.py b/ynab/models/payee_response.py deleted file mode 100644 index 95d8609..0000000 --- a/ynab/models/payee_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.payee_wrapper import PayeeWrapper # noqa: F401,E501 - - -class PayeeResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'PayeeWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """PayeeResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this PayeeResponse. # noqa: E501 - - - :return: The data of this PayeeResponse. # noqa: E501 - :rtype: PayeeWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this PayeeResponse. - - - :param data: The data of this PayeeResponse. # noqa: E501 - :type: PayeeWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PayeeResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/payee_wrapper.py b/ynab/models/payee_wrapper.py deleted file mode 100644 index a05f0cd..0000000 --- a/ynab/models/payee_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.payee import Payee # noqa: F401,E501 - - -class PayeeWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'payee': 'Payee' - } - - attribute_map = { - 'payee': 'payee' - } - - def __init__(self, payee=None): # noqa: E501 - """PayeeWrapper - a model defined in Swagger""" # noqa: E501 - - self._payee = None - self.discriminator = None - - self.payee = payee - - @property - def payee(self): - """Gets the payee of this PayeeWrapper. # noqa: E501 - - - :return: The payee of this PayeeWrapper. # noqa: E501 - :rtype: Payee - """ - return self._payee - - @payee.setter - def payee(self, payee): - """Sets the payee of this PayeeWrapper. - - - :param payee: The payee of this PayeeWrapper. # noqa: E501 - :type: Payee - """ - if payee is None: - raise ValueError("Invalid value for `payee`, must not be `None`") # noqa: E501 - - self._payee = payee - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PayeeWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/payees_response.py b/ynab/models/payees_response.py deleted file mode 100644 index 6502c7b..0000000 --- a/ynab/models/payees_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.payees_wrapper import PayeesWrapper # noqa: F401,E501 - - -class PayeesResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'PayeesWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """PayeesResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this PayeesResponse. # noqa: E501 - - - :return: The data of this PayeesResponse. # noqa: E501 - :rtype: PayeesWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this PayeesResponse. - - - :param data: The data of this PayeesResponse. # noqa: E501 - :type: PayeesWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PayeesResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/payees_wrapper.py b/ynab/models/payees_wrapper.py deleted file mode 100644 index 64c1707..0000000 --- a/ynab/models/payees_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.payee import Payee # noqa: F401,E501 - - -class PayeesWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'payees': 'list[Payee]' - } - - attribute_map = { - 'payees': 'payees' - } - - def __init__(self, payees=None): # noqa: E501 - """PayeesWrapper - a model defined in Swagger""" # noqa: E501 - - self._payees = None - self.discriminator = None - - self.payees = payees - - @property - def payees(self): - """Gets the payees of this PayeesWrapper. # noqa: E501 - - - :return: The payees of this PayeesWrapper. # noqa: E501 - :rtype: list[Payee] - """ - return self._payees - - @payees.setter - def payees(self, payees): - """Sets the payees of this PayeesWrapper. - - - :param payees: The payees of this PayeesWrapper. # noqa: E501 - :type: list[Payee] - """ - if payees is None: - raise ValueError("Invalid value for `payees`, must not be `None`") # noqa: E501 - - self._payees = payees - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PayeesWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/save_transaction.py b/ynab/models/save_transaction.py deleted file mode 100644 index 93c0da0..0000000 --- a/ynab/models/save_transaction.py +++ /dev/null @@ -1,403 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class SaveTransaction(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'account_id': 'str', - 'date': 'date', - 'amount': 'float', - 'payee_id': 'str', - 'payee_name': 'str', - 'category_id': 'str', - 'memo': 'str', - 'cleared': 'str', - 'approved': 'bool', - 'flag_color': 'str', - 'import_id': 'str' - } - - attribute_map = { - 'account_id': 'account_id', - 'date': 'date', - 'amount': 'amount', - 'payee_id': 'payee_id', - 'payee_name': 'payee_name', - 'category_id': 'category_id', - 'memo': 'memo', - 'cleared': 'cleared', - 'approved': 'approved', - 'flag_color': 'flag_color', - 'import_id': 'import_id' - } - - def __init__(self, account_id=None, date=None, amount=None, payee_id=None, payee_name=None, category_id=None, memo=None, cleared=None, approved=None, flag_color=None, import_id=None): # noqa: E501 - """SaveTransaction - a model defined in Swagger""" # noqa: E501 - - self._account_id = None - self._date = None - self._amount = None - self._payee_id = None - self._payee_name = None - self._category_id = None - self._memo = None - self._cleared = None - self._approved = None - self._flag_color = None - self._import_id = None - self.discriminator = None - - self.account_id = account_id - self.date = date - self.amount = amount - if payee_id is not None: - self.payee_id = payee_id - if payee_name is not None: - self.payee_name = payee_name - if category_id is not None: - self.category_id = category_id - if memo is not None: - self.memo = memo - if cleared is not None: - self.cleared = cleared - if approved is not None: - self.approved = approved - if flag_color is not None: - self.flag_color = flag_color - if import_id is not None: - self.import_id = import_id - - @property - def account_id(self): - """Gets the account_id of this SaveTransaction. # noqa: E501 - - - :return: The account_id of this SaveTransaction. # noqa: E501 - :rtype: str - """ - return self._account_id - - @account_id.setter - def account_id(self, account_id): - """Sets the account_id of this SaveTransaction. - - - :param account_id: The account_id of this SaveTransaction. # noqa: E501 - :type: str - """ - # if account_id is None: - # raise ValueError("Invalid value for `account_id`, must not be `None`") # noqa: E501 - - self._account_id = account_id - - @property - def date(self): - """Gets the date of this SaveTransaction. # noqa: E501 - - - :return: The date of this SaveTransaction. # noqa: E501 - :rtype: date - """ - return self._date - - @date.setter - def date(self, date): - """Sets the date of this SaveTransaction. - - - :param date: The date of this SaveTransaction. # noqa: E501 - :type: date - """ - # if date is None: - # raise ValueError("Invalid value for `date`, must not be `None`") # noqa: E501 - - self._date = date - - @property - def amount(self): - """Gets the amount of this SaveTransaction. # noqa: E501 - - The transaction amount in milliunits format # noqa: E501 - - :return: The amount of this SaveTransaction. # noqa: E501 - :rtype: float - """ - return self._amount - - @amount.setter - def amount(self, amount): - """Sets the amount of this SaveTransaction. - - The transaction amount in milliunits format # noqa: E501 - - :param amount: The amount of this SaveTransaction. # noqa: E501 - :type: float - """ - # if amount is None: - # raise ValueError("Invalid value for `amount`, must not be `None`") # noqa: E501 - - self._amount = amount - - @property - def payee_id(self): - """Gets the payee_id of this SaveTransaction. # noqa: E501 - - The payee for the transaction. Transfer payees are not permitted and will be ignored if supplied. # noqa: E501 - - :return: The payee_id of this SaveTransaction. # noqa: E501 - :rtype: str - """ - return self._payee_id - - @payee_id.setter - def payee_id(self, payee_id): - """Sets the payee_id of this SaveTransaction. - - The payee for the transaction. Transfer payees are not permitted and will be ignored if supplied. # noqa: E501 - - :param payee_id: The payee_id of this SaveTransaction. # noqa: E501 - :type: str - """ - - self._payee_id = payee_id - - @property - def payee_name(self): - """Gets the payee_name of this SaveTransaction. # noqa: E501 - - The payee name. If a payee_name value is provided and payee_id is not included or has a null value, payee_name will be used to create or use an existing payee. # noqa: E501 - - :return: The payee_name of this SaveTransaction. # noqa: E501 - :rtype: str - """ - return self._payee_name - - @payee_name.setter - def payee_name(self, payee_name): - """Sets the payee_name of this SaveTransaction. - - The payee name. If a payee_name value is provided and payee_id is not included or has a null value, payee_name will be used to create or use an existing payee. # noqa: E501 - - :param payee_name: The payee_name of this SaveTransaction. # noqa: E501 - :type: str - """ - - self._payee_name = payee_name - - @property - def category_id(self): - """Gets the category_id of this SaveTransaction. # noqa: E501 - - The category for the transaction. Split and Credit Card Payment categories are not permitted and will be ignored if supplied. # noqa: E501 - - :return: The category_id of this SaveTransaction. # noqa: E501 - :rtype: str - """ - return self._category_id - - @category_id.setter - def category_id(self, category_id): - """Sets the category_id of this SaveTransaction. - - The category for the transaction. Split and Credit Card Payment categories are not permitted and will be ignored if supplied. # noqa: E501 - - :param category_id: The category_id of this SaveTransaction. # noqa: E501 - :type: str - """ - - self._category_id = category_id - - @property - def memo(self): - """Gets the memo of this SaveTransaction. # noqa: E501 - - - :return: The memo of this SaveTransaction. # noqa: E501 - :rtype: str - """ - return self._memo - - @memo.setter - def memo(self, memo): - """Sets the memo of this SaveTransaction. - - - :param memo: The memo of this SaveTransaction. # noqa: E501 - :type: str - """ - - self._memo = memo - - @property - def cleared(self): - """Gets the cleared of this SaveTransaction. # noqa: E501 - - The cleared status of the transaction # noqa: E501 - - :return: The cleared of this SaveTransaction. # noqa: E501 - :rtype: str - """ - return self._cleared - - @cleared.setter - def cleared(self, cleared): - """Sets the cleared of this SaveTransaction. - - The cleared status of the transaction # noqa: E501 - - :param cleared: The cleared of this SaveTransaction. # noqa: E501 - :type: str - """ - allowed_values = ["cleared", "uncleared", "reconciled"] # noqa: E501 - if cleared not in allowed_values: - raise ValueError( - "Invalid value for `cleared` ({0}), must be one of {1}" # noqa: E501 - .format(cleared, allowed_values) - ) - - self._cleared = cleared - - @property - def approved(self): - """Gets the approved of this SaveTransaction. # noqa: E501 - - Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default. # noqa: E501 - - :return: The approved of this SaveTransaction. # noqa: E501 - :rtype: bool - """ - return self._approved - - @approved.setter - def approved(self, approved): - """Sets the approved of this SaveTransaction. - - Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default. # noqa: E501 - - :param approved: The approved of this SaveTransaction. # noqa: E501 - :type: bool - """ - - self._approved = approved - - @property - def flag_color(self): - """Gets the flag_color of this SaveTransaction. # noqa: E501 - - The transaction flag # noqa: E501 - - :return: The flag_color of this SaveTransaction. # noqa: E501 - :rtype: str - """ - return self._flag_color - - @flag_color.setter - def flag_color(self, flag_color): - """Sets the flag_color of this SaveTransaction. - - The transaction flag # noqa: E501 - - :param flag_color: The flag_color of this SaveTransaction. # noqa: E501 - :type: str - """ - allowed_values = ["red", "orange", "yellow", "green", "blue", "purple"] # noqa: E501 - if flag_color not in allowed_values: - raise ValueError( - "Invalid value for `flag_color` ({0}), must be one of {1}" # noqa: E501 - .format(flag_color, allowed_values) - ) - - self._flag_color = flag_color - - @property - def import_id(self): - """Gets the import_id of this SaveTransaction. # noqa: E501 - - If specified for a new transaction, the transaction will be treated as Imported and assigned this import_id. If another transaction on the same account with this same import_id is later attempted to be created, it will be skipped to prevent duplication. Transactions imported through File Based Import or Direct Import and 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 specified as null, the transaction will be treated as a user entered transaction. # noqa: E501 - - :return: The import_id of this SaveTransaction. # noqa: E501 - :rtype: str - """ - return self._import_id - - @import_id.setter - def import_id(self, import_id): - """Sets the import_id of this SaveTransaction. - - If specified for a new transaction, the transaction will be treated as Imported and assigned this import_id. If another transaction on the same account with this same import_id is later attempted to be created, it will be skipped to prevent duplication. Transactions imported through File Based Import or Direct Import and 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 specified as null, the transaction will be treated as a user entered transaction. # noqa: E501 - - :param import_id: The import_id of this SaveTransaction. # noqa: E501 - :type: str - """ - - self._import_id = import_id - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, SaveTransaction): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/save_transaction_wrapper.py b/ynab/models/save_transaction_wrapper.py deleted file mode 100644 index d29d08a..0000000 --- a/ynab/models/save_transaction_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.save_transaction import SaveTransaction # noqa: F401,E501 - - -class SaveTransactionWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'transaction': 'SaveTransaction' - } - - attribute_map = { - 'transaction': 'transaction' - } - - def __init__(self, transaction=None): # noqa: E501 - """SaveTransactionWrapper - a model defined in Swagger""" # noqa: E501 - - self._transaction = None - self.discriminator = None - - self.transaction = transaction - - @property - def transaction(self): - """Gets the transaction of this SaveTransactionWrapper. # noqa: E501 - - - :return: The transaction of this SaveTransactionWrapper. # noqa: E501 - :rtype: SaveTransaction - """ - return self._transaction - - @transaction.setter - def transaction(self, transaction): - """Sets the transaction of this SaveTransactionWrapper. - - - :param transaction: The transaction of this SaveTransactionWrapper. # noqa: E501 - :type: SaveTransaction - """ - # if transaction is None: - # raise ValueError("Invalid value for `transaction`, must not be `None`") # noqa: E501 - - self._transaction = transaction - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, SaveTransactionWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/scheduled_sub_transaction.py b/ynab/models/scheduled_sub_transaction.py deleted file mode 100644 index 08c8324..0000000 --- a/ynab/models/scheduled_sub_transaction.py +++ /dev/null @@ -1,279 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class ScheduledSubTransaction(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'scheduled_transaction_id': 'str', - 'amount': 'float', - 'memo': 'str', - 'payee_id': 'str', - 'category_id': 'str', - 'transfer_account_id': 'str' - } - - attribute_map = { - 'id': 'id', - 'scheduled_transaction_id': 'scheduled_transaction_id', - 'amount': 'amount', - 'memo': 'memo', - 'payee_id': 'payee_id', - 'category_id': 'category_id', - 'transfer_account_id': 'transfer_account_id' - } - - def __init__(self, id=None, scheduled_transaction_id=None, amount=None, memo=None, payee_id=None, category_id=None, transfer_account_id=None): # noqa: E501 - """ScheduledSubTransaction - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._scheduled_transaction_id = None - self._amount = None - self._memo = None - self._payee_id = None - self._category_id = None - self._transfer_account_id = None - self.discriminator = None - - self.id = id - self.scheduled_transaction_id = scheduled_transaction_id - self.amount = amount - self.memo = memo - self.payee_id = payee_id - self.category_id = category_id - self.transfer_account_id = transfer_account_id - - @property - def id(self): - """Gets the id of this ScheduledSubTransaction. # noqa: E501 - - - :return: The id of this ScheduledSubTransaction. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this ScheduledSubTransaction. - - - :param id: The id of this ScheduledSubTransaction. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def scheduled_transaction_id(self): - """Gets the scheduled_transaction_id of this ScheduledSubTransaction. # noqa: E501 - - - :return: The scheduled_transaction_id of this ScheduledSubTransaction. # noqa: E501 - :rtype: str - """ - return self._scheduled_transaction_id - - @scheduled_transaction_id.setter - def scheduled_transaction_id(self, scheduled_transaction_id): - """Sets the scheduled_transaction_id of this ScheduledSubTransaction. - - - :param scheduled_transaction_id: The scheduled_transaction_id of this ScheduledSubTransaction. # noqa: E501 - :type: str - """ - if scheduled_transaction_id is None: - raise ValueError("Invalid value for `scheduled_transaction_id`, must not be `None`") # noqa: E501 - - self._scheduled_transaction_id = scheduled_transaction_id - - @property - def amount(self): - """Gets the amount of this ScheduledSubTransaction. # noqa: E501 - - The scheduled subtransaction amount in milliunits format # noqa: E501 - - :return: The amount of this ScheduledSubTransaction. # noqa: E501 - :rtype: float - """ - return self._amount - - @amount.setter - def amount(self, amount): - """Sets the amount of this ScheduledSubTransaction. - - The scheduled subtransaction amount in milliunits format # noqa: E501 - - :param amount: The amount of this ScheduledSubTransaction. # noqa: E501 - :type: float - """ - if amount is None: - raise ValueError("Invalid value for `amount`, must not be `None`") # noqa: E501 - - self._amount = amount - - @property - def memo(self): - """Gets the memo of this ScheduledSubTransaction. # noqa: E501 - - - :return: The memo of this ScheduledSubTransaction. # noqa: E501 - :rtype: str - """ - return self._memo - - @memo.setter - def memo(self, memo): - """Sets the memo of this ScheduledSubTransaction. - - - :param memo: The memo of this ScheduledSubTransaction. # noqa: E501 - :type: str - """ - if memo is None: - raise ValueError("Invalid value for `memo`, must not be `None`") # noqa: E501 - - self._memo = memo - - @property - def payee_id(self): - """Gets the payee_id of this ScheduledSubTransaction. # noqa: E501 - - - :return: The payee_id of this ScheduledSubTransaction. # noqa: E501 - :rtype: str - """ - return self._payee_id - - @payee_id.setter - def payee_id(self, payee_id): - """Sets the payee_id of this ScheduledSubTransaction. - - - :param payee_id: The payee_id of this ScheduledSubTransaction. # noqa: E501 - :type: str - """ - if payee_id is None: - raise ValueError("Invalid value for `payee_id`, must not be `None`") # noqa: E501 - - self._payee_id = payee_id - - @property - def category_id(self): - """Gets the category_id of this ScheduledSubTransaction. # noqa: E501 - - - :return: The category_id of this ScheduledSubTransaction. # noqa: E501 - :rtype: str - """ - return self._category_id - - @category_id.setter - def category_id(self, category_id): - """Sets the category_id of this ScheduledSubTransaction. - - - :param category_id: The category_id of this ScheduledSubTransaction. # noqa: E501 - :type: str - """ - if category_id is None: - raise ValueError("Invalid value for `category_id`, must not be `None`") # noqa: E501 - - self._category_id = category_id - - @property - def transfer_account_id(self): - """Gets the transfer_account_id of this ScheduledSubTransaction. # noqa: E501 - - If a transfer, the account_id which the scheduled sub transaction transfers to # noqa: E501 - - :return: The transfer_account_id of this ScheduledSubTransaction. # noqa: E501 - :rtype: str - """ - return self._transfer_account_id - - @transfer_account_id.setter - def transfer_account_id(self, transfer_account_id): - """Sets the transfer_account_id of this ScheduledSubTransaction. - - If a transfer, the account_id which the scheduled sub transaction transfers to # noqa: E501 - - :param transfer_account_id: The transfer_account_id of this ScheduledSubTransaction. # noqa: E501 - :type: str - """ - if transfer_account_id is None: - raise ValueError("Invalid value for `transfer_account_id`, must not be `None`") # noqa: E501 - - self._transfer_account_id = transfer_account_id - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScheduledSubTransaction): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/scheduled_transaction_detail.py b/ynab/models/scheduled_transaction_detail.py deleted file mode 100644 index f0f9076..0000000 --- a/ynab/models/scheduled_transaction_detail.py +++ /dev/null @@ -1,518 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.scheduled_sub_transaction import ScheduledSubTransaction # noqa: F401,E501 -from ynab.models.scheduled_transaction_summary import ScheduledTransactionSummary # noqa: F401,E501 - - -class ScheduledTransactionDetail(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'date_first': 'date', - 'date_next': 'date', - 'frequency': 'str', - 'amount': 'float', - 'memo': 'str', - 'flag_color': 'str', - 'account_id': 'str', - 'payee_id': 'str', - 'category_id': 'str', - 'transfer_account_id': 'str', - 'account_name': 'str', - 'payee_name': 'str', - 'category_name': 'str', - 'subtransactions': 'list[ScheduledSubTransaction]' - } - - attribute_map = { - 'id': 'id', - 'date_first': 'date_first', - 'date_next': 'date_next', - 'frequency': 'frequency', - 'amount': 'amount', - 'memo': 'memo', - 'flag_color': 'flag_color', - 'account_id': 'account_id', - 'payee_id': 'payee_id', - 'category_id': 'category_id', - 'transfer_account_id': 'transfer_account_id', - 'account_name': 'account_name', - 'payee_name': 'payee_name', - 'category_name': 'category_name', - 'subtransactions': 'subtransactions' - } - - def __init__(self, id=None, date_first=None, date_next=None, frequency=None, amount=None, memo=None, flag_color=None, account_id=None, payee_id=None, category_id=None, transfer_account_id=None, account_name=None, payee_name=None, category_name=None, subtransactions=None): # noqa: E501 - """ScheduledTransactionDetail - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._date_first = None - self._date_next = None - self._frequency = None - self._amount = None - self._memo = None - self._flag_color = None - self._account_id = None - self._payee_id = None - self._category_id = None - self._transfer_account_id = None - self._account_name = None - self._payee_name = None - self._category_name = None - self._subtransactions = None - self.discriminator = None - - self.id = id - self.date_first = date_first - self.date_next = date_next - self.frequency = frequency - self.amount = amount - self.memo = memo - self.flag_color = flag_color - self.account_id = account_id - self.payee_id = payee_id - self.category_id = category_id - self.transfer_account_id = transfer_account_id - self.account_name = account_name - self.payee_name = payee_name - self.category_name = category_name - self.subtransactions = subtransactions - - @property - def id(self): - """Gets the id of this ScheduledTransactionDetail. # noqa: E501 - - - :return: The id of this ScheduledTransactionDetail. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this ScheduledTransactionDetail. - - - :param id: The id of this ScheduledTransactionDetail. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def date_first(self): - """Gets the date_first of this ScheduledTransactionDetail. # noqa: E501 - - The first date for which the Scheduled Transaction was scheduled. # noqa: E501 - - :return: The date_first of this ScheduledTransactionDetail. # noqa: E501 - :rtype: date - """ - return self._date_first - - @date_first.setter - def date_first(self, date_first): - """Sets the date_first of this ScheduledTransactionDetail. - - The first date for which the Scheduled Transaction was scheduled. # noqa: E501 - - :param date_first: The date_first of this ScheduledTransactionDetail. # noqa: E501 - :type: date - """ - if date_first is None: - raise ValueError("Invalid value for `date_first`, must not be `None`") # noqa: E501 - - self._date_first = date_first - - @property - def date_next(self): - """Gets the date_next of this ScheduledTransactionDetail. # noqa: E501 - - The next date for which the Scheduled Transaction is scheduled. # noqa: E501 - - :return: The date_next of this ScheduledTransactionDetail. # noqa: E501 - :rtype: date - """ - return self._date_next - - @date_next.setter - def date_next(self, date_next): - """Sets the date_next of this ScheduledTransactionDetail. - - The next date for which the Scheduled Transaction is scheduled. # noqa: E501 - - :param date_next: The date_next of this ScheduledTransactionDetail. # noqa: E501 - :type: date - """ - if date_next is None: - raise ValueError("Invalid value for `date_next`, must not be `None`") # noqa: E501 - - self._date_next = date_next - - @property - def frequency(self): - """Gets the frequency of this ScheduledTransactionDetail. # noqa: E501 - - - :return: The frequency of this ScheduledTransactionDetail. # noqa: E501 - :rtype: str - """ - return self._frequency - - @frequency.setter - def frequency(self, frequency): - """Sets the frequency of this ScheduledTransactionDetail. - - - :param frequency: The frequency of this ScheduledTransactionDetail. # noqa: E501 - :type: str - """ - if frequency is None: - raise ValueError("Invalid value for `frequency`, must not be `None`") # noqa: E501 - allowed_values = ["never", "daily", "weekly", "everyOtherWeek", "twiceAMonth", "every4Weeks", "monthly", "everyOtherMonth", "every3Months", "every4Months", "twiceAYear", "yearly", "everyOtherYear"] # noqa: E501 - if frequency not in allowed_values: - raise ValueError( - "Invalid value for `frequency` ({0}), must be one of {1}" # noqa: E501 - .format(frequency, allowed_values) - ) - - self._frequency = frequency - - @property - def amount(self): - """Gets the amount of this ScheduledTransactionDetail. # noqa: E501 - - The scheduled transaction amount in milliunits format # noqa: E501 - - :return: The amount of this ScheduledTransactionDetail. # noqa: E501 - :rtype: float - """ - return self._amount - - @amount.setter - def amount(self, amount): - """Sets the amount of this ScheduledTransactionDetail. - - The scheduled transaction amount in milliunits format # noqa: E501 - - :param amount: The amount of this ScheduledTransactionDetail. # noqa: E501 - :type: float - """ - if amount is None: - raise ValueError("Invalid value for `amount`, must not be `None`") # noqa: E501 - - self._amount = amount - - @property - def memo(self): - """Gets the memo of this ScheduledTransactionDetail. # noqa: E501 - - - :return: The memo of this ScheduledTransactionDetail. # noqa: E501 - :rtype: str - """ - return self._memo - - @memo.setter - def memo(self, memo): - """Sets the memo of this ScheduledTransactionDetail. - - - :param memo: The memo of this ScheduledTransactionDetail. # noqa: E501 - :type: str - """ - if memo is None: - raise ValueError("Invalid value for `memo`, must not be `None`") # noqa: E501 - - self._memo = memo - - @property - def flag_color(self): - """Gets the flag_color of this ScheduledTransactionDetail. # noqa: E501 - - The scheduled transaction flag # noqa: E501 - - :return: The flag_color of this ScheduledTransactionDetail. # noqa: E501 - :rtype: str - """ - return self._flag_color - - @flag_color.setter - def flag_color(self, flag_color): - """Sets the flag_color of this ScheduledTransactionDetail. - - The scheduled transaction flag # noqa: E501 - - :param flag_color: The flag_color of this ScheduledTransactionDetail. # noqa: E501 - :type: str - """ - if flag_color is None: - raise ValueError("Invalid value for `flag_color`, must not be `None`") # noqa: E501 - allowed_values = ["red", "orange", "yellow", "green", "blue", "purple"] # noqa: E501 - if flag_color not in allowed_values: - raise ValueError( - "Invalid value for `flag_color` ({0}), must be one of {1}" # noqa: E501 - .format(flag_color, allowed_values) - ) - - self._flag_color = flag_color - - @property - def account_id(self): - """Gets the account_id of this ScheduledTransactionDetail. # noqa: E501 - - - :return: The account_id of this ScheduledTransactionDetail. # noqa: E501 - :rtype: str - """ - return self._account_id - - @account_id.setter - def account_id(self, account_id): - """Sets the account_id of this ScheduledTransactionDetail. - - - :param account_id: The account_id of this ScheduledTransactionDetail. # noqa: E501 - :type: str - """ - if account_id is None: - raise ValueError("Invalid value for `account_id`, must not be `None`") # noqa: E501 - - self._account_id = account_id - - @property - def payee_id(self): - """Gets the payee_id of this ScheduledTransactionDetail. # noqa: E501 - - - :return: The payee_id of this ScheduledTransactionDetail. # noqa: E501 - :rtype: str - """ - return self._payee_id - - @payee_id.setter - def payee_id(self, payee_id): - """Sets the payee_id of this ScheduledTransactionDetail. - - - :param payee_id: The payee_id of this ScheduledTransactionDetail. # noqa: E501 - :type: str - """ - if payee_id is None: - raise ValueError("Invalid value for `payee_id`, must not be `None`") # noqa: E501 - - self._payee_id = payee_id - - @property - def category_id(self): - """Gets the category_id of this ScheduledTransactionDetail. # noqa: E501 - - - :return: The category_id of this ScheduledTransactionDetail. # noqa: E501 - :rtype: str - """ - return self._category_id - - @category_id.setter - def category_id(self, category_id): - """Sets the category_id of this ScheduledTransactionDetail. - - - :param category_id: The category_id of this ScheduledTransactionDetail. # noqa: E501 - :type: str - """ - if category_id is None: - raise ValueError("Invalid value for `category_id`, must not be `None`") # noqa: E501 - - self._category_id = category_id - - @property - def transfer_account_id(self): - """Gets the transfer_account_id of this ScheduledTransactionDetail. # noqa: E501 - - If a transfer, the account_id which the scheduled transaction transfers to # noqa: E501 - - :return: The transfer_account_id of this ScheduledTransactionDetail. # noqa: E501 - :rtype: str - """ - return self._transfer_account_id - - @transfer_account_id.setter - def transfer_account_id(self, transfer_account_id): - """Sets the transfer_account_id of this ScheduledTransactionDetail. - - If a transfer, the account_id which the scheduled transaction transfers to # noqa: E501 - - :param transfer_account_id: The transfer_account_id of this ScheduledTransactionDetail. # noqa: E501 - :type: str - """ - if transfer_account_id is None: - raise ValueError("Invalid value for `transfer_account_id`, must not be `None`") # noqa: E501 - - self._transfer_account_id = transfer_account_id - - @property - def account_name(self): - """Gets the account_name of this ScheduledTransactionDetail. # noqa: E501 - - - :return: The account_name of this ScheduledTransactionDetail. # noqa: E501 - :rtype: str - """ - return self._account_name - - @account_name.setter - def account_name(self, account_name): - """Sets the account_name of this ScheduledTransactionDetail. - - - :param account_name: The account_name of this ScheduledTransactionDetail. # noqa: E501 - :type: str - """ - if account_name is None: - raise ValueError("Invalid value for `account_name`, must not be `None`") # noqa: E501 - - self._account_name = account_name - - @property - def payee_name(self): - """Gets the payee_name of this ScheduledTransactionDetail. # noqa: E501 - - - :return: The payee_name of this ScheduledTransactionDetail. # noqa: E501 - :rtype: str - """ - return self._payee_name - - @payee_name.setter - def payee_name(self, payee_name): - """Sets the payee_name of this ScheduledTransactionDetail. - - - :param payee_name: The payee_name of this ScheduledTransactionDetail. # noqa: E501 - :type: str - """ - if payee_name is None: - raise ValueError("Invalid value for `payee_name`, must not be `None`") # noqa: E501 - - self._payee_name = payee_name - - @property - def category_name(self): - """Gets the category_name of this ScheduledTransactionDetail. # noqa: E501 - - - :return: The category_name of this ScheduledTransactionDetail. # noqa: E501 - :rtype: str - """ - return self._category_name - - @category_name.setter - def category_name(self, category_name): - """Sets the category_name of this ScheduledTransactionDetail. - - - :param category_name: The category_name of this ScheduledTransactionDetail. # noqa: E501 - :type: str - """ - if category_name is None: - raise ValueError("Invalid value for `category_name`, must not be `None`") # noqa: E501 - - self._category_name = category_name - - @property - def subtransactions(self): - """Gets the subtransactions of this ScheduledTransactionDetail. # noqa: E501 - - If a split scheduled transaction, the subtransactions. # noqa: E501 - - :return: The subtransactions of this ScheduledTransactionDetail. # noqa: E501 - :rtype: list[ScheduledSubTransaction] - """ - return self._subtransactions - - @subtransactions.setter - def subtransactions(self, subtransactions): - """Sets the subtransactions of this ScheduledTransactionDetail. - - If a split scheduled transaction, the subtransactions. # noqa: E501 - - :param subtransactions: The subtransactions of this ScheduledTransactionDetail. # noqa: E501 - :type: list[ScheduledSubTransaction] - """ - if subtransactions is None: - raise ValueError("Invalid value for `subtransactions`, must not be `None`") # noqa: E501 - - self._subtransactions = subtransactions - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScheduledTransactionDetail): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/scheduled_transaction_response.py b/ynab/models/scheduled_transaction_response.py deleted file mode 100644 index 624cedd..0000000 --- a/ynab/models/scheduled_transaction_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.scheduled_transaction_wrapper import ScheduledTransactionWrapper # noqa: F401,E501 - - -class ScheduledTransactionResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'ScheduledTransactionWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """ScheduledTransactionResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this ScheduledTransactionResponse. # noqa: E501 - - - :return: The data of this ScheduledTransactionResponse. # noqa: E501 - :rtype: ScheduledTransactionWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ScheduledTransactionResponse. - - - :param data: The data of this ScheduledTransactionResponse. # noqa: E501 - :type: ScheduledTransactionWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScheduledTransactionResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/scheduled_transaction_summary.py b/ynab/models/scheduled_transaction_summary.py deleted file mode 100644 index a4d2feb..0000000 --- a/ynab/models/scheduled_transaction_summary.py +++ /dev/null @@ -1,405 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class ScheduledTransactionSummary(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'date_first': 'date', - 'date_next': 'date', - 'frequency': 'str', - 'amount': 'float', - 'memo': 'str', - 'flag_color': 'str', - 'account_id': 'str', - 'payee_id': 'str', - 'category_id': 'str', - 'transfer_account_id': 'str' - } - - attribute_map = { - 'id': 'id', - 'date_first': 'date_first', - 'date_next': 'date_next', - 'frequency': 'frequency', - 'amount': 'amount', - 'memo': 'memo', - 'flag_color': 'flag_color', - 'account_id': 'account_id', - 'payee_id': 'payee_id', - 'category_id': 'category_id', - 'transfer_account_id': 'transfer_account_id' - } - - def __init__(self, id=None, date_first=None, date_next=None, frequency=None, amount=None, memo=None, flag_color=None, account_id=None, payee_id=None, category_id=None, transfer_account_id=None): # noqa: E501 - """ScheduledTransactionSummary - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._date_first = None - self._date_next = None - self._frequency = None - self._amount = None - self._memo = None - self._flag_color = None - self._account_id = None - self._payee_id = None - self._category_id = None - self._transfer_account_id = None - self.discriminator = None - - self.id = id - self.date_first = date_first - self.date_next = date_next - self.frequency = frequency - self.amount = amount - self.memo = memo - self.flag_color = flag_color - self.account_id = account_id - self.payee_id = payee_id - self.category_id = category_id - self.transfer_account_id = transfer_account_id - - @property - def id(self): - """Gets the id of this ScheduledTransactionSummary. # noqa: E501 - - - :return: The id of this ScheduledTransactionSummary. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this ScheduledTransactionSummary. - - - :param id: The id of this ScheduledTransactionSummary. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def date_first(self): - """Gets the date_first of this ScheduledTransactionSummary. # noqa: E501 - - The first date for which the Scheduled Transaction was scheduled. # noqa: E501 - - :return: The date_first of this ScheduledTransactionSummary. # noqa: E501 - :rtype: date - """ - return self._date_first - - @date_first.setter - def date_first(self, date_first): - """Sets the date_first of this ScheduledTransactionSummary. - - The first date for which the Scheduled Transaction was scheduled. # noqa: E501 - - :param date_first: The date_first of this ScheduledTransactionSummary. # noqa: E501 - :type: date - """ - if date_first is None: - raise ValueError("Invalid value for `date_first`, must not be `None`") # noqa: E501 - - self._date_first = date_first - - @property - def date_next(self): - """Gets the date_next of this ScheduledTransactionSummary. # noqa: E501 - - The next date for which the Scheduled Transaction is scheduled. # noqa: E501 - - :return: The date_next of this ScheduledTransactionSummary. # noqa: E501 - :rtype: date - """ - return self._date_next - - @date_next.setter - def date_next(self, date_next): - """Sets the date_next of this ScheduledTransactionSummary. - - The next date for which the Scheduled Transaction is scheduled. # noqa: E501 - - :param date_next: The date_next of this ScheduledTransactionSummary. # noqa: E501 - :type: date - """ - if date_next is None: - raise ValueError("Invalid value for `date_next`, must not be `None`") # noqa: E501 - - self._date_next = date_next - - @property - def frequency(self): - """Gets the frequency of this ScheduledTransactionSummary. # noqa: E501 - - - :return: The frequency of this ScheduledTransactionSummary. # noqa: E501 - :rtype: str - """ - return self._frequency - - @frequency.setter - def frequency(self, frequency): - """Sets the frequency of this ScheduledTransactionSummary. - - - :param frequency: The frequency of this ScheduledTransactionSummary. # noqa: E501 - :type: str - """ - if frequency is None: - raise ValueError("Invalid value for `frequency`, must not be `None`") # noqa: E501 - allowed_values = ["never", "daily", "weekly", "everyOtherWeek", "twiceAMonth", "every4Weeks", "monthly", "everyOtherMonth", "every3Months", "every4Months", "twiceAYear", "yearly", "everyOtherYear"] # noqa: E501 - if frequency not in allowed_values: - raise ValueError( - "Invalid value for `frequency` ({0}), must be one of {1}" # noqa: E501 - .format(frequency, allowed_values) - ) - - self._frequency = frequency - - @property - def amount(self): - """Gets the amount of this ScheduledTransactionSummary. # noqa: E501 - - The scheduled transaction amount in milliunits format # noqa: E501 - - :return: The amount of this ScheduledTransactionSummary. # noqa: E501 - :rtype: float - """ - return self._amount - - @amount.setter - def amount(self, amount): - """Sets the amount of this ScheduledTransactionSummary. - - The scheduled transaction amount in milliunits format # noqa: E501 - - :param amount: The amount of this ScheduledTransactionSummary. # noqa: E501 - :type: float - """ - if amount is None: - raise ValueError("Invalid value for `amount`, must not be `None`") # noqa: E501 - - self._amount = amount - - @property - def memo(self): - """Gets the memo of this ScheduledTransactionSummary. # noqa: E501 - - - :return: The memo of this ScheduledTransactionSummary. # noqa: E501 - :rtype: str - """ - return self._memo - - @memo.setter - def memo(self, memo): - """Sets the memo of this ScheduledTransactionSummary. - - - :param memo: The memo of this ScheduledTransactionSummary. # noqa: E501 - :type: str - """ - if memo is None: - raise ValueError("Invalid value for `memo`, must not be `None`") # noqa: E501 - - self._memo = memo - - @property - def flag_color(self): - """Gets the flag_color of this ScheduledTransactionSummary. # noqa: E501 - - The scheduled transaction flag # noqa: E501 - - :return: The flag_color of this ScheduledTransactionSummary. # noqa: E501 - :rtype: str - """ - return self._flag_color - - @flag_color.setter - def flag_color(self, flag_color): - """Sets the flag_color of this ScheduledTransactionSummary. - - The scheduled transaction flag # noqa: E501 - - :param flag_color: The flag_color of this ScheduledTransactionSummary. # noqa: E501 - :type: str - """ - if flag_color is None: - raise ValueError("Invalid value for `flag_color`, must not be `None`") # noqa: E501 - allowed_values = ["red", "orange", "yellow", "green", "blue", "purple"] # noqa: E501 - if flag_color not in allowed_values: - raise ValueError( - "Invalid value for `flag_color` ({0}), must be one of {1}" # noqa: E501 - .format(flag_color, allowed_values) - ) - - self._flag_color = flag_color - - @property - def account_id(self): - """Gets the account_id of this ScheduledTransactionSummary. # noqa: E501 - - - :return: The account_id of this ScheduledTransactionSummary. # noqa: E501 - :rtype: str - """ - return self._account_id - - @account_id.setter - def account_id(self, account_id): - """Sets the account_id of this ScheduledTransactionSummary. - - - :param account_id: The account_id of this ScheduledTransactionSummary. # noqa: E501 - :type: str - """ - if account_id is None: - raise ValueError("Invalid value for `account_id`, must not be `None`") # noqa: E501 - - self._account_id = account_id - - @property - def payee_id(self): - """Gets the payee_id of this ScheduledTransactionSummary. # noqa: E501 - - - :return: The payee_id of this ScheduledTransactionSummary. # noqa: E501 - :rtype: str - """ - return self._payee_id - - @payee_id.setter - def payee_id(self, payee_id): - """Sets the payee_id of this ScheduledTransactionSummary. - - - :param payee_id: The payee_id of this ScheduledTransactionSummary. # noqa: E501 - :type: str - """ - if payee_id is None: - raise ValueError("Invalid value for `payee_id`, must not be `None`") # noqa: E501 - - self._payee_id = payee_id - - @property - def category_id(self): - """Gets the category_id of this ScheduledTransactionSummary. # noqa: E501 - - - :return: The category_id of this ScheduledTransactionSummary. # noqa: E501 - :rtype: str - """ - return self._category_id - - @category_id.setter - def category_id(self, category_id): - """Sets the category_id of this ScheduledTransactionSummary. - - - :param category_id: The category_id of this ScheduledTransactionSummary. # noqa: E501 - :type: str - """ - if category_id is None: - raise ValueError("Invalid value for `category_id`, must not be `None`") # noqa: E501 - - self._category_id = category_id - - @property - def transfer_account_id(self): - """Gets the transfer_account_id of this ScheduledTransactionSummary. # noqa: E501 - - If a transfer, the account_id which the scheduled transaction transfers to # noqa: E501 - - :return: The transfer_account_id of this ScheduledTransactionSummary. # noqa: E501 - :rtype: str - """ - return self._transfer_account_id - - @transfer_account_id.setter - def transfer_account_id(self, transfer_account_id): - """Sets the transfer_account_id of this ScheduledTransactionSummary. - - If a transfer, the account_id which the scheduled transaction transfers to # noqa: E501 - - :param transfer_account_id: The transfer_account_id of this ScheduledTransactionSummary. # noqa: E501 - :type: str - """ - if transfer_account_id is None: - raise ValueError("Invalid value for `transfer_account_id`, must not be `None`") # noqa: E501 - - self._transfer_account_id = transfer_account_id - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScheduledTransactionSummary): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/scheduled_transaction_wrapper.py b/ynab/models/scheduled_transaction_wrapper.py deleted file mode 100644 index 5343e7b..0000000 --- a/ynab/models/scheduled_transaction_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.scheduled_transaction_detail import ScheduledTransactionDetail # noqa: F401,E501 - - -class ScheduledTransactionWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'scheduled_transaction': 'ScheduledTransactionDetail' - } - - attribute_map = { - 'scheduled_transaction': 'scheduled_transaction' - } - - def __init__(self, scheduled_transaction=None): # noqa: E501 - """ScheduledTransactionWrapper - a model defined in Swagger""" # noqa: E501 - - self._scheduled_transaction = None - self.discriminator = None - - self.scheduled_transaction = scheduled_transaction - - @property - def scheduled_transaction(self): - """Gets the scheduled_transaction of this ScheduledTransactionWrapper. # noqa: E501 - - - :return: The scheduled_transaction of this ScheduledTransactionWrapper. # noqa: E501 - :rtype: ScheduledTransactionDetail - """ - return self._scheduled_transaction - - @scheduled_transaction.setter - def scheduled_transaction(self, scheduled_transaction): - """Sets the scheduled_transaction of this ScheduledTransactionWrapper. - - - :param scheduled_transaction: The scheduled_transaction of this ScheduledTransactionWrapper. # noqa: E501 - :type: ScheduledTransactionDetail - """ - if scheduled_transaction is None: - raise ValueError("Invalid value for `scheduled_transaction`, must not be `None`") # noqa: E501 - - self._scheduled_transaction = scheduled_transaction - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScheduledTransactionWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/scheduled_transactions_response.py b/ynab/models/scheduled_transactions_response.py deleted file mode 100644 index 20c79f1..0000000 --- a/ynab/models/scheduled_transactions_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.scheduled_transactions_wrapper import ScheduledTransactionsWrapper # noqa: F401,E501 - - -class ScheduledTransactionsResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'ScheduledTransactionsWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """ScheduledTransactionsResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this ScheduledTransactionsResponse. # noqa: E501 - - - :return: The data of this ScheduledTransactionsResponse. # noqa: E501 - :rtype: ScheduledTransactionsWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ScheduledTransactionsResponse. - - - :param data: The data of this ScheduledTransactionsResponse. # noqa: E501 - :type: ScheduledTransactionsWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScheduledTransactionsResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/scheduled_transactions_wrapper.py b/ynab/models/scheduled_transactions_wrapper.py deleted file mode 100644 index 78b465e..0000000 --- a/ynab/models/scheduled_transactions_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.scheduled_transaction_detail import ScheduledTransactionDetail # noqa: F401,E501 - - -class ScheduledTransactionsWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'scheduled_transactions': 'list[ScheduledTransactionDetail]' - } - - attribute_map = { - 'scheduled_transactions': 'scheduled_transactions' - } - - def __init__(self, scheduled_transactions=None): # noqa: E501 - """ScheduledTransactionsWrapper - a model defined in Swagger""" # noqa: E501 - - self._scheduled_transactions = None - self.discriminator = None - - self.scheduled_transactions = scheduled_transactions - - @property - def scheduled_transactions(self): - """Gets the scheduled_transactions of this ScheduledTransactionsWrapper. # noqa: E501 - - - :return: The scheduled_transactions of this ScheduledTransactionsWrapper. # noqa: E501 - :rtype: list[ScheduledTransactionDetail] - """ - return self._scheduled_transactions - - @scheduled_transactions.setter - def scheduled_transactions(self, scheduled_transactions): - """Sets the scheduled_transactions of this ScheduledTransactionsWrapper. - - - :param scheduled_transactions: The scheduled_transactions of this ScheduledTransactionsWrapper. # noqa: E501 - :type: list[ScheduledTransactionDetail] - """ - if scheduled_transactions is None: - raise ValueError("Invalid value for `scheduled_transactions`, must not be `None`") # noqa: E501 - - self._scheduled_transactions = scheduled_transactions - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScheduledTransactionsWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/sub_transaction.py b/ynab/models/sub_transaction.py deleted file mode 100644 index b599059..0000000 --- a/ynab/models/sub_transaction.py +++ /dev/null @@ -1,280 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class SubTransaction(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'transaction_id': 'str', - 'amount': 'float', - 'memo': 'str', - 'payee_id': 'str', - 'category_id': 'str', - 'transfer_account_id': 'str' - } - - attribute_map = { - 'id': 'id', - 'transaction_id': 'transaction_id', - 'amount': 'amount', - 'memo': 'memo', - 'payee_id': 'payee_id', - 'category_id': 'category_id', - 'transfer_account_id': 'transfer_account_id' - } - - def __init__(self, id=None, transaction_id=None, amount=None, memo=None, payee_id=None, category_id=None, transfer_account_id=None): # noqa: E501 - """SubTransaction - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._transaction_id = None - self._amount = None - self._memo = None - self._payee_id = None - self._category_id = None - self._transfer_account_id = None - self.discriminator = None - - self.id = id - self.transaction_id = transaction_id - self.amount = amount - self.memo = memo - self.payee_id = payee_id - self.category_id = category_id - self.transfer_account_id = transfer_account_id - - @property - def id(self): - """Gets the id of this SubTransaction. # noqa: E501 - - - :return: The id of this SubTransaction. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this SubTransaction. - - - :param id: The id of this SubTransaction. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def transaction_id(self): - """Gets the transaction_id of this SubTransaction. # noqa: E501 - - - :return: The transaction_id of this SubTransaction. # noqa: E501 - :rtype: str - """ - return self._transaction_id - - @transaction_id.setter - def transaction_id(self, transaction_id): - """Sets the transaction_id of this SubTransaction. - - - :param transaction_id: The transaction_id of this SubTransaction. # noqa: E501 - :type: str - """ - if transaction_id is None: - raise ValueError("Invalid value for `transaction_id`, must not be `None`") # noqa: E501 - - self._transaction_id = transaction_id - - @property - def amount(self): - """Gets the amount of this SubTransaction. # noqa: E501 - - The subtransaction amount in milliunits format # noqa: E501 - - :return: The amount of this SubTransaction. # noqa: E501 - :rtype: float - """ - return self._amount - - @amount.setter - def amount(self, amount): - """Sets the amount of this SubTransaction. - - The subtransaction amount in milliunits format # noqa: E501 - - :param amount: The amount of this SubTransaction. # noqa: E501 - :type: float - """ - if amount is None: - raise ValueError("Invalid value for `amount`, must not be `None`") # noqa: E501 - - self._amount = amount - - @property - def memo(self): - """Gets the memo of this SubTransaction. # noqa: E501 - - - :return: The memo of this SubTransaction. # noqa: E501 - :rtype: str - """ - return self._memo - - @memo.setter - def memo(self, memo): - """Sets the memo of this SubTransaction. - - - :param memo: The memo of this SubTransaction. # noqa: E501 - :type: str - """ - if memo is None: - raise ValueError("Invalid value for `memo`, must not be `None`") # noqa: E501 - - self._memo = memo - - @property - def payee_id(self): - """Gets the payee_id of this SubTransaction. # noqa: E501 - - - :return: The payee_id of this SubTransaction. # noqa: E501 - :rtype: str - """ - return self._payee_id - - @payee_id.setter - def payee_id(self, payee_id): - """Sets the payee_id of this SubTransaction. - - - :param payee_id: The payee_id of this SubTransaction. # noqa: E501 - :type: str - """ - if payee_id is None: - raise ValueError("Invalid value for `payee_id`, must not be `None`") # noqa: E501 - - self._payee_id = payee_id - - @property - def category_id(self): - """Gets the category_id of this SubTransaction. # noqa: E501 - - - :return: The category_id of this SubTransaction. # noqa: E501 - :rtype: str - """ - return self._category_id - - @category_id.setter - def category_id(self, category_id): - """Sets the category_id of this SubTransaction. - - - :param category_id: The category_id of this SubTransaction. # noqa: E501 - :type: str - """ - if category_id is None: - raise ValueError("Invalid value for `category_id`, must not be `None`") # noqa: E501 - - self._category_id = category_id - - @property - def transfer_account_id(self): - """Gets the transfer_account_id of this SubTransaction. # noqa: E501 - - If a transfer, the account_id which the subtransaction transfers to # noqa: E501 - - :return: The transfer_account_id of this SubTransaction. # noqa: E501 - :rtype: str - """ - return self._transfer_account_id - - @transfer_account_id.setter - def transfer_account_id(self, transfer_account_id): - """Sets the transfer_account_id of this SubTransaction. - - If a transfer, the account_id which the subtransaction transfers to # noqa: E501 - - :param transfer_account_id: The transfer_account_id of this SubTransaction. # noqa: E501 - :type: str - """ - # 2019.08.14: YNAB seem to return subtransactions that do not follow Swagger definition of data - #if transfer_account_id is None: - # raise ValueError("Invalid value for `transfer_account_id`, must not be `None`") # noqa: E501 - - self._transfer_account_id = transfer_account_id - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, SubTransaction): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/transaction_detail.py b/ynab/models/transaction_detail.py deleted file mode 100644 index 060a620..0000000 --- a/ynab/models/transaction_detail.py +++ /dev/null @@ -1,545 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.sub_transaction import SubTransaction # noqa: F401,E501 -from ynab.models.transaction_summary import TransactionSummary # noqa: F401,E501 - - -class TransactionDetail(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'date': 'date', - 'amount': 'float', - 'memo': 'str', - 'cleared': 'str', - 'approved': 'bool', - 'flag_color': 'str', - 'account_id': 'str', - 'payee_id': 'str', - 'category_id': 'str', - 'transfer_account_id': 'str', - 'import_id': 'str', - 'account_name': 'str', - 'payee_name': 'str', - 'category_name': 'str', - 'subtransactions': 'list[SubTransaction]' - } - - attribute_map = { - 'id': 'id', - 'date': 'date', - 'amount': 'amount', - 'memo': 'memo', - 'cleared': 'cleared', - 'approved': 'approved', - 'flag_color': 'flag_color', - 'account_id': 'account_id', - 'payee_id': 'payee_id', - 'category_id': 'category_id', - 'transfer_account_id': 'transfer_account_id', - 'import_id': 'import_id', - 'account_name': 'account_name', - 'payee_name': 'payee_name', - 'category_name': 'category_name', - 'subtransactions': 'subtransactions' - } - - def __init__(self, id=None, date=None, amount=None, memo=None, cleared=None, approved=None, flag_color=None, account_id=None, payee_id=None, category_id=None, transfer_account_id=None, import_id=None, account_name=None, payee_name=None, category_name=None, subtransactions=None): # noqa: E501 - """TransactionDetail - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._date = None - self._amount = None - self._memo = None - self._cleared = None - self._approved = None - self._flag_color = None - self._account_id = None - self._payee_id = None - self._category_id = None - self._transfer_account_id = None - self._import_id = None - self._account_name = None - self._payee_name = None - self._category_name = None - self._subtransactions = None - self.discriminator = None - - self.id = id - self.date = date - self.amount = amount - self.memo = memo - self.cleared = cleared - self.approved = approved - self.flag_color = flag_color - self.account_id = account_id - self.payee_id = payee_id - self.category_id = category_id - self.transfer_account_id = transfer_account_id - self.import_id = import_id - self.account_name = account_name - self.payee_name = payee_name - self.category_name = category_name - self.subtransactions = subtransactions - - @property - def id(self): - """Gets the id of this TransactionDetail. # noqa: E501 - - - :return: The id of this TransactionDetail. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this TransactionDetail. - - - :param id: The id of this TransactionDetail. # noqa: E501 - :type: str - """ - # if id is None: - # raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def date(self): - """Gets the date of this TransactionDetail. # noqa: E501 - - - :return: The date of this TransactionDetail. # noqa: E501 - :rtype: date - """ - return self._date - - @date.setter - def date(self, date): - """Sets the date of this TransactionDetail. - - - :param date: The date of this TransactionDetail. # noqa: E501 - :type: date - """ - if date is None: - raise ValueError("Invalid value for `date`, must not be `None`") # noqa: E501 - - self._date = date - - @property - def amount(self): - """Gets the amount of this TransactionDetail. # noqa: E501 - - The transaction amount in milliunits format # noqa: E501 - - :return: The amount of this TransactionDetail. # noqa: E501 - :rtype: float - """ - return self._amount - - @amount.setter - def amount(self, amount): - """Sets the amount of this TransactionDetail. - - The transaction amount in milliunits format # noqa: E501 - - :param amount: The amount of this TransactionDetail. # noqa: E501 - :type: float - """ - if amount is None: - raise ValueError("Invalid value for `amount`, must not be `None`") # noqa: E501 - - self._amount = amount - - @property - def memo(self): - """Gets the memo of this TransactionDetail. # noqa: E501 - - - :return: The memo of this TransactionDetail. # noqa: E501 - :rtype: str - """ - return self._memo - - @memo.setter - def memo(self, memo): - """Sets the memo of this TransactionDetail. - - - :param memo: The memo of this TransactionDetail. # noqa: E501 - :type: str - """ - # if memo is None: - # raise ValueError("Invalid value for `memo`, must not be `None`") # noqa: E501 - - self._memo = memo - - @property - def cleared(self): - """Gets the cleared of this TransactionDetail. # noqa: E501 - - The cleared status of the transaction # noqa: E501 - - :return: The cleared of this TransactionDetail. # noqa: E501 - :rtype: str - """ - return self._cleared - - @cleared.setter - def cleared(self, cleared): - """Sets the cleared of this TransactionDetail. - - The cleared status of the transaction # noqa: E501 - - :param cleared: The cleared of this TransactionDetail. # noqa: E501 - :type: str - """ - if cleared is None: - raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 - allowed_values = ["cleared", "uncleared", "reconciled"] # noqa: E501 - if cleared not in allowed_values: - raise ValueError( - "Invalid value for `cleared` ({0}), must be one of {1}" # noqa: E501 - .format(cleared, allowed_values) - ) - - self._cleared = cleared - - @property - def approved(self): - """Gets the approved of this TransactionDetail. # noqa: E501 - - Whether or not the transaction is approved # noqa: E501 - - :return: The approved of this TransactionDetail. # noqa: E501 - :rtype: bool - """ - return self._approved - - @approved.setter - def approved(self, approved): - """Sets the approved of this TransactionDetail. - - Whether or not the transaction is approved # noqa: E501 - - :param approved: The approved of this TransactionDetail. # noqa: E501 - :type: bool - """ - if approved is None: - raise ValueError("Invalid value for `approved`, must not be `None`") # noqa: E501 - - self._approved = approved - - @property - def flag_color(self): - """Gets the flag_color of this TransactionDetail. # noqa: E501 - - The transaction flag # noqa: E501 - - :return: The flag_color of this TransactionDetail. # noqa: E501 - :rtype: str - """ - return self._flag_color - - @flag_color.setter - def flag_color(self, flag_color): - """Sets the flag_color of this TransactionDetail. - - The transaction flag # noqa: E501 - - :param flag_color: The flag_color of this TransactionDetail. # noqa: E501 - :type: str - """ - # if flag_color is None: - # raise ValueError("Invalid value for `flag_color`, must not be `None`") # noqa: E501 - # allowed_values = ["red", "orange", "yellow", "green", "blue", "purple"] # noqa: E501 - # if flag_color not in allowed_values: - # raise ValueError( - # "Invalid value for `flag_color` ({0}), must be one of {1}" # noqa: E501 - # .format(flag_color, allowed_values) - # ) - - self._flag_color = flag_color - - @property - def account_id(self): - """Gets the account_id of this TransactionDetail. # noqa: E501 - - - :return: The account_id of this TransactionDetail. # noqa: E501 - :rtype: str - """ - return self._account_id - - @account_id.setter - def account_id(self, account_id): - """Sets the account_id of this TransactionDetail. - - - :param account_id: The account_id of this TransactionDetail. # noqa: E501 - :type: str - """ - if account_id is None: - raise ValueError("Invalid value for `account_id`, must not be `None`") # noqa: E501 - - self._account_id = account_id - - @property - def payee_id(self): - """Gets the payee_id of this TransactionDetail. # noqa: E501 - - - :return: The payee_id of this TransactionDetail. # noqa: E501 - :rtype: str - """ - return self._payee_id - - @payee_id.setter - def payee_id(self, payee_id): - """Sets the payee_id of this TransactionDetail. - - - :param payee_id: The payee_id of this TransactionDetail. # noqa: E501 - :type: str - """ - # if payee_id is None: - # raise ValueError("Invalid value for `payee_id`, must not be `None`") # noqa: E501 - - self._payee_id = payee_id - - @property - def category_id(self): - """Gets the category_id of this TransactionDetail. # noqa: E501 - - - :return: The category_id of this TransactionDetail. # noqa: E501 - :rtype: str - """ - return self._category_id - - @category_id.setter - def category_id(self, category_id): - """Sets the category_id of this TransactionDetail. - - - :param category_id: The category_id of this TransactionDetail. # noqa: E501 - :type: str - """ - # if category_id is None: - # raise ValueError("Invalid value for `category_id`, must not be `None`") # noqa: E501 - - self._category_id = category_id - - @property - def transfer_account_id(self): - """Gets the transfer_account_id of this TransactionDetail. # noqa: E501 - - - :return: The transfer_account_id of this TransactionDetail. # noqa: E501 - :rtype: str - """ - return self._transfer_account_id - - @transfer_account_id.setter - def transfer_account_id(self, transfer_account_id): - """Sets the transfer_account_id of this TransactionDetail. - - - :param transfer_account_id: The transfer_account_id of this TransactionDetail. # noqa: E501 - :type: str - """ - # if transfer_account_id is None: - # raise ValueError("Invalid value for `transfer_account_id`, must not be `None`") # noqa: E501 - - self._transfer_account_id = transfer_account_id - - @property - def import_id(self): - """Gets the import_id of this TransactionDetail. # noqa: E501 - - If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have 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'. # noqa: E501 - - :return: The import_id of this TransactionDetail. # noqa: E501 - :rtype: str - """ - return self._import_id - - @import_id.setter - def import_id(self, import_id): - """Sets the import_id of this TransactionDetail. - - If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have 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'. # noqa: E501 - - :param import_id: The import_id of this TransactionDetail. # noqa: E501 - :type: str - """ - # if import_id is None: - # raise ValueError("Invalid value for `import_id`, must not be `None`") # noqa: E501 - - self._import_id = import_id - - @property - def account_name(self): - """Gets the account_name of this TransactionDetail. # noqa: E501 - - - :return: The account_name of this TransactionDetail. # noqa: E501 - :rtype: str - """ - return self._account_name - - @account_name.setter - def account_name(self, account_name): - """Sets the account_name of this TransactionDetail. - - - :param account_name: The account_name of this TransactionDetail. # noqa: E501 - :type: str - """ - # if account_name is None: - # raise ValueError("Invalid value for `account_name`, must not be `None`") # noqa: E501 - - self._account_name = account_name - - @property - def payee_name(self): - """Gets the payee_name of this TransactionDetail. # noqa: E501 - - - :return: The payee_name of this TransactionDetail. # noqa: E501 - :rtype: str - """ - return self._payee_name - - @payee_name.setter - def payee_name(self, payee_name): - """Sets the payee_name of this TransactionDetail. - - - :param payee_name: The payee_name of this TransactionDetail. # noqa: E501 - :type: str - """ - # if payee_name is None: - # raise ValueError("Invalid value for `payee_name`, must not be `None`") # noqa: E501 - - self._payee_name = payee_name - - @property - def category_name(self): - """Gets the category_name of this TransactionDetail. # noqa: E501 - - - :return: The category_name of this TransactionDetail. # noqa: E501 - :rtype: str - """ - return self._category_name - - @category_name.setter - def category_name(self, category_name): - """Sets the category_name of this TransactionDetail. - - - :param category_name: The category_name of this TransactionDetail. # noqa: E501 - :type: str - """ - # if category_name is None: - # raise ValueError("Invalid value for `category_name`, must not be `None`") # noqa: E501 - - self._category_name = category_name - - @property - def subtransactions(self): - """Gets the subtransactions of this TransactionDetail. # noqa: E501 - - If a split transaction, the subtransactions. # noqa: E501 - - :return: The subtransactions of this TransactionDetail. # noqa: E501 - :rtype: list[SubTransaction] - """ - return self._subtransactions - - @subtransactions.setter - def subtransactions(self, subtransactions): - """Sets the subtransactions of this TransactionDetail. - - If a split transaction, the subtransactions. # noqa: E501 - - :param subtransactions: The subtransactions of this TransactionDetail. # noqa: E501 - :type: list[SubTransaction] - """ - # if subtransactions is None: - # raise ValueError("Invalid value for `subtransactions`, must not be `None`") # noqa: E501 - - self._subtransactions = subtransactions - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TransactionDetail): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/transaction_response.py b/ynab/models/transaction_response.py deleted file mode 100644 index e34d83b..0000000 --- a/ynab/models/transaction_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.transaction_wrapper import TransactionWrapper # noqa: F401,E501 - - -class TransactionResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'TransactionWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """TransactionResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this TransactionResponse. # noqa: E501 - - - :return: The data of this TransactionResponse. # noqa: E501 - :rtype: TransactionWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this TransactionResponse. - - - :param data: The data of this TransactionResponse. # noqa: E501 - :type: TransactionWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TransactionResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/transaction_summary.py b/ynab/models/transaction_summary.py deleted file mode 100644 index 2d01ea8..0000000 --- a/ynab/models/transaction_summary.py +++ /dev/null @@ -1,432 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class TransactionSummary(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'date': 'date', - 'amount': 'float', - 'memo': 'str', - 'cleared': 'str', - 'approved': 'bool', - 'flag_color': 'str', - 'account_id': 'str', - 'payee_id': 'str', - 'category_id': 'str', - 'transfer_account_id': 'str', - 'import_id': 'str' - } - - attribute_map = { - 'id': 'id', - 'date': 'date', - 'amount': 'amount', - 'memo': 'memo', - 'cleared': 'cleared', - 'approved': 'approved', - 'flag_color': 'flag_color', - 'account_id': 'account_id', - 'payee_id': 'payee_id', - 'category_id': 'category_id', - 'transfer_account_id': 'transfer_account_id', - 'import_id': 'import_id' - } - - def __init__(self, id=None, date=None, amount=None, memo=None, cleared=None, approved=None, flag_color=None, account_id=None, payee_id=None, category_id=None, transfer_account_id=None, import_id=None): # noqa: E501 - """TransactionSummary - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._date = None - self._amount = None - self._memo = None - self._cleared = None - self._approved = None - self._flag_color = None - self._account_id = None - self._payee_id = None - self._category_id = None - self._transfer_account_id = None - self._import_id = None - self.discriminator = None - - self.id = id - self.date = date - self.amount = amount - self.memo = memo - self.cleared = cleared - self.approved = approved - self.flag_color = flag_color - self.account_id = account_id - self.payee_id = payee_id - self.category_id = category_id - self.transfer_account_id = transfer_account_id - self.import_id = import_id - - @property - def id(self): - """Gets the id of this TransactionSummary. # noqa: E501 - - - :return: The id of this TransactionSummary. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this TransactionSummary. - - - :param id: The id of this TransactionSummary. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def date(self): - """Gets the date of this TransactionSummary. # noqa: E501 - - - :return: The date of this TransactionSummary. # noqa: E501 - :rtype: date - """ - return self._date - - @date.setter - def date(self, date): - """Sets the date of this TransactionSummary. - - - :param date: The date of this TransactionSummary. # noqa: E501 - :type: date - """ - if date is None: - raise ValueError("Invalid value for `date`, must not be `None`") # noqa: E501 - - self._date = date - - @property - def amount(self): - """Gets the amount of this TransactionSummary. # noqa: E501 - - The transaction amount in milliunits format # noqa: E501 - - :return: The amount of this TransactionSummary. # noqa: E501 - :rtype: float - """ - return self._amount - - @amount.setter - def amount(self, amount): - """Sets the amount of this TransactionSummary. - - The transaction amount in milliunits format # noqa: E501 - - :param amount: The amount of this TransactionSummary. # noqa: E501 - :type: float - """ - if amount is None: - raise ValueError("Invalid value for `amount`, must not be `None`") # noqa: E501 - - self._amount = amount - - @property - def memo(self): - """Gets the memo of this TransactionSummary. # noqa: E501 - - - :return: The memo of this TransactionSummary. # noqa: E501 - :rtype: str - """ - return self._memo - - @memo.setter - def memo(self, memo): - """Sets the memo of this TransactionSummary. - - - :param memo: The memo of this TransactionSummary. # noqa: E501 - :type: str - """ - if memo is None: - raise ValueError("Invalid value for `memo`, must not be `None`") # noqa: E501 - - self._memo = memo - - @property - def cleared(self): - """Gets the cleared of this TransactionSummary. # noqa: E501 - - The cleared status of the transaction # noqa: E501 - - :return: The cleared of this TransactionSummary. # noqa: E501 - :rtype: str - """ - return self._cleared - - @cleared.setter - def cleared(self, cleared): - """Sets the cleared of this TransactionSummary. - - The cleared status of the transaction # noqa: E501 - - :param cleared: The cleared of this TransactionSummary. # noqa: E501 - :type: str - """ - if cleared is None: - raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 - allowed_values = ["cleared", "uncleared", "reconciled"] # noqa: E501 - if cleared not in allowed_values: - raise ValueError( - "Invalid value for `cleared` ({0}), must be one of {1}" # noqa: E501 - .format(cleared, allowed_values) - ) - - self._cleared = cleared - - @property - def approved(self): - """Gets the approved of this TransactionSummary. # noqa: E501 - - Whether or not the transaction is approved # noqa: E501 - - :return: The approved of this TransactionSummary. # noqa: E501 - :rtype: bool - """ - return self._approved - - @approved.setter - def approved(self, approved): - """Sets the approved of this TransactionSummary. - - Whether or not the transaction is approved # noqa: E501 - - :param approved: The approved of this TransactionSummary. # noqa: E501 - :type: bool - """ - if approved is None: - raise ValueError("Invalid value for `approved`, must not be `None`") # noqa: E501 - - self._approved = approved - - @property - def flag_color(self): - """Gets the flag_color of this TransactionSummary. # noqa: E501 - - The transaction flag # noqa: E501 - - :return: The flag_color of this TransactionSummary. # noqa: E501 - :rtype: str - """ - return self._flag_color - - @flag_color.setter - def flag_color(self, flag_color): - """Sets the flag_color of this TransactionSummary. - - The transaction flag # noqa: E501 - - :param flag_color: The flag_color of this TransactionSummary. # noqa: E501 - :type: str - """ - if flag_color is None: - raise ValueError("Invalid value for `flag_color`, must not be `None`") # noqa: E501 - allowed_values = ["red", "orange", "yellow", "green", "blue", "purple"] # noqa: E501 - if flag_color not in allowed_values: - raise ValueError( - "Invalid value for `flag_color` ({0}), must be one of {1}" # noqa: E501 - .format(flag_color, allowed_values) - ) - - self._flag_color = flag_color - - @property - def account_id(self): - """Gets the account_id of this TransactionSummary. # noqa: E501 - - - :return: The account_id of this TransactionSummary. # noqa: E501 - :rtype: str - """ - return self._account_id - - @account_id.setter - def account_id(self, account_id): - """Sets the account_id of this TransactionSummary. - - - :param account_id: The account_id of this TransactionSummary. # noqa: E501 - :type: str - """ - if account_id is None: - raise ValueError("Invalid value for `account_id`, must not be `None`") # noqa: E501 - - self._account_id = account_id - - @property - def payee_id(self): - """Gets the payee_id of this TransactionSummary. # noqa: E501 - - - :return: The payee_id of this TransactionSummary. # noqa: E501 - :rtype: str - """ - return self._payee_id - - @payee_id.setter - def payee_id(self, payee_id): - """Sets the payee_id of this TransactionSummary. - - - :param payee_id: The payee_id of this TransactionSummary. # noqa: E501 - :type: str - """ - if payee_id is None: - raise ValueError("Invalid value for `payee_id`, must not be `None`") # noqa: E501 - - self._payee_id = payee_id - - @property - def category_id(self): - """Gets the category_id of this TransactionSummary. # noqa: E501 - - - :return: The category_id of this TransactionSummary. # noqa: E501 - :rtype: str - """ - return self._category_id - - @category_id.setter - def category_id(self, category_id): - """Sets the category_id of this TransactionSummary. - - - :param category_id: The category_id of this TransactionSummary. # noqa: E501 - :type: str - """ - if category_id is None: - raise ValueError("Invalid value for `category_id`, must not be `None`") # noqa: E501 - - self._category_id = category_id - - @property - def transfer_account_id(self): - """Gets the transfer_account_id of this TransactionSummary. # noqa: E501 - - - :return: The transfer_account_id of this TransactionSummary. # noqa: E501 - :rtype: str - """ - return self._transfer_account_id - - @transfer_account_id.setter - def transfer_account_id(self, transfer_account_id): - """Sets the transfer_account_id of this TransactionSummary. - - - :param transfer_account_id: The transfer_account_id of this TransactionSummary. # noqa: E501 - :type: str - """ - if transfer_account_id is None: - raise ValueError("Invalid value for `transfer_account_id`, must not be `None`") # noqa: E501 - - self._transfer_account_id = transfer_account_id - - @property - def import_id(self): - """Gets the import_id of this TransactionSummary. # noqa: E501 - - If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have 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'. # noqa: E501 - - :return: The import_id of this TransactionSummary. # noqa: E501 - :rtype: str - """ - return self._import_id - - @import_id.setter - def import_id(self, import_id): - """Sets the import_id of this TransactionSummary. - - If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have 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'. # noqa: E501 - - :param import_id: The import_id of this TransactionSummary. # noqa: E501 - :type: str - """ - if import_id is None: - raise ValueError("Invalid value for `import_id`, must not be `None`") # noqa: E501 - - self._import_id = import_id - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TransactionSummary): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/transaction_wrapper.py b/ynab/models/transaction_wrapper.py deleted file mode 100644 index ed36dee..0000000 --- a/ynab/models/transaction_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.transaction_detail import TransactionDetail # noqa: F401,E501 - - -class TransactionWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'transaction': 'TransactionDetail' - } - - attribute_map = { - 'transaction': 'transaction' - } - - def __init__(self, transaction=None): # noqa: E501 - """TransactionWrapper - a model defined in Swagger""" # noqa: E501 - - self._transaction = None - self.discriminator = None - - self.transaction = transaction - - @property - def transaction(self): - """Gets the transaction of this TransactionWrapper. # noqa: E501 - - - :return: The transaction of this TransactionWrapper. # noqa: E501 - :rtype: TransactionDetail - """ - return self._transaction - - @transaction.setter - def transaction(self, transaction): - """Sets the transaction of this TransactionWrapper. - - - :param transaction: The transaction of this TransactionWrapper. # noqa: E501 - :type: TransactionDetail - """ - # if transaction is None: - # raise ValueError("Invalid value for `transaction`, must not be `None`") # noqa: E501 - - self._transaction = transaction - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TransactionWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/transactions_response.py b/ynab/models/transactions_response.py deleted file mode 100644 index cfaa41a..0000000 --- a/ynab/models/transactions_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.transactions_wrapper import TransactionsWrapper # noqa: F401,E501 - - -class TransactionsResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'TransactionsWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """TransactionsResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this TransactionsResponse. # noqa: E501 - - - :return: The data of this TransactionsResponse. # noqa: E501 - :rtype: TransactionsWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this TransactionsResponse. - - - :param data: The data of this TransactionsResponse. # noqa: E501 - :type: TransactionsWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TransactionsResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/transactions_wrapper.py b/ynab/models/transactions_wrapper.py deleted file mode 100644 index 3cbb13b..0000000 --- a/ynab/models/transactions_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.transaction_detail import TransactionDetail # noqa: F401,E501 - - -class TransactionsWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'transactions': 'list[TransactionDetail]' - } - - attribute_map = { - 'transactions': 'transactions' - } - - def __init__(self, transactions=None): # noqa: E501 - """TransactionsWrapper - a model defined in Swagger""" # noqa: E501 - - self._transactions = None - self.discriminator = None - - self.transactions = transactions - - @property - def transactions(self): - """Gets the transactions of this TransactionsWrapper. # noqa: E501 - - - :return: The transactions of this TransactionsWrapper. # noqa: E501 - :rtype: list[TransactionDetail] - """ - return self._transactions - - @transactions.setter - def transactions(self, transactions): - """Sets the transactions of this TransactionsWrapper. - - - :param transactions: The transactions of this TransactionsWrapper. # noqa: E501 - :type: list[TransactionDetail] - """ - if transactions is None: - raise ValueError("Invalid value for `transactions`, must not be `None`") # noqa: E501 - - self._transactions = transactions - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TransactionsWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/user.py b/ynab/models/user.py deleted file mode 100644 index 1c6382d..0000000 --- a/ynab/models/user.py +++ /dev/null @@ -1,113 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class User(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str' - } - - attribute_map = { - 'id': 'id' - } - - def __init__(self, id=None): # noqa: E501 - """User - a model defined in Swagger""" # noqa: E501 - - self._id = None - self.discriminator = None - - self.id = id - - @property - def id(self): - """Gets the id of this User. # noqa: E501 - - - :return: The id of this User. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this User. - - - :param id: The id of this User. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, User): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/user_response.py b/ynab/models/user_response.py deleted file mode 100644 index ee4fd80..0000000 --- a/ynab/models/user_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.user_wrapper import UserWrapper # noqa: F401,E501 - - -class UserResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'data': 'UserWrapper' - } - - attribute_map = { - 'data': 'data' - } - - def __init__(self, data=None): # noqa: E501 - """UserResponse - a model defined in Swagger""" # noqa: E501 - - self._data = None - self.discriminator = None - - self.data = data - - @property - def data(self): - """Gets the data of this UserResponse. # noqa: E501 - - - :return: The data of this UserResponse. # noqa: E501 - :rtype: UserWrapper - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this UserResponse. - - - :param data: The data of this UserResponse. # noqa: E501 - :type: UserWrapper - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, UserResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/models/user_wrapper.py b/ynab/models/user_wrapper.py deleted file mode 100644 index cc6a3ba..0000000 --- a/ynab/models/user_wrapper.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from ynab.models.user import User # noqa: F401,E501 - - -class UserWrapper(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'user': 'User' - } - - attribute_map = { - 'user': 'user' - } - - def __init__(self, user=None): # noqa: E501 - """UserWrapper - a model defined in Swagger""" # noqa: E501 - - self._user = None - self.discriminator = None - - self.user = user - - @property - def user(self): - """Gets the user of this UserWrapper. # noqa: E501 - - - :return: The user of this UserWrapper. # noqa: E501 - :rtype: User - """ - return self._user - - @user.setter - def user(self, user): - """Sets the user of this UserWrapper. - - - :param user: The user of this UserWrapper. # noqa: E501 - :type: User - """ - if user is None: - raise ValueError("Invalid value for `user`, must not be `None`") # noqa: E501 - - self._user = user - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, UserWrapper): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/ynab/rest.py b/ynab/rest.py deleted file mode 100644 index 0a38fe6..0000000 --- a/ynab/rest.py +++ /dev/null @@ -1,323 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import io -import json -import logging -import re -import ssl - -import certifi -# python 2 and python 3 compatibility library -import six -from six.moves.urllib.parse import urlencode - -try: - import urllib3 -except ImportError: - raise ImportError('Swagger python client requires urllib3.') - - -logger = logging.getLogger(__name__) - - -class RESTResponse(io.IOBase): - - def __init__(self, resp): - self.urllib3_response = resp - self.status = resp.status - self.reason = resp.reason - self.data = resp.data - - def getheaders(self): - """Returns a dictionary of the response headers.""" - return self.urllib3_response.getheaders() - - def getheader(self, name, default=None): - """Returns a given response header.""" - return self.urllib3_response.getheader(name, default) - - -class RESTClientObject(object): - - def __init__(self, configuration, pools_size=4, maxsize=None): - # urllib3.PoolManager will pass all kw parameters to connectionpool - # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 - # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 - # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 - # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 - - # cert_reqs - if configuration.verify_ssl: - cert_reqs = ssl.CERT_REQUIRED - else: - cert_reqs = ssl.CERT_NONE - - # ca_certs - if configuration.ssl_ca_cert: - ca_certs = configuration.ssl_ca_cert - else: - # if not set certificate file, use Mozilla's root certificates. - ca_certs = certifi.where() - - addition_pool_args = {} - if configuration.assert_hostname is not None: - addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 - - if maxsize is None: - if configuration.connection_pool_maxsize is not None: - maxsize = configuration.connection_pool_maxsize - else: - maxsize = 4 - - # https pool manager - if configuration.proxy: - self.pool_manager = urllib3.ProxyManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=ca_certs, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - **addition_pool_args - ) - else: - self.pool_manager = urllib3.PoolManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=ca_certs, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - **addition_pool_args - ) - - def request(self, method, url, query_params=None, headers=None, - body=None, post_params=None, _preload_content=True, - _request_timeout=None): - """Perform requests. - - :param method: http request method - :param url: http request url - :param query_params: query parameters in the url - :param headers: http request headers - :param body: request json body, for `application/json` - :param post_params: request post parameters, - `application/x-www-form-urlencoded` - and `multipart/form-data` - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - """ - method = method.upper() - assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', - 'PATCH', 'OPTIONS'] - - if post_params and body: - raise ValueError( - "body parameter cannot be used with post_params parameter." - ) - - post_params = post_params or {} - headers = headers or {} - - timeout = None - if _request_timeout: - if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 - timeout = urllib3.Timeout(total=_request_timeout) - elif (isinstance(_request_timeout, tuple) and - len(_request_timeout) == 2): - timeout = urllib3.Timeout( - connect=_request_timeout[0], read=_request_timeout[1]) - - if 'Content-Type' not in headers: - headers['Content-Type'] = 'application/json' - - try: - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: - if query_params: - url += '?' + urlencode(query_params) - if re.search('json', headers['Content-Type'], re.IGNORECASE): - request_body = None - if body is not None: - request_body = json.dumps(body) - r = self.pool_manager.request( - method, url, - body=request_body, - preload_content=_preload_content, - timeout=timeout, - headers=headers) - elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 - r = self.pool_manager.request( - method, url, - fields=post_params, - encode_multipart=False, - preload_content=_preload_content, - timeout=timeout, - headers=headers) - elif headers['Content-Type'] == 'multipart/form-data': - # must del headers['Content-Type'], or the correct - # Content-Type which generated by urllib3 will be - # overwritten. - del headers['Content-Type'] - r = self.pool_manager.request( - method, url, - fields=post_params, - encode_multipart=True, - preload_content=_preload_content, - timeout=timeout, - headers=headers) - # Pass a `string` parameter directly in the body to support - # other content types than Json when `body` argument is - # provided in serialized form - elif isinstance(body, str): - request_body = body - r = self.pool_manager.request( - method, url, - body=request_body, - preload_content=_preload_content, - timeout=timeout, - headers=headers) - else: - # Cannot generate the request from given parameters - msg = """Cannot prepare a request message for provided - arguments. Please check that your arguments match - declared content type.""" - raise ApiException(status=0, reason=msg) - # For `GET`, `HEAD` - else: - r = self.pool_manager.request(method, url, - fields=query_params, - preload_content=_preload_content, - timeout=timeout, - headers=headers) - except urllib3.exceptions.SSLError as e: - msg = "{0}\n{1}".format(type(e).__name__, str(e)) - raise ApiException(status=0, reason=msg) - - if _preload_content: - r = RESTResponse(r) - - # In the python 3, the response.data is bytes. - # we need to decode it to string. - if six.PY3: - r.data = r.data.decode('utf8') - - # log response body - logger.debug("response body: %s", r.data) - - if not 200 <= r.status <= 299: - raise ApiException(http_resp=r) - - return r - - def GET(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None): - return self.request("GET", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def HEAD(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None): - return self.request("HEAD", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def OPTIONS(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("OPTIONS", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def DELETE(self, url, headers=None, query_params=None, body=None, - _preload_content=True, _request_timeout=None): - return self.request("DELETE", url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def POST(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("POST", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def PUT(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("PUT", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def PATCH(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("PATCH", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - -class ApiException(Exception): - - def __init__(self, status=None, reason=None, http_resp=None): - if http_resp: - self.status = http_resp.status - self.reason = http_resp.reason - self.body = http_resp.data - self.headers = http_resp.getheaders() - else: - self.status = status - self.reason = reason - self.body = None - self.headers = None - - def __str__(self): - """Custom error messages for exception""" - error_message = "({0})\n"\ - "Reason: {1}\n".format(self.status, self.reason) - if self.headers: - error_message += "HTTP response headers: {0}\n".format( - self.headers) - - if self.body: - error_message += "HTTP response body: {0}\n".format(self.body) - - return error_message diff --git a/ynab/ynab/__init__.py b/ynab/ynab/__init__.py deleted file mode 100644 index da52f1b..0000000 --- a/ynab/ynab/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -from __future__ import absolute_import - -# flake8: noqa - -# import apis into api package -from ynab.ynab.accounts_api import AccountsApi -from ynab.ynab.budgets_api import BudgetsApi -from ynab.ynab.categories_api import CategoriesApi -from ynab.ynab.months_api import MonthsApi -from ynab.ynab.payee_locations_api import PayeeLocationsApi -from ynab.ynab.payees_api import PayeesApi -from ynab.ynab.scheduled_transactions_api import ScheduledTransactionsApi -from ynab.ynab.transactions_api import TransactionsApi -from ynab.ynab.user_api import UserApi diff --git a/ynab/ynab/accounts_api.py b/ynab/ynab/accounts_api.py deleted file mode 100644 index 0f9f237..0000000 --- a/ynab/ynab/accounts_api.py +++ /dev/null @@ -1,232 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from ynab.api_client import ApiClient - - -class AccountsApi(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def get_account_by_id(self, budget_id, account_id, **kwargs): # noqa: E501 - """Single account # noqa: E501 - - Returns a single account # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_account_by_id(budget_id, account_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str account_id: The ID of the Account. (required) - :return: AccountResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_account_by_id_with_http_info(budget_id, account_id, **kwargs) # noqa: E501 - else: - (data) = self.get_account_by_id_with_http_info(budget_id, account_id, **kwargs) # noqa: E501 - return data - - def get_account_by_id_with_http_info(self, budget_id, account_id, **kwargs): # noqa: E501 - """Single account # noqa: E501 - - Returns a single account # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_account_by_id_with_http_info(budget_id, account_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str account_id: The ID of the Account. (required) - :return: AccountResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'account_id'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_account_by_id" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_account_by_id`") # noqa: E501 - # verify the required parameter 'account_id' is set - if ('account_id' not in params or - params['account_id'] is None): - raise ValueError("Missing the required parameter `account_id` when calling `get_account_by_id`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - if 'account_id' in params: - path_params['account_id'] = params['account_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/accounts/{account_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AccountResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_accounts(self, budget_id, **kwargs): # noqa: E501 - """Account list # noqa: E501 - - Returns all accounts # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_accounts(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :return: AccountsResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_accounts_with_http_info(budget_id, **kwargs) # noqa: E501 - else: - (data) = self.get_accounts_with_http_info(budget_id, **kwargs) # noqa: E501 - return data - - def get_accounts_with_http_info(self, budget_id, **kwargs): # noqa: E501 - """Account list # noqa: E501 - - Returns all accounts # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_accounts_with_http_info(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :return: AccountsResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_accounts" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_accounts`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/accounts', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AccountsResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) diff --git a/ynab/ynab/budgets_api.py b/ynab/ynab/budgets_api.py deleted file mode 100644 index f34d7aa..0000000 --- a/ynab/ynab/budgets_api.py +++ /dev/null @@ -1,220 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from ynab.api_client import ApiClient - - -class BudgetsApi(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def get_budget_by_id(self, budget_id, **kwargs): # noqa: E501 - """Single budget # noqa: E501 - - Returns a single budget with all related entities. This resource is effectively a full budget export. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_budget_by_id(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param float last_knowledge_of_server: The starting server knowledge. If provided, only entities that have changed since last_knowledge_of_server will be included. - :return: BudgetDetailResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_budget_by_id_with_http_info(budget_id, **kwargs) # noqa: E501 - else: - (data) = self.get_budget_by_id_with_http_info(budget_id, **kwargs) # noqa: E501 - return data - - def get_budget_by_id_with_http_info(self, budget_id, **kwargs): # noqa: E501 - """Single budget # noqa: E501 - - Returns a single budget with all related entities. This resource is effectively a full budget export. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_budget_by_id_with_http_info(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param float last_knowledge_of_server: The starting server knowledge. If provided, only entities that have changed since last_knowledge_of_server will be included. - :return: BudgetDetailResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'last_knowledge_of_server'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_budget_by_id" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_budget_by_id`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - - query_params = [] - if 'last_knowledge_of_server' in params: - query_params.append(('last_knowledge_of_server', params['last_knowledge_of_server'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='BudgetDetailResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_budgets(self, **kwargs): # noqa: E501 - """List budgets # noqa: E501 - - Returns budgets list with summary information. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_budgets(use_async=True) - >>> result = thread.get() - - :param async bool - :return: BudgetSummaryResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_budgets_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.get_budgets_with_http_info(**kwargs) # noqa: E501 - return data - - def get_budgets_with_http_info(self, **kwargs): # noqa: E501 - """List budgets # noqa: E501 - - Returns budgets list with summary information. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_budgets_with_http_info(use_async=True) - >>> result = thread.get() - - :param async bool - :return: BudgetSummaryResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = [] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_budgets" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='BudgetSummaryResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) diff --git a/ynab/ynab/categories_api.py b/ynab/ynab/categories_api.py deleted file mode 100644 index 6434f65..0000000 --- a/ynab/ynab/categories_api.py +++ /dev/null @@ -1,232 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from ynab.api_client import ApiClient - - -class CategoriesApi(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def get_categories(self, budget_id, **kwargs): # noqa: E501 - """List categories # noqa: E501 - - Returns all categories grouped by category group. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_categories(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :return: CategoriesResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_categories_with_http_info(budget_id, **kwargs) # noqa: E501 - else: - (data) = self.get_categories_with_http_info(budget_id, **kwargs) # noqa: E501 - return data - - def get_categories_with_http_info(self, budget_id, **kwargs): # noqa: E501 - """List categories # noqa: E501 - - Returns all categories grouped by category group. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_categories_with_http_info(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :return: CategoriesResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_categories" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_categories`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/categories', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='CategoriesResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_category_by_id(self, budget_id, category_id, **kwargs): # noqa: E501 - """Single category # noqa: E501 - - Returns a single category # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_category_by_id(budget_id, category_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str category_id: The ID of the Category. (required) - :return: CategoryResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_category_by_id_with_http_info(budget_id, category_id, **kwargs) # noqa: E501 - else: - (data) = self.get_category_by_id_with_http_info(budget_id, category_id, **kwargs) # noqa: E501 - return data - - def get_category_by_id_with_http_info(self, budget_id, category_id, **kwargs): # noqa: E501 - """Single category # noqa: E501 - - Returns a single category # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_category_by_id_with_http_info(budget_id, category_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str category_id: The ID of the Category. (required) - :return: CategoryResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'category_id'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_category_by_id" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_category_by_id`") # noqa: E501 - # verify the required parameter 'category_id' is set - if ('category_id' not in params or - params['category_id'] is None): - raise ValueError("Missing the required parameter `category_id` when calling `get_category_by_id`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - if 'category_id' in params: - path_params['category_id'] = params['category_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/categories/{category_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='CategoryResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) diff --git a/ynab/ynab/months_api.py b/ynab/ynab/months_api.py deleted file mode 100644 index 3fb64c1..0000000 --- a/ynab/ynab/months_api.py +++ /dev/null @@ -1,232 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from ynab.api_client import ApiClient - - -class MonthsApi(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def get_budget_month(self, budget_id, month, **kwargs): # noqa: E501 - """Single budget month # noqa: E501 - - Returns a single budget month # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_budget_month(budget_id, month, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param date month: The Budget Month. \"current\" can also be used to specify the current calendar month (UTC). (required) - :return: MonthDetailResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_budget_month_with_http_info(budget_id, month, **kwargs) # noqa: E501 - else: - (data) = self.get_budget_month_with_http_info(budget_id, month, **kwargs) # noqa: E501 - return data - - def get_budget_month_with_http_info(self, budget_id, month, **kwargs): # noqa: E501 - """Single budget month # noqa: E501 - - Returns a single budget month # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_budget_month_with_http_info(budget_id, month, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param date month: The Budget Month. \"current\" can also be used to specify the current calendar month (UTC). (required) - :return: MonthDetailResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'month'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_budget_month" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_budget_month`") # noqa: E501 - # verify the required parameter 'month' is set - if ('month' not in params or - params['month'] is None): - raise ValueError("Missing the required parameter `month` when calling `get_budget_month`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - if 'month' in params: - path_params['month'] = params['month'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/months/{month}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='MonthDetailResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_budget_months(self, budget_id, **kwargs): # noqa: E501 - """List budget months # noqa: E501 - - Returns all budget months # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_budget_months(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :return: MonthSummariesResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_budget_months_with_http_info(budget_id, **kwargs) # noqa: E501 - else: - (data) = self.get_budget_months_with_http_info(budget_id, **kwargs) # noqa: E501 - return data - - def get_budget_months_with_http_info(self, budget_id, **kwargs): # noqa: E501 - """List budget months # noqa: E501 - - Returns all budget months # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_budget_months_with_http_info(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :return: MonthSummariesResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_budget_months" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_budget_months`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/months', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='MonthSummariesResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) diff --git a/ynab/ynab/payee_locations_api.py b/ynab/ynab/payee_locations_api.py deleted file mode 100644 index baefaf4..0000000 --- a/ynab/ynab/payee_locations_api.py +++ /dev/null @@ -1,335 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from ynab.api_client import ApiClient - - -class PayeeLocationsApi(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def get_payee_location_by_id(self, budget_id, payee_location_id, **kwargs): # noqa: E501 - """Single payee location # noqa: E501 - - Returns a single payee location # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_payee_location_by_id(budget_id, payee_location_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str payee_location_id: ID of payee location (required) - :return: PayeeLocationResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_payee_location_by_id_with_http_info(budget_id, payee_location_id, **kwargs) # noqa: E501 - else: - (data) = self.get_payee_location_by_id_with_http_info(budget_id, payee_location_id, **kwargs) # noqa: E501 - return data - - def get_payee_location_by_id_with_http_info(self, budget_id, payee_location_id, **kwargs): # noqa: E501 - """Single payee location # noqa: E501 - - Returns a single payee location # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_payee_location_by_id_with_http_info(budget_id, payee_location_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str payee_location_id: ID of payee location (required) - :return: PayeeLocationResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'payee_location_id'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_payee_location_by_id" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_payee_location_by_id`") # noqa: E501 - # verify the required parameter 'payee_location_id' is set - if ('payee_location_id' not in params or - params['payee_location_id'] is None): - raise ValueError("Missing the required parameter `payee_location_id` when calling `get_payee_location_by_id`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - if 'payee_location_id' in params: - path_params['payee_location_id'] = params['payee_location_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/payee_locations/{payee_location_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='PayeeLocationResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_payee_locations(self, budget_id, **kwargs): # noqa: E501 - """List payee locations # noqa: E501 - - Returns all payee locations # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_payee_locations(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :return: PayeeLocationsResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_payee_locations_with_http_info(budget_id, **kwargs) # noqa: E501 - else: - (data) = self.get_payee_locations_with_http_info(budget_id, **kwargs) # noqa: E501 - return data - - def get_payee_locations_with_http_info(self, budget_id, **kwargs): # noqa: E501 - """List payee locations # noqa: E501 - - Returns all payee locations # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_payee_locations_with_http_info(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :return: PayeeLocationsResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_payee_locations" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_payee_locations`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/payee_locations', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='PayeeLocationsResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_payee_locations_by_payee(self, budget_id, payee_id, **kwargs): # noqa: E501 - """List locations for a payee # noqa: E501 - - Returns all payee locations for the specified payee # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_payee_locations_by_payee(budget_id, payee_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str payee_id: ID of payee (required) - :return: PayeeLocationsResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_payee_locations_by_payee_with_http_info(budget_id, payee_id, **kwargs) # noqa: E501 - else: - (data) = self.get_payee_locations_by_payee_with_http_info(budget_id, payee_id, **kwargs) # noqa: E501 - return data - - def get_payee_locations_by_payee_with_http_info(self, budget_id, payee_id, **kwargs): # noqa: E501 - """List locations for a payee # noqa: E501 - - Returns all payee locations for the specified payee # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_payee_locations_by_payee_with_http_info(budget_id, payee_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str payee_id: ID of payee (required) - :return: PayeeLocationsResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'payee_id'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_payee_locations_by_payee" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_payee_locations_by_payee`") # noqa: E501 - # verify the required parameter 'payee_id' is set - if ('payee_id' not in params or - params['payee_id'] is None): - raise ValueError("Missing the required parameter `payee_id` when calling `get_payee_locations_by_payee`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - if 'payee_id' in params: - path_params['payee_id'] = params['payee_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/payees/{payee_id}/payee_locations', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='PayeeLocationsResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) diff --git a/ynab/ynab/payees_api.py b/ynab/ynab/payees_api.py deleted file mode 100644 index d4caae8..0000000 --- a/ynab/ynab/payees_api.py +++ /dev/null @@ -1,232 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from ynab.api_client import ApiClient - - -class PayeesApi(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def get_payee_by_id(self, budget_id, payee_id, **kwargs): # noqa: E501 - """Single payee # noqa: E501 - - Returns single payee # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_payee_by_id(budget_id, payee_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str payee_id: The ID of the Payee. (required) - :return: PayeeResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_payee_by_id_with_http_info(budget_id, payee_id, **kwargs) # noqa: E501 - else: - (data) = self.get_payee_by_id_with_http_info(budget_id, payee_id, **kwargs) # noqa: E501 - return data - - def get_payee_by_id_with_http_info(self, budget_id, payee_id, **kwargs): # noqa: E501 - """Single payee # noqa: E501 - - Returns single payee # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_payee_by_id_with_http_info(budget_id, payee_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str payee_id: The ID of the Payee. (required) - :return: PayeeResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'payee_id'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_payee_by_id" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_payee_by_id`") # noqa: E501 - # verify the required parameter 'payee_id' is set - if ('payee_id' not in params or - params['payee_id'] is None): - raise ValueError("Missing the required parameter `payee_id` when calling `get_payee_by_id`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - if 'payee_id' in params: - path_params['payee_id'] = params['payee_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/payees/{payee_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='PayeeResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_payees(self, budget_id, **kwargs): # noqa: E501 - """List payees # noqa: E501 - - Returns all payees # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_payees(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :return: PayeesResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_payees_with_http_info(budget_id, **kwargs) # noqa: E501 - else: - (data) = self.get_payees_with_http_info(budget_id, **kwargs) # noqa: E501 - return data - - def get_payees_with_http_info(self, budget_id, **kwargs): # noqa: E501 - """List payees # noqa: E501 - - Returns all payees # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_payees_with_http_info(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :return: PayeesResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_payees" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_payees`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/payees', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='PayeesResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) diff --git a/ynab/ynab/scheduled_transactions_api.py b/ynab/ynab/scheduled_transactions_api.py deleted file mode 100644 index 5688332..0000000 --- a/ynab/ynab/scheduled_transactions_api.py +++ /dev/null @@ -1,232 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from ynab.api_client import ApiClient - - -class ScheduledTransactionsApi(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def get_scheduled_transaction_by_id(self, budget_id, scheduled_transaction_id, **kwargs): # noqa: E501 - """Single scheduled transaction # noqa: E501 - - Returns a single scheduled transaction # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_scheduled_transaction_by_id(budget_id, scheduled_transaction_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str scheduled_transaction_id: The ID of the Scheduled Transaction. (required) - :return: ScheduledTransactionResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_scheduled_transaction_by_id_with_http_info(budget_id, scheduled_transaction_id, **kwargs) # noqa: E501 - else: - (data) = self.get_scheduled_transaction_by_id_with_http_info(budget_id, scheduled_transaction_id, **kwargs) # noqa: E501 - return data - - def get_scheduled_transaction_by_id_with_http_info(self, budget_id, scheduled_transaction_id, **kwargs): # noqa: E501 - """Single scheduled transaction # noqa: E501 - - Returns a single scheduled transaction # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_scheduled_transaction_by_id_with_http_info(budget_id, scheduled_transaction_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str scheduled_transaction_id: The ID of the Scheduled Transaction. (required) - :return: ScheduledTransactionResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'scheduled_transaction_id'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_scheduled_transaction_by_id" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_scheduled_transaction_by_id`") # noqa: E501 - # verify the required parameter 'scheduled_transaction_id' is set - if ('scheduled_transaction_id' not in params or - params['scheduled_transaction_id'] is None): - raise ValueError("Missing the required parameter `scheduled_transaction_id` when calling `get_scheduled_transaction_by_id`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - if 'scheduled_transaction_id' in params: - path_params['scheduled_transaction_id'] = params['scheduled_transaction_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ScheduledTransactionResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_scheduled_transactions(self, budget_id, **kwargs): # noqa: E501 - """List scheduled transactions # noqa: E501 - - Returns all scheduled transactions # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_scheduled_transactions(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :return: ScheduledTransactionsResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_scheduled_transactions_with_http_info(budget_id, **kwargs) # noqa: E501 - else: - (data) = self.get_scheduled_transactions_with_http_info(budget_id, **kwargs) # noqa: E501 - return data - - def get_scheduled_transactions_with_http_info(self, budget_id, **kwargs): # noqa: E501 - """List scheduled transactions # noqa: E501 - - Returns all scheduled transactions # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_scheduled_transactions_with_http_info(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :return: ScheduledTransactionsResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_scheduled_transactions" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_scheduled_transactions`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/scheduled_transactions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ScheduledTransactionsResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) diff --git a/ynab/ynab/transactions_api.py b/ynab/ynab/transactions_api.py deleted file mode 100644 index d7ea89a..0000000 --- a/ynab/ynab/transactions_api.py +++ /dev/null @@ -1,983 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from ynab.api_client import ApiClient - - -class TransactionsApi(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def bulk_create_transactions(self, budget_id, transactions, **kwargs): # noqa: E501 - """Bulk create transactions # noqa: E501 - - Creates multiple transactions # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.bulk_create_transactions(budget_id, transactions, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param BulkTransactions transactions: The list of Transactions to create. (required) - :return: BulkResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.bulk_create_transactions_with_http_info(budget_id, transactions, **kwargs) # noqa: E501 - else: - (data) = self.bulk_create_transactions_with_http_info(budget_id, transactions, **kwargs) # noqa: E501 - return data - - def bulk_create_transactions_with_http_info(self, budget_id, transactions, **kwargs): # noqa: E501 - """Bulk create transactions # noqa: E501 - - Creates multiple transactions # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.bulk_create_transactions_with_http_info(budget_id, transactions, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param BulkTransactions transactions: The list of Transactions to create. (required) - :return: BulkResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'transactions'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method bulk_create_transactions" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `bulk_create_transactions`") # noqa: E501 - # verify the required parameter 'transactions' is set - if ('transactions' not in params or - params['transactions'] is None): - raise ValueError("Missing the required parameter `transactions` when calling `bulk_create_transactions`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'transactions' in params: - body_params = params['transactions'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/transactions/bulk', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='BulkResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def create_transaction(self, budget_id, transaction, **kwargs): # noqa: E501 - """Create new transaction # noqa: E501 - - Creates a transaction # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.create_transaction(budget_id, transaction, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param SaveTransactionWrapper transaction: The Transaction to create. (required) - :return: TransactionResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.create_transaction_with_http_info(budget_id, transaction, **kwargs) # noqa: E501 - else: - (data) = self.create_transaction_with_http_info(budget_id, transaction, **kwargs) # noqa: E501 - return data - - def create_transaction_with_http_info(self, budget_id, transaction, **kwargs): # noqa: E501 - """Create new transaction # noqa: E501 - - Creates a transaction # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.create_transaction_with_http_info(budget_id, transaction, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param SaveTransactionWrapper transaction: The Transaction to create. (required) - :return: TransactionResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'transaction'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_transaction" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `create_transaction`") # noqa: E501 - # verify the required parameter 'transaction' is set - if ('transaction' not in params or - params['transaction'] is None): - raise ValueError("Missing the required parameter `transaction` when calling `create_transaction`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'transaction' in params: - body_params = params['transaction'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/transactions', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='TransactionResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_transactions(self, budget_id, **kwargs): # noqa: E501 - """List transactions # noqa: E501 - - Returns budget transactions # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_transactions(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param date since_date: Only return transactions on or after this date. - :param str type: Only return transactions of a certain type (i.e. 'uncategorized', 'unapproved') - :return: TransactionsResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_transactions_with_http_info(budget_id, **kwargs) # noqa: E501 - else: - (data) = self.get_transactions_with_http_info(budget_id, **kwargs) # noqa: E501 - return data - - def get_transactions_with_http_info(self, budget_id, **kwargs): # noqa: E501 - """List transactions # noqa: E501 - - Returns budget transactions # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_transactions_with_http_info(budget_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param date since_date: Only return transactions on or after this date. - :param str type: Only return transactions of a certain type (i.e. 'uncategorized', 'unapproved') - :return: TransactionsResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'since_date', 'type'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_transactions" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_transactions`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - - query_params = [] - if 'since_date' in params: - query_params.append(('since_date', params['since_date'])) # noqa: E501 - if 'type' in params: - query_params.append(('type', params['type'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/transactions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='TransactionsResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_transactions_by_account(self, budget_id, account_id, **kwargs): # noqa: E501 - """List account transactions # noqa: E501 - - Returns all transactions for a specified account # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_transactions_by_account(budget_id, account_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str account_id: The ID of the Account. (required) - :param date since_date: Only return transactions on or after this date. - :return: TransactionsResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_transactions_by_account_with_http_info(budget_id, account_id, **kwargs) # noqa: E501 - else: - (data) = self.get_transactions_by_account_with_http_info(budget_id, account_id, **kwargs) # noqa: E501 - return data - - def get_transactions_by_account_with_http_info(self, budget_id, account_id, **kwargs): # noqa: E501 - """List account transactions # noqa: E501 - - Returns all transactions for a specified account # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_transactions_by_account_with_http_info(budget_id, account_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str account_id: The ID of the Account. (required) - :param date since_date: Only return transactions on or after this date. - :return: TransactionsResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'account_id', 'since_date'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_transactions_by_account" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_transactions_by_account`") # noqa: E501 - # verify the required parameter 'account_id' is set - if ('account_id' not in params or - params['account_id'] is None): - raise ValueError("Missing the required parameter `account_id` when calling `get_transactions_by_account`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - if 'account_id' in params: - path_params['account_id'] = params['account_id'] # noqa: E501 - - query_params = [] - if 'since_date' in params: - query_params.append(('since_date', params['since_date'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/accounts/{account_id}/transactions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='TransactionsResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_transactions_by_category(self, budget_id, category_id, **kwargs): # noqa: E501 - """List category transactions # noqa: E501 - - Returns all transactions for a specified category # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_transactions_by_category(budget_id, category_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str category_id: The ID of the Category. (required) - :param date since_date: Only return transactions on or after this date. - :return: HybridTransactionsResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_transactions_by_category_with_http_info(budget_id, category_id, **kwargs) # noqa: E501 - else: - (data) = self.get_transactions_by_category_with_http_info(budget_id, category_id, **kwargs) # noqa: E501 - return data - - def get_transactions_by_category_with_http_info(self, budget_id, category_id, **kwargs): # noqa: E501 - """List category transactions # noqa: E501 - - Returns all transactions for a specified category # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_transactions_by_category_with_http_info(budget_id, category_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str category_id: The ID of the Category. (required) - :param date since_date: Only return transactions on or after this date. - :return: HybridTransactionsResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'category_id', 'since_date'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_transactions_by_category" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_transactions_by_category`") # noqa: E501 - # verify the required parameter 'category_id' is set - if ('category_id' not in params or - params['category_id'] is None): - raise ValueError("Missing the required parameter `category_id` when calling `get_transactions_by_category`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - if 'category_id' in params: - path_params['category_id'] = params['category_id'] # noqa: E501 - - query_params = [] - if 'since_date' in params: - query_params.append(('since_date', params['since_date'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/categories/{category_id}/transactions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='HybridTransactionsResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_transactions_by_id(self, budget_id, transaction_id, **kwargs): # noqa: E501 - """Single transaction # noqa: E501 - - Returns a single transaction # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_transactions_by_id(budget_id, transaction_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str transaction_id: The ID of the Transaction. (required) - :return: TransactionResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_transactions_by_id_with_http_info(budget_id, transaction_id, **kwargs) # noqa: E501 - else: - (data) = self.get_transactions_by_id_with_http_info(budget_id, transaction_id, **kwargs) # noqa: E501 - return data - - def get_transactions_by_id_with_http_info(self, budget_id, transaction_id, **kwargs): # noqa: E501 - """Single transaction # noqa: E501 - - Returns a single transaction # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_transactions_by_id_with_http_info(budget_id, transaction_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str transaction_id: The ID of the Transaction. (required) - :return: TransactionResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'transaction_id'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_transactions_by_id" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_transactions_by_id`") # noqa: E501 - # verify the required parameter 'transaction_id' is set - if ('transaction_id' not in params or - params['transaction_id'] is None): - raise ValueError("Missing the required parameter `transaction_id` when calling `get_transactions_by_id`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - if 'transaction_id' in params: - path_params['transaction_id'] = params['transaction_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/transactions/{transaction_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='TransactionResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_transactions_by_payee(self, budget_id, payee_id, **kwargs): # noqa: E501 - """List payee transactions # noqa: E501 - - Returns all transactions for a specified payee # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_transactions_by_payee(budget_id, payee_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str payee_id: The ID of the Payee. (required) - :param date since_date: Only return transactions on or after this date. - :return: HybridTransactionsResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_transactions_by_payee_with_http_info(budget_id, payee_id, **kwargs) # noqa: E501 - else: - (data) = self.get_transactions_by_payee_with_http_info(budget_id, payee_id, **kwargs) # noqa: E501 - return data - - def get_transactions_by_payee_with_http_info(self, budget_id, payee_id, **kwargs): # noqa: E501 - """List payee transactions # noqa: E501 - - Returns all transactions for a specified payee # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_transactions_by_payee_with_http_info(budget_id, payee_id, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str payee_id: The ID of the Payee. (required) - :param date since_date: Only return transactions on or after this date. - :return: HybridTransactionsResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'payee_id', 'since_date'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_transactions_by_payee" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `get_transactions_by_payee`") # noqa: E501 - # verify the required parameter 'payee_id' is set - if ('payee_id' not in params or - params['payee_id'] is None): - raise ValueError("Missing the required parameter `payee_id` when calling `get_transactions_by_payee`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - if 'payee_id' in params: - path_params['payee_id'] = params['payee_id'] # noqa: E501 - - query_params = [] - if 'since_date' in params: - query_params.append(('since_date', params['since_date'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/payees/{payee_id}/transactions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='HybridTransactionsResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update_transaction(self, budget_id, transaction_id, transaction, **kwargs): # noqa: E501 - """Updates an existing transaction # noqa: E501 - - Updates a transaction # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.update_transaction(budget_id, transaction_id, transaction, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str transaction_id: The ID of the Transaction. (required) - :param SaveTransactionWrapper transaction: The Transaction to update. (required) - :return: TransactionResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.update_transaction_with_http_info(budget_id, transaction_id, transaction, **kwargs) # noqa: E501 - else: - (data) = self.update_transaction_with_http_info(budget_id, transaction_id, transaction, **kwargs) # noqa: E501 - return data - - def update_transaction_with_http_info(self, budget_id, transaction_id, transaction, **kwargs): # noqa: E501 - """Updates an existing transaction # noqa: E501 - - Updates a transaction # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.update_transaction_with_http_info(budget_id, transaction_id, transaction, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str transaction_id: The ID of the Transaction. (required) - :param SaveTransactionWrapper transaction: The Transaction to update. (required) - :return: TransactionResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'transaction_id', 'transaction'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_transaction" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `update_transaction`") # noqa: E501 - # verify the required parameter 'transaction_id' is set - if ('transaction_id' not in params or - params['transaction_id'] is None): - raise ValueError("Missing the required parameter `transaction_id` when calling `update_transaction`") # noqa: E501 - # verify the required parameter 'transaction' is set - if ('transaction' not in params or - params['transaction'] is None): - raise ValueError("Missing the required parameter `transaction` when calling `update_transaction`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - if 'transaction_id' in params: - path_params['transaction_id'] = params['transaction_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'transaction' in params: - body_params = params['transaction'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/transactions/{transaction_id}', 'PUT', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='TransactionResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update_transactions(self, budget_id, transactions, **kwargs): # noqa: E501 - """Updates an existing transaction # noqa: E501 - - Updates a transaction # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.update_transaction(budget_id, transaction_id, transaction, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str transaction_id: The ID of the Transaction. (required) - :param SaveTransactionWrapper transaction: The Transaction to update. (required) - :return: TransactionResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.update_transactions_with_http_info(budget_id, transactions, **kwargs) # noqa: E501 - else: - (data) = self.update_transactions_with_http_info(budget_id, transactions, **kwargs) # noqa: E501 - return data - - def update_transactions_with_http_info(self, budget_id, transactions, **kwargs): # noqa: E501 - """Updates an existing transaction # noqa: E501 - - Updates a transaction # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.update_transaction_with_http_info(budget_id, transaction_id, transaction, use_async=True) - >>> result = thread.get() - - :param async bool - :param str budget_id: The ID of the Budget. (required) - :param str transaction_id: The ID of the Transaction. (required) - :param SaveTransactionWrapper transaction: The Transaction to update. (required) - :return: TransactionResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['budget_id', 'transactions'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_transaction" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'budget_id' is set - if ('budget_id' not in params or - params['budget_id'] is None): - raise ValueError("Missing the required parameter `budget_id` when calling `update_transaction`") # noqa: E501 - # verify the required parameter 'transaction' is set - if ('transactions' not in params or - params['transactions'] is None): - raise ValueError("Missing the required parameter `transaction` when calling `update_transaction`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'budget_id' in params: - path_params['budget_id'] = params['budget_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'transactions' in params: - body_params = params['transactions'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/budgets/{budget_id}/transactions', 'PATCH', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='TransactionResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) diff --git a/ynab/ynab/user_api.py b/ynab/ynab/user_api.py deleted file mode 100644 index d68aaa5..0000000 --- a/ynab/ynab/user_api.py +++ /dev/null @@ -1,121 +0,0 @@ -# coding: utf-8 - -""" - 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 # noqa: E501 - - OpenAPI spec version: 1.0.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from ynab.api_client import ApiClient - - -class UserApi(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def get_user(self, **kwargs): # noqa: E501 - """User info # noqa: E501 - - Returns authenticated user information. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_user(use_async=True) - >>> result = thread.get() - - :param async bool - :return: UserResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_user_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.get_user_with_http_info(**kwargs) # noqa: E501 - return data - - def get_user_with_http_info(self, **kwargs): # noqa: E501 - """User info # noqa: E501 - - Returns authenticated user information. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass use_async=True - >>> thread = api.get_user_with_http_info(use_async=True) - >>> result = thread.get() - - :param async bool - :return: UserResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = [] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_user" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer'] # noqa: E501 - - return self.api_client.call_api( - '/user', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='UserResponse', # noqa: E501 - auth_settings=auth_settings, - use_async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats)