From 68eb5bdc40ca996bf64726d133c009676a65cb7d Mon Sep 17 00:00:00 2001 From: James Addison Date: Fri, 29 Mar 2024 09:35:40 +0000 Subject: [PATCH 1/2] Endpoints: add multi-currency-account --- pywisetransfer/__init__.py | 2 ++ pywisetransfer/multi_currency_account.py | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 pywisetransfer/multi_currency_account.py diff --git a/pywisetransfer/__init__.py b/pywisetransfer/__init__.py index 8d83961..df00478 100644 --- a/pywisetransfer/__init__.py +++ b/pywisetransfer/__init__.py @@ -7,6 +7,7 @@ def add_resources(self) -> None: from pywisetransfer.balance_statements import BalanceStatements from pywisetransfer.balances import Balances from pywisetransfer.borderless_account import BorderlessAccount + from pywisetransfer.multi_currency_account import MultiCurrencyAccount from pywisetransfer.profile import Profile from pywisetransfer.subscription import Subscription from pywisetransfer.user import User @@ -15,6 +16,7 @@ def add_resources(self) -> None: self.balance_statements = BalanceStatements(client=self) self.balances = Balances(client=self) self.borderless_accounts = BorderlessAccount(client=self) + self.multi_currency_account = MultiCurrencyAccount(client=self) self.profiles = Profile(client=self) self.subscriptions = Subscription(client=self) self.users = User(client=self) diff --git a/pywisetransfer/multi_currency_account.py b/pywisetransfer/multi_currency_account.py new file mode 100644 index 0000000..57e25ad --- /dev/null +++ b/pywisetransfer/multi_currency_account.py @@ -0,0 +1,23 @@ +from typing import Any + +from apiron import JsonEndpoint +from munch import munchify + +from pywisetransfer import Client +from pywisetransfer.base import Base + + +class MultiCurrencyAccountService(Base): + available_currencies = JsonEndpoint(path="/v2/borderless-accounts-configuration/profiles/{profile_id}/available-currencies") + get = JsonEndpoint(path="/v4/profiles/{profile_id}/multi-currency-account") + + +class MultiCurrencyAccount: + def __init__(self, client: Client): + self.service = MultiCurrencyAccountService(client=client) + + def available_currencies(self, profile_id: str) -> Any: + return munchify(self.service.available_currencies(profile_id=profile_id)) + + def get(self, profile_id: str) -> Any: + return munchify(self.service.get(profile_id=profile_id)) From fc3181e62fd16859724ffdce069d9f3b55f54f56 Mon Sep 17 00:00:00 2001 From: James Addison Date: Fri, 29 Mar 2024 10:30:39 +0000 Subject: [PATCH 2/2] Linting: reformat codebase using 'black' --- pywisetransfer/multi_currency_account.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pywisetransfer/multi_currency_account.py b/pywisetransfer/multi_currency_account.py index 57e25ad..9d51e6c 100644 --- a/pywisetransfer/multi_currency_account.py +++ b/pywisetransfer/multi_currency_account.py @@ -8,7 +8,9 @@ class MultiCurrencyAccountService(Base): - available_currencies = JsonEndpoint(path="/v2/borderless-accounts-configuration/profiles/{profile_id}/available-currencies") + available_currencies = JsonEndpoint( + path="/v2/borderless-accounts-configuration/profiles/{profile_id}/available-currencies" + ) get = JsonEndpoint(path="/v4/profiles/{profile_id}/multi-currency-account")