Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endpoints: add multi-currency-account. #29

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pywisetransfer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
25 changes: 25 additions & 0 deletions pywisetransfer/multi_currency_account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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))
Loading