From 21fa11350ef9f6e99a7ee38632d4322c89646124 Mon Sep 17 00:00:00 2001 From: Robert Segal Date: Fri, 3 Oct 2025 11:15:40 -0600 Subject: [PATCH] Added accounts erp links endpoints --- mpt_api_client/resources/accounts/accounts.py | 11 +++++ .../resources/accounts/erp_links.py | 41 +++++++++++++++++++ tests/resources/accounts/test_accounts.py | 3 ++ tests/resources/accounts/test_erp_links.py | 29 +++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 mpt_api_client/resources/accounts/erp_links.py create mode 100644 tests/resources/accounts/test_erp_links.py diff --git a/mpt_api_client/resources/accounts/accounts.py b/mpt_api_client/resources/accounts/accounts.py index be46715c..3f12aa3c 100644 --- a/mpt_api_client/resources/accounts/accounts.py +++ b/mpt_api_client/resources/accounts/accounts.py @@ -10,6 +10,7 @@ AsyncCloudTenantsService, CloudTenantsService, ) +from mpt_api_client.resources.accounts.erp_links import AsyncErpLinksService, ErpLinksService from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService from mpt_api_client.resources.accounts.modules import AsyncModulesService, ModulesService from mpt_api_client.resources.accounts.sellers import AsyncSellersService, SellersService @@ -76,6 +77,11 @@ def account_users(self) -> AccountUsersService: """Account Users service.""" return AccountUsersService(http_client=self.http_client) + @property + def erp_links(self) -> ErpLinksService: + """ERP Links service.""" + return ErpLinksService(http_client=self.http_client) + class AsyncAccounts: """Async Accounts MPT API Module.""" @@ -132,3 +138,8 @@ def buyers(self) -> AsyncBuyersService: def account_users(self) -> AsyncAccountUsersService: """Account Users service.""" return AsyncAccountUsersService(http_client=self.http_client) + + @property + def erp_links(self) -> AsyncErpLinksService: + """ERP Links service.""" + return AsyncErpLinksService(http_client=self.http_client) diff --git a/mpt_api_client/resources/accounts/erp_links.py b/mpt_api_client/resources/accounts/erp_links.py new file mode 100644 index 00000000..325e8fb7 --- /dev/null +++ b/mpt_api_client/resources/accounts/erp_links.py @@ -0,0 +1,41 @@ +from mpt_api_client.http import AsyncService, Service +from mpt_api_client.http.mixins import ( + AsyncCreateMixin, + AsyncUpdateMixin, + CreateMixin, + UpdateMixin, +) +from mpt_api_client.models import Model +from mpt_api_client.resources.accounts.mixins import AsyncBlockableMixin, BlockableMixin + + +class ErpLink(Model): + """ERP Link Model.""" + + +class ErpLinksServiceConfig: + """ERP Links Service Configuration.""" + + _endpoint = "/public/v1/accounts/erp-links" + _model_class = ErpLink + _collection_key = "data" + + +class ErpLinksService( + CreateMixin[ErpLink], + UpdateMixin[ErpLink], + BlockableMixin[ErpLink], + Service[ErpLink], + ErpLinksServiceConfig, +): + """ERP Links Service.""" + + +class AsyncErpLinksService( + AsyncCreateMixin[ErpLink], + AsyncUpdateMixin[ErpLink], + AsyncBlockableMixin[ErpLink], + AsyncService[ErpLink], + ErpLinksServiceConfig, +): + """Async ERP Links Service.""" diff --git a/tests/resources/accounts/test_accounts.py b/tests/resources/accounts/test_accounts.py index 4f30bf85..d935bab5 100644 --- a/tests/resources/accounts/test_accounts.py +++ b/tests/resources/accounts/test_accounts.py @@ -15,6 +15,7 @@ AsyncCloudTenantsService, CloudTenantsService, ) +from mpt_api_client.resources.accounts.erp_links import AsyncErpLinksService, ErpLinksService from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService from mpt_api_client.resources.accounts.modules import AsyncModulesService, ModulesService from mpt_api_client.resources.accounts.sellers import AsyncSellersService, SellersService @@ -48,6 +49,7 @@ def async_accounts(async_http_client): ("cloud_tenants", CloudTenantsService), ("buyers", BuyersService), ("account_users", AccountUsersService), + ("erp_links", ErpLinksService), ], ) def test_accounts_properties(accounts, property_name, expected_service_class): @@ -71,6 +73,7 @@ def test_accounts_properties(accounts, property_name, expected_service_class): ("cloud_tenants", AsyncCloudTenantsService), ("buyers", AsyncBuyersService), ("account_users", AsyncAccountUsersService), + ("erp_links", AsyncErpLinksService), ], ) def test_async_accounts_properties(async_accounts, property_name, expected_service_class): diff --git a/tests/resources/accounts/test_erp_links.py b/tests/resources/accounts/test_erp_links.py new file mode 100644 index 00000000..658f9557 --- /dev/null +++ b/tests/resources/accounts/test_erp_links.py @@ -0,0 +1,29 @@ +import pytest + +from mpt_api_client.resources.accounts.erp_links import AsyncErpLinksService, ErpLinksService + + +@pytest.fixture +def erp_links_service(http_client): + return ErpLinksService(http_client=http_client) + + +@pytest.fixture +def async_erp_links_service(async_http_client): + return AsyncErpLinksService(http_client=async_http_client) + + +@pytest.mark.parametrize( + "method", + ["get", "create", "update", "block", "unblock"], +) +def test_mixins_present(erp_links_service, method): + assert hasattr(erp_links_service, method) + + +@pytest.mark.parametrize( + "method", + ["get", "create", "update", "block", "unblock"], +) +def test_async_mixins_present(async_erp_links_service, method): + assert hasattr(async_erp_links_service, method)