From 2cd7079e477a0f753a68077665a91d15feacd16e Mon Sep 17 00:00:00 2001 From: Albert Sola Date: Wed, 15 Oct 2025 11:55:24 +0100 Subject: [PATCH] MPT-14452 Move get from service into a mixin --- mpt_api_client/http/__init__.py | 5 --- mpt_api_client/http/async_service.py | 14 ------- mpt_api_client/http/mixins.py | 37 +++++++++++++++++++ mpt_api_client/http/service.py | 15 -------- mpt_api_client/resources/accounts/account.py | 4 ++ .../resources/accounts/account_user_groups.py | 4 ++ .../resources/accounts/account_users.py | 6 ++- .../accounts/accounts_user_groups.py | 4 ++ .../resources/accounts/accounts_users.py | 6 ++- .../resources/accounts/api_tokens.py | 4 ++ mpt_api_client/resources/accounts/buyers.py | 4 ++ .../resources/accounts/cloud_tenants.py | 4 ++ .../resources/accounts/erp_links.py | 4 ++ .../resources/accounts/licensees.py | 4 ++ mpt_api_client/resources/accounts/modules.py | 5 ++- mpt_api_client/resources/accounts/sellers.py | 4 ++ .../resources/accounts/user_groups.py | 4 ++ mpt_api_client/resources/accounts/users.py | 4 ++ mpt_api_client/resources/audit/event_types.py | 11 +++++- mpt_api_client/resources/audit/records.py | 8 +++- .../billing/credit_memo_attachments.py | 4 ++ .../resources/billing/credit_memos.py | 4 ++ .../billing/custom_ledger_attachments.py | 4 ++ .../billing/custom_ledger_charges.py | 3 ++ .../resources/billing/custom_ledgers.py | 4 ++ .../resources/billing/invoice_attachments.py | 4 ++ mpt_api_client/resources/billing/invoices.py | 11 +++++- .../resources/billing/journal_attachments.py | 4 ++ .../resources/billing/journal_charges.py | 3 ++ .../resources/billing/journal_sellers.py | 3 ++ mpt_api_client/resources/billing/journals.py | 7 +++- .../resources/billing/ledger_attachments.py | 4 ++ .../resources/billing/ledger_charges.py | 3 ++ mpt_api_client/resources/billing/ledgers.py | 4 ++ .../resources/billing/manual_overrides.py | 4 ++ .../resources/billing/statement_charges.py | 3 ++ .../resources/billing/statements.py | 4 +- .../resources/catalog/authorizations.py | 4 ++ mpt_api_client/resources/catalog/items.py | 7 +++- mpt_api_client/resources/catalog/listings.py | 4 ++ .../resources/catalog/price_list_items.py | 8 +++- .../resources/catalog/price_lists.py | 4 ++ .../resources/catalog/pricing_policies.py | 5 +-- .../catalog/pricing_policy_attachments.py | 7 +++- .../catalog/product_term_variants.py | 7 +++- .../resources/catalog/product_terms.py | 8 +++- mpt_api_client/resources/catalog/products.py | 7 +++- .../resources/catalog/products_documents.py | 7 +++- .../resources/catalog/products_item_groups.py | 8 +++- .../resources/catalog/products_media.py | 7 +++- .../catalog/products_parameter_groups.py | 8 +++- .../resources/catalog/products_parameters.py | 8 +++- .../resources/catalog/products_templates.py | 8 +++- .../resources/catalog/units_of_measure.py | 4 ++ .../resources/commerce/agreements.py | 4 ++ .../commerce/agreements_attachments.py | 8 +++- mpt_api_client/resources/commerce/orders.py | 13 +++++-- .../resources/commerce/orders_subscription.py | 8 +++- .../resources/commerce/subscriptions.py | 10 ++++- .../resources/notifications/accounts.py | 12 ------ .../resources/notifications/batches.py | 4 +- .../resources/notifications/categories.py | 13 +++++-- .../resources/notifications/contacts.py | 6 ++- .../resources/notifications/messages.py | 3 ++ .../resources/notifications/subscribers.py | 4 ++ tests/http/conftest.py | 13 +++++-- tests/http/test_async_service.py | 17 --------- tests/http/test_mixins.py | 31 ++++++++++++++++ tests/resources/billing/test_invoices.py | 4 +- .../resources/commerce/test_subscriptions.py | 10 +++++ .../resources/notifications/test_accounts.py | 12 ------ 71 files changed, 388 insertions(+), 119 deletions(-) diff --git a/mpt_api_client/http/__init__.py b/mpt_api_client/http/__init__.py index cb7f0135..46c44db7 100644 --- a/mpt_api_client/http/__init__.py +++ b/mpt_api_client/http/__init__.py @@ -1,16 +1,11 @@ from mpt_api_client.http.async_client import AsyncHTTPClient from mpt_api_client.http.async_service import AsyncService from mpt_api_client.http.client import HTTPClient -from mpt_api_client.http.mixins import AsyncCreateMixin, AsyncDeleteMixin, CreateMixin, DeleteMixin from mpt_api_client.http.service import Service __all__ = [ # noqa: WPS410 - "AsyncCreateMixin", - "AsyncDeleteMixin", "AsyncHTTPClient", "AsyncService", - "CreateMixin", - "DeleteMixin", "HTTPClient", "Service", ] diff --git a/mpt_api_client/http/async_service.py b/mpt_api_client/http/async_service.py index 9daaddc5..7b07a484 100644 --- a/mpt_api_client/http/async_service.py +++ b/mpt_api_client/http/async_service.py @@ -77,20 +77,6 @@ async def iterate(self, batch_size: int = 100) -> AsyncIterator[Model]: break offset = items_collection.meta.pagination.next_offset() - async def get(self, resource_id: str, select: list[str] | str | None = None) -> Model: - """Fetch a specific resource using `GET /endpoint/{resource_id}`. - - Args: - resource_id: Resource ID. - select: List of fields to select. - - Returns: - Resource object. - """ - if isinstance(select, list): - select = ",".join(select) if select else None - return await self._resource_action(resource_id=resource_id, query_params={"select": select}) - async def _fetch_page_as_response(self, limit: int = 100, offset: int = 0) -> httpx.Response: """Fetch one page of resources. diff --git a/mpt_api_client/http/mixins.py b/mpt_api_client/http/mixins.py index fbbb30e2..24ca296f 100644 --- a/mpt_api_client/http/mixins.py +++ b/mpt_api_client/http/mixins.py @@ -192,3 +192,40 @@ async def download(self, resource_id: str) -> FileModel: resource_id, method="GET", headers={"Accept": "*"} ) return FileModel(response) + + +class GetMixin[Model]: + """Get resource mixin.""" + + def get(self, resource_id: str, select: list[str] | str | None = None) -> Model: + """Fetch a specific resource using `GET /endpoint/{resource_id}`. + + Args: + resource_id: Resource ID. + select: List of fields to select. + + Returns: + Resource object. + """ + if isinstance(select, list): + select = ",".join(select) if select else None + + return self._resource_action(resource_id=resource_id, query_params={"select": select}) # type: ignore[attr-defined, no-any-return] + + +class AsyncGetMixin[Model]: + """Async get resource mixin.""" + + async def get(self, resource_id: str, select: list[str] | str | None = None) -> Model: + """Fetch a specific resource using `GET /endpoint/{resource_id}`. + + Args: + resource_id: Resource ID. + select: List of fields to select. + + Returns: + Resource object. + """ + if isinstance(select, list): + select = ",".join(select) if select else None + return await self._resource_action(resource_id=resource_id, query_params={"select": select}) # type: ignore[attr-defined, no-any-return] diff --git a/mpt_api_client/http/service.py b/mpt_api_client/http/service.py index 74c9d4fa..73bf4fe5 100644 --- a/mpt_api_client/http/service.py +++ b/mpt_api_client/http/service.py @@ -76,21 +76,6 @@ def iterate(self, batch_size: int = 100) -> Iterator[Model]: break offset = items_collection.meta.pagination.next_offset() - def get(self, resource_id: str, select: list[str] | str | None = None) -> Model: - """Fetch a specific resource using `GET /endpoint/{resource_id}`. - - Args: - resource_id: Resource ID. - select: List of fields to select. - - Returns: - Resource object. - """ - if isinstance(select, list): - select = ",".join(select) if select else None - - return self._resource_action(resource_id=resource_id, query_params={"select": select}) - def _fetch_page_as_response(self, limit: int = 100, offset: int = 0) -> httpx.Response: """Fetch one page of resources. diff --git a/mpt_api_client/resources/accounts/account.py b/mpt_api_client/resources/accounts/account.py index 52fef6ab..83c74a70 100644 --- a/mpt_api_client/resources/accounts/account.py +++ b/mpt_api_client/resources/accounts/account.py @@ -1,8 +1,10 @@ from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -38,6 +40,7 @@ class AccountsService( ActivatableMixin[Account], EnablableMixin[Account], ValidateMixin[Account], + GetMixin[Account], Service[Account], AccountsServiceConfig, ): @@ -56,6 +59,7 @@ class AsyncAccountsService( AsyncActivatableMixin[Account], AsyncEnablableMixin[Account], AsyncValidateMixin[Account], + AsyncGetMixin[Account], AsyncService[Account], AccountsServiceConfig, ): diff --git a/mpt_api_client/resources/accounts/account_user_groups.py b/mpt_api_client/resources/accounts/account_user_groups.py index e6b9737d..1d43005a 100644 --- a/mpt_api_client/resources/accounts/account_user_groups.py +++ b/mpt_api_client/resources/accounts/account_user_groups.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -26,6 +28,7 @@ class AccountUserGroupsService( CreateMixin[AccountUserGroup], DeleteMixin, UpdateMixin[AccountUserGroup], + GetMixin[AccountUserGroup], Service[AccountUserGroup], AccountUserGroupsServiceConfig, ): @@ -36,6 +39,7 @@ class AsyncAccountUserGroupsService( AsyncCreateMixin[AccountUserGroup], AsyncDeleteMixin, AsyncUpdateMixin[AccountUserGroup], + AsyncGetMixin[AccountUserGroup], AsyncService[AccountUserGroup], AccountUserGroupsServiceConfig, ): diff --git a/mpt_api_client/resources/accounts/account_users.py b/mpt_api_client/resources/accounts/account_users.py index 7d2534ea..5791dcb7 100644 --- a/mpt_api_client/resources/accounts/account_users.py +++ b/mpt_api_client/resources/accounts/account_users.py @@ -1,7 +1,9 @@ from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, + AsyncGetMixin, CreateMixin, + GetMixin, ) from mpt_api_client.models import Model from mpt_api_client.resources.accounts.account_user_groups import ( @@ -29,6 +31,7 @@ class AccountUsersServiceConfig: class AccountUsersService( CreateMixin[AccountUser], InvitableMixin[AccountUser], + GetMixin[AccountUser], Service[AccountUser], AccountUsersServiceConfig, ): @@ -44,8 +47,9 @@ def groups(self, account_user_id: str) -> AccountUserGroupsService: class AsyncAccountUsersService( AsyncCreateMixin[AccountUser], - AsyncService[AccountUser], AsyncInvitableMixin[AccountUser], + AsyncGetMixin[AccountUser], + AsyncService[AccountUser], AccountUsersServiceConfig, ): """Asynchronous Account Users Service.""" diff --git a/mpt_api_client/resources/accounts/accounts_user_groups.py b/mpt_api_client/resources/accounts/accounts_user_groups.py index b0ca2504..99544435 100644 --- a/mpt_api_client/resources/accounts/accounts_user_groups.py +++ b/mpt_api_client/resources/accounts/accounts_user_groups.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -25,6 +27,7 @@ class AccountsUserGroupsServiceConfig: class AccountsUserGroupsService( UpdateMixin[AccountsUserGroup], DeleteMixin, + GetMixin[AccountsUserGroup], CreateMixin[AccountsUserGroup], Service[AccountsUserGroup], AccountsUserGroupsServiceConfig, @@ -35,6 +38,7 @@ class AccountsUserGroupsService( class AsyncAccountsUserGroupsService( AsyncUpdateMixin[AccountsUserGroup], AsyncDeleteMixin, + AsyncGetMixin[AccountsUserGroup], AsyncCreateMixin[AccountsUserGroup], AsyncService[AccountsUserGroup], AccountsUserGroupsServiceConfig, diff --git a/mpt_api_client/resources/accounts/accounts_users.py b/mpt_api_client/resources/accounts/accounts_users.py index 55b494af..d950cc9a 100644 --- a/mpt_api_client/resources/accounts/accounts_users.py +++ b/mpt_api_client/resources/accounts/accounts_users.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -35,6 +37,7 @@ class AccountsUsersService( DeleteMixin, CreateMixin[AccountsUser], InvitableMixin[AccountsUser], + GetMixin[AccountsUser], Service[AccountsUser], AccountsUsersServiceConfig, ): @@ -55,8 +58,9 @@ class AsyncAccountsUsersService( AsyncUpdateMixin[AccountsUser], AsyncDeleteMixin, AsyncCreateMixin[AccountsUser], - AsyncService[AccountsUser], AsyncInvitableMixin[AccountsUser], + AsyncGetMixin[AccountsUser], + AsyncService[AccountsUser], AccountsUsersServiceConfig, ): """Asynchronous Account Users Service.""" diff --git a/mpt_api_client/resources/accounts/api_tokens.py b/mpt_api_client/resources/accounts/api_tokens.py index f346ffdd..3234ba10 100644 --- a/mpt_api_client/resources/accounts/api_tokens.py +++ b/mpt_api_client/resources/accounts/api_tokens.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -28,6 +30,7 @@ class ApiTokensService( DeleteMixin, UpdateMixin[ApiToken], EnablableMixin[ApiToken], + GetMixin[ApiToken], Service[ApiToken], ApiTokensServiceConfig, ): @@ -39,6 +42,7 @@ class AsyncApiTokensService( AsyncDeleteMixin, AsyncUpdateMixin[ApiToken], AsyncEnablableMixin[ApiToken], + AsyncGetMixin[ApiToken], AsyncService[ApiToken], ApiTokensServiceConfig, ): diff --git a/mpt_api_client/resources/accounts/buyers.py b/mpt_api_client/resources/accounts/buyers.py index aa141620..088212d9 100644 --- a/mpt_api_client/resources/accounts/buyers.py +++ b/mpt_api_client/resources/accounts/buyers.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -38,6 +40,7 @@ class BuyersService( ActivatableMixin[Buyer], EnablableMixin[Buyer], ValidateMixin[Buyer], + GetMixin[Buyer], Service[Buyer], BuyersServiceConfig, ): @@ -69,6 +72,7 @@ class AsyncBuyersService( AsyncActivatableMixin[Buyer], AsyncEnablableMixin[Buyer], AsyncValidateMixin[Buyer], + AsyncGetMixin[Buyer], AsyncService[Buyer], BuyersServiceConfig, ): diff --git a/mpt_api_client/resources/accounts/cloud_tenants.py b/mpt_api_client/resources/accounts/cloud_tenants.py index 6fe48a54..efb096b9 100644 --- a/mpt_api_client/resources/accounts/cloud_tenants.py +++ b/mpt_api_client/resources/accounts/cloud_tenants.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -26,6 +28,7 @@ class CloudTenantsService( CreateMixin[CloudTenant], DeleteMixin, UpdateMixin[CloudTenant], + GetMixin[CloudTenant], Service[CloudTenant], CloudTenantsServiceConfig, ): @@ -36,6 +39,7 @@ class AsyncCloudTenantsService( AsyncCreateMixin[CloudTenant], AsyncDeleteMixin, AsyncUpdateMixin[CloudTenant], + AsyncGetMixin[CloudTenant], AsyncService[CloudTenant], CloudTenantsServiceConfig, ): diff --git a/mpt_api_client/resources/accounts/erp_links.py b/mpt_api_client/resources/accounts/erp_links.py index 325e8fb7..afb4c59d 100644 --- a/mpt_api_client/resources/accounts/erp_links.py +++ b/mpt_api_client/resources/accounts/erp_links.py @@ -1,8 +1,10 @@ from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -25,6 +27,7 @@ class ErpLinksService( CreateMixin[ErpLink], UpdateMixin[ErpLink], BlockableMixin[ErpLink], + GetMixin[ErpLink], Service[ErpLink], ErpLinksServiceConfig, ): @@ -35,6 +38,7 @@ class AsyncErpLinksService( AsyncCreateMixin[ErpLink], AsyncUpdateMixin[ErpLink], AsyncBlockableMixin[ErpLink], + AsyncGetMixin[ErpLink], AsyncService[ErpLink], ErpLinksServiceConfig, ): diff --git a/mpt_api_client/resources/accounts/licensees.py b/mpt_api_client/resources/accounts/licensees.py index 86e98f25..e29c3ef7 100644 --- a/mpt_api_client/resources/accounts/licensees.py +++ b/mpt_api_client/resources/accounts/licensees.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -28,6 +30,7 @@ class LicenseesService( DeleteMixin, UpdateMixin[Licensee], EnablableMixin[Licensee], + GetMixin[Licensee], Service[Licensee], LicenseesServiceConfig, ): @@ -39,6 +42,7 @@ class AsyncLicenseesService( AsyncDeleteMixin, AsyncUpdateMixin[Licensee], AsyncEnablableMixin[Licensee], + AsyncGetMixin[Licensee], AsyncService[Licensee], LicenseesServiceConfig, ): diff --git a/mpt_api_client/resources/accounts/modules.py b/mpt_api_client/resources/accounts/modules.py index a29505f8..f78daa45 100644 --- a/mpt_api_client/resources/accounts/modules.py +++ b/mpt_api_client/resources/accounts/modules.py @@ -1,4 +1,5 @@ from mpt_api_client.http import AsyncService, Service +from mpt_api_client.http.mixins import AsyncGetMixin, GetMixin from mpt_api_client.models import Model @@ -14,9 +15,9 @@ class ModulesServiceConfig: _collection_key = "data" -class ModulesService(Service[Module], ModulesServiceConfig): +class ModulesService(GetMixin[Module], Service[Module], ModulesServiceConfig): """Modules Service.""" -class AsyncModulesService(AsyncService[Module], ModulesServiceConfig): +class AsyncModulesService(AsyncGetMixin[Module], AsyncService[Module], ModulesServiceConfig): """Asynchronous Modules Service.""" diff --git a/mpt_api_client/resources/accounts/sellers.py b/mpt_api_client/resources/accounts/sellers.py index 74436126..57b4d31f 100644 --- a/mpt_api_client/resources/accounts/sellers.py +++ b/mpt_api_client/resources/accounts/sellers.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -27,6 +29,7 @@ class SellersServiceConfig: class SellersService( CreateMixin[Seller], DeleteMixin, + GetMixin[Seller], UpdateMixin[Seller], ActivatableMixin[Seller], Service[Seller], @@ -47,6 +50,7 @@ def disable(self, resource_id: str, resource_data: ResourceData | None = None) - class AsyncSellersService( AsyncCreateMixin[Seller], AsyncDeleteMixin, + AsyncGetMixin[Seller], AsyncUpdateMixin[Seller], AsyncActivatableMixin[Seller], AsyncService[Seller], diff --git a/mpt_api_client/resources/accounts/user_groups.py b/mpt_api_client/resources/accounts/user_groups.py index 00a8f992..e7ee7f82 100644 --- a/mpt_api_client/resources/accounts/user_groups.py +++ b/mpt_api_client/resources/accounts/user_groups.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -26,6 +28,7 @@ class UserGroupsService( CreateMixin[UserGroup], UpdateMixin[UserGroup], DeleteMixin, + GetMixin[UserGroup], Service[UserGroup], UserGroupsServiceConfig, ): @@ -36,6 +39,7 @@ class AsyncUserGroupsService( AsyncCreateMixin[UserGroup], AsyncUpdateMixin[UserGroup], AsyncDeleteMixin, + AsyncGetMixin[UserGroup], AsyncService[UserGroup], UserGroupsServiceConfig, ): diff --git a/mpt_api_client/resources/accounts/users.py b/mpt_api_client/resources/accounts/users.py index d481f689..eef09226 100644 --- a/mpt_api_client/resources/accounts/users.py +++ b/mpt_api_client/resources/accounts/users.py @@ -1,8 +1,10 @@ from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -29,6 +31,7 @@ class UsersService( UpdateMixin[User], DeleteMixin, BlockableMixin[User], + GetMixin[User], Service[User], UsersServiceConfig, ): @@ -68,6 +71,7 @@ class AsyncUsersService( AsyncUpdateMixin[User], AsyncDeleteMixin, AsyncBlockableMixin[User], + AsyncGetMixin[User], AsyncService[User], UsersServiceConfig, ): diff --git a/mpt_api_client/resources/audit/event_types.py b/mpt_api_client/resources/audit/event_types.py index d9f30911..955f41d4 100644 --- a/mpt_api_client/resources/audit/event_types.py +++ b/mpt_api_client/resources/audit/event_types.py @@ -1,6 +1,8 @@ from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( + AsyncGetMixin, AsyncUpdateMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -18,11 +20,16 @@ class EventTypesServiceConfig: _collection_key = "data" -class EventTypesService(UpdateMixin[EventType], Service[EventType], EventTypesServiceConfig): +class EventTypesService( + UpdateMixin[EventType], GetMixin[EventType], Service[EventType], EventTypesServiceConfig +): """Event Types service.""" class AsyncEventTypesService( - AsyncUpdateMixin[EventType], AsyncService[EventType], EventTypesServiceConfig + AsyncUpdateMixin[EventType], + AsyncGetMixin[EventType], + AsyncService[EventType], + EventTypesServiceConfig, ): """Async Event Types service.""" diff --git a/mpt_api_client/resources/audit/records.py b/mpt_api_client/resources/audit/records.py index a7afd4a6..881f4c09 100644 --- a/mpt_api_client/resources/audit/records.py +++ b/mpt_api_client/resources/audit/records.py @@ -1,7 +1,9 @@ from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, + AsyncGetMixin, CreateMixin, + GetMixin, ) from mpt_api_client.models import Model @@ -18,9 +20,11 @@ class RecordsServiceConfig: _collection_key = "data" -class RecordsService(CreateMixin[Record], Service[Record], RecordsServiceConfig): +class RecordsService(CreateMixin[Record], GetMixin[Record], Service[Record], RecordsServiceConfig): """Records service.""" -class AsyncRecordsService(AsyncCreateMixin[Record], AsyncService[Record], RecordsServiceConfig): +class AsyncRecordsService( + AsyncCreateMixin[Record], AsyncGetMixin[Record], AsyncService[Record], RecordsServiceConfig +): """Async records service.""" diff --git a/mpt_api_client/resources/billing/credit_memo_attachments.py b/mpt_api_client/resources/billing/credit_memo_attachments.py index 0db2b292..7061b7f4 100644 --- a/mpt_api_client/resources/billing/credit_memo_attachments.py +++ b/mpt_api_client/resources/billing/credit_memo_attachments.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncDeleteMixin, AsyncFileOperationsMixin, + AsyncGetMixin, AsyncUpdateMixin, DeleteMixin, FileOperationsMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -25,6 +27,7 @@ class CreditMemoAttachmentsServiceConfig: class CreditMemoAttachmentsService( FileOperationsMixin[CreditMemoAttachment], DeleteMixin, + GetMixin[CreditMemoAttachment], UpdateMixin[CreditMemoAttachment], Service[CreditMemoAttachment], CreditMemoAttachmentsServiceConfig, @@ -35,6 +38,7 @@ class CreditMemoAttachmentsService( class AsyncCreditMemoAttachmentsService( AsyncFileOperationsMixin[CreditMemoAttachment], AsyncDeleteMixin, + AsyncGetMixin[CreditMemoAttachment], AsyncUpdateMixin[CreditMemoAttachment], AsyncService[CreditMemoAttachment], CreditMemoAttachmentsServiceConfig, diff --git a/mpt_api_client/resources/billing/credit_memos.py b/mpt_api_client/resources/billing/credit_memos.py index 524d8d7c..569f8eb9 100644 --- a/mpt_api_client/resources/billing/credit_memos.py +++ b/mpt_api_client/resources/billing/credit_memos.py @@ -1,8 +1,10 @@ from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -27,6 +29,7 @@ class CreditMemosServiceConfig: class CreditMemosService( CreateMixin[CreditMemo], UpdateMixin[CreditMemo], + GetMixin[CreditMemo], Service[CreditMemo], CreditMemosServiceConfig, ): @@ -43,6 +46,7 @@ def attachments(self, credit_memo_id: str) -> CreditMemoAttachmentsService: class AsyncCreditMemosService( AsyncCreateMixin[CreditMemo], AsyncUpdateMixin[CreditMemo], + AsyncGetMixin[CreditMemo], AsyncService[CreditMemo], CreditMemosServiceConfig, ): diff --git a/mpt_api_client/resources/billing/custom_ledger_attachments.py b/mpt_api_client/resources/billing/custom_ledger_attachments.py index bbc4454b..0ec22be5 100644 --- a/mpt_api_client/resources/billing/custom_ledger_attachments.py +++ b/mpt_api_client/resources/billing/custom_ledger_attachments.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncDeleteMixin, AsyncFileOperationsMixin, + AsyncGetMixin, AsyncUpdateMixin, DeleteMixin, FileOperationsMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -25,6 +27,7 @@ class CustomLedgerAttachmentsServiceConfig: class CustomLedgerAttachmentsService( FileOperationsMixin[CustomLedgerAttachment], DeleteMixin, + GetMixin[CustomLedgerAttachment], UpdateMixin[CustomLedgerAttachment], Service[CustomLedgerAttachment], CustomLedgerAttachmentsServiceConfig, @@ -35,6 +38,7 @@ class CustomLedgerAttachmentsService( class AsyncCustomLedgerAttachmentsService( AsyncFileOperationsMixin[CustomLedgerAttachment], AsyncDeleteMixin, + AsyncGetMixin[CustomLedgerAttachment], AsyncUpdateMixin[CustomLedgerAttachment], AsyncService[CustomLedgerAttachment], CustomLedgerAttachmentsServiceConfig, diff --git a/mpt_api_client/resources/billing/custom_ledger_charges.py b/mpt_api_client/resources/billing/custom_ledger_charges.py index b7b8ce59..9ce830b0 100644 --- a/mpt_api_client/resources/billing/custom_ledger_charges.py +++ b/mpt_api_client/resources/billing/custom_ledger_charges.py @@ -1,4 +1,5 @@ from mpt_api_client.http import AsyncService, Service +from mpt_api_client.http.mixins import AsyncGetMixin, GetMixin from mpt_api_client.models import Model @@ -15,6 +16,7 @@ class CustomLedgerChargesServiceConfig: class CustomLedgerChargesService( + GetMixin[CustomLedgerCharge], Service[CustomLedgerCharge], CustomLedgerChargesServiceConfig, ): @@ -22,6 +24,7 @@ class CustomLedgerChargesService( class AsyncCustomLedgerChargesService( + AsyncGetMixin[CustomLedgerCharge], AsyncService[CustomLedgerCharge], CustomLedgerChargesServiceConfig, ): diff --git a/mpt_api_client/resources/billing/custom_ledgers.py b/mpt_api_client/resources/billing/custom_ledgers.py index 70206e59..18da5f43 100644 --- a/mpt_api_client/resources/billing/custom_ledgers.py +++ b/mpt_api_client/resources/billing/custom_ledgers.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -38,6 +40,7 @@ class CustomLedgersServiceConfig: class CustomLedgersService( CreateMixin[CustomLedger], DeleteMixin, + GetMixin[CustomLedger], UpdateMixin[CustomLedger], AcceptableMixin[CustomLedger], Service[CustomLedger], @@ -70,6 +73,7 @@ def attachments(self, custom_ledger_id: str) -> CustomLedgerAttachmentsService: class AsyncCustomLedgersService( AsyncCreateMixin[CustomLedger], AsyncDeleteMixin, + AsyncGetMixin[CustomLedger], AsyncUpdateMixin[CustomLedger], AsyncAcceptableMixin[CustomLedger], AsyncService[CustomLedger], diff --git a/mpt_api_client/resources/billing/invoice_attachments.py b/mpt_api_client/resources/billing/invoice_attachments.py index 7d9c2ee6..4e2fa366 100644 --- a/mpt_api_client/resources/billing/invoice_attachments.py +++ b/mpt_api_client/resources/billing/invoice_attachments.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncDeleteMixin, AsyncFileOperationsMixin, + AsyncGetMixin, AsyncUpdateMixin, DeleteMixin, FileOperationsMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -25,6 +27,7 @@ class InvoiceAttachmentsServiceConfig: class InvoiceAttachmentsService( FileOperationsMixin[InvoiceAttachment], DeleteMixin, + GetMixin[InvoiceAttachment], UpdateMixin[InvoiceAttachment], Service[InvoiceAttachment], InvoiceAttachmentsServiceConfig, @@ -35,6 +38,7 @@ class InvoiceAttachmentsService( class AsyncInvoiceAttachmentsService( AsyncFileOperationsMixin[InvoiceAttachment], AsyncDeleteMixin, + AsyncGetMixin[InvoiceAttachment], AsyncUpdateMixin[InvoiceAttachment], AsyncService[InvoiceAttachment], InvoiceAttachmentsServiceConfig, diff --git a/mpt_api_client/resources/billing/invoices.py b/mpt_api_client/resources/billing/invoices.py index b4b20ac7..fbf14bdc 100644 --- a/mpt_api_client/resources/billing/invoices.py +++ b/mpt_api_client/resources/billing/invoices.py @@ -1,5 +1,12 @@ from mpt_api_client.http import AsyncService, Service -from mpt_api_client.http.mixins import AsyncCreateMixin, AsyncUpdateMixin, CreateMixin, UpdateMixin +from mpt_api_client.http.mixins import ( + AsyncCreateMixin, + AsyncGetMixin, + AsyncUpdateMixin, + CreateMixin, + GetMixin, + UpdateMixin, +) from mpt_api_client.models import Model from mpt_api_client.resources.billing.invoice_attachments import ( AsyncInvoiceAttachmentsService, @@ -22,6 +29,7 @@ class InvoicesServiceConfig: class InvoicesService( CreateMixin[Invoice], UpdateMixin[Invoice], + GetMixin[Invoice], Service[Invoice], InvoicesServiceConfig, ): @@ -38,6 +46,7 @@ def attachments(self, invoice_id: str) -> InvoiceAttachmentsService: class AsyncInvoicesService( AsyncCreateMixin[Invoice], AsyncUpdateMixin[Invoice], + AsyncGetMixin[Invoice], AsyncService[Invoice], InvoicesServiceConfig, ): diff --git a/mpt_api_client/resources/billing/journal_attachments.py b/mpt_api_client/resources/billing/journal_attachments.py index 63798718..fd010195 100644 --- a/mpt_api_client/resources/billing/journal_attachments.py +++ b/mpt_api_client/resources/billing/journal_attachments.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncDeleteMixin, AsyncFileOperationsMixin, + AsyncGetMixin, AsyncUpdateMixin, DeleteMixin, FileOperationsMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -25,6 +27,7 @@ class JournalAttachmentsServiceConfig: class JournalAttachmentsService( FileOperationsMixin[JournalAttachment], DeleteMixin, + GetMixin[JournalAttachment], UpdateMixin[JournalAttachment], Service[JournalAttachment], JournalAttachmentsServiceConfig, @@ -35,6 +38,7 @@ class JournalAttachmentsService( class AsyncJournalAttachmentsService( AsyncFileOperationsMixin[JournalAttachment], AsyncDeleteMixin, + AsyncGetMixin[JournalAttachment], AsyncUpdateMixin[JournalAttachment], AsyncService[JournalAttachment], JournalAttachmentsServiceConfig, diff --git a/mpt_api_client/resources/billing/journal_charges.py b/mpt_api_client/resources/billing/journal_charges.py index 2f0c6903..2289eb17 100644 --- a/mpt_api_client/resources/billing/journal_charges.py +++ b/mpt_api_client/resources/billing/journal_charges.py @@ -1,4 +1,5 @@ from mpt_api_client.http import AsyncService, Service +from mpt_api_client.http.mixins import AsyncGetMixin, GetMixin from mpt_api_client.models import Model @@ -16,12 +17,14 @@ class JournalChargesServiceConfig: class JournalChargesService( Service[JournalCharge], + GetMixin[JournalCharge], JournalChargesServiceConfig, ): """Journal Charges service.""" class AsyncJournalChargesService( + AsyncGetMixin[JournalCharge], AsyncService[JournalCharge], JournalChargesServiceConfig, ): diff --git a/mpt_api_client/resources/billing/journal_sellers.py b/mpt_api_client/resources/billing/journal_sellers.py index 64f51a4d..f91f990a 100644 --- a/mpt_api_client/resources/billing/journal_sellers.py +++ b/mpt_api_client/resources/billing/journal_sellers.py @@ -1,4 +1,5 @@ from mpt_api_client.http import AsyncService, Service +from mpt_api_client.http.mixins import AsyncGetMixin, GetMixin from mpt_api_client.models import Model @@ -15,6 +16,7 @@ class JournalSellersServiceConfig: class JournalSellersService( + GetMixin[JournalSeller], Service[JournalSeller], JournalSellersServiceConfig, ): @@ -22,6 +24,7 @@ class JournalSellersService( class AsyncJournalSellersService( + AsyncGetMixin[JournalSeller], AsyncService[JournalSeller], JournalSellersServiceConfig, ): diff --git a/mpt_api_client/resources/billing/journals.py b/mpt_api_client/resources/billing/journals.py index 8fad57ba..6989fe20 100644 --- a/mpt_api_client/resources/billing/journals.py +++ b/mpt_api_client/resources/billing/journals.py @@ -1,9 +1,12 @@ -from mpt_api_client.http import AsyncService, CreateMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, + CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -41,6 +44,7 @@ class JournalsServiceConfig: class JournalsService( CreateMixin[Journal], DeleteMixin, + GetMixin[Journal], UpdateMixin[Journal], RegeneratableMixin[Journal], Service[Journal], @@ -77,6 +81,7 @@ def upload(self, journal_id: str) -> JournalUploadService: class AsyncJournalsService( AsyncCreateMixin[Journal], AsyncDeleteMixin, + AsyncGetMixin[Journal], AsyncUpdateMixin[Journal], AsyncRegeneratableMixin[Journal], AsyncService[Journal], diff --git a/mpt_api_client/resources/billing/ledger_attachments.py b/mpt_api_client/resources/billing/ledger_attachments.py index 31252bc8..70242b63 100644 --- a/mpt_api_client/resources/billing/ledger_attachments.py +++ b/mpt_api_client/resources/billing/ledger_attachments.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncDeleteMixin, AsyncFileOperationsMixin, + AsyncGetMixin, AsyncUpdateMixin, DeleteMixin, FileOperationsMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -25,6 +27,7 @@ class LedgerAttachmentsServiceConfig: class LedgerAttachmentsService( FileOperationsMixin[LedgerAttachment], DeleteMixin, + GetMixin[LedgerAttachment], UpdateMixin[LedgerAttachment], Service[LedgerAttachment], LedgerAttachmentsServiceConfig, @@ -35,6 +38,7 @@ class LedgerAttachmentsService( class AsyncLedgerAttachmentsService( AsyncFileOperationsMixin[LedgerAttachment], AsyncDeleteMixin, + AsyncGetMixin[LedgerAttachment], AsyncUpdateMixin[LedgerAttachment], AsyncService[LedgerAttachment], LedgerAttachmentsServiceConfig, diff --git a/mpt_api_client/resources/billing/ledger_charges.py b/mpt_api_client/resources/billing/ledger_charges.py index a0de6201..56779e80 100644 --- a/mpt_api_client/resources/billing/ledger_charges.py +++ b/mpt_api_client/resources/billing/ledger_charges.py @@ -1,4 +1,5 @@ from mpt_api_client.http import AsyncService, Service +from mpt_api_client.http.mixins import AsyncGetMixin, GetMixin from mpt_api_client.models import Model @@ -15,6 +16,7 @@ class LedgerChargesServiceConfig: class LedgerChargesService( + GetMixin[LedgerCharge], Service[LedgerCharge], LedgerChargesServiceConfig, ): @@ -22,6 +24,7 @@ class LedgerChargesService( class AsyncLedgerChargesService( + AsyncGetMixin[LedgerCharge], AsyncService[LedgerCharge], LedgerChargesServiceConfig, ): diff --git a/mpt_api_client/resources/billing/ledgers.py b/mpt_api_client/resources/billing/ledgers.py index 821db938..06a8497c 100644 --- a/mpt_api_client/resources/billing/ledgers.py +++ b/mpt_api_client/resources/billing/ledgers.py @@ -1,7 +1,9 @@ from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, + AsyncGetMixin, CreateMixin, + GetMixin, ) from mpt_api_client.models import Model from mpt_api_client.resources.billing.ledger_attachments import ( @@ -28,6 +30,7 @@ class LedgersServiceConfig: class LedgersService( CreateMixin[Ledger], + GetMixin[Ledger], Service[Ledger], LedgersServiceConfig, ): @@ -50,6 +53,7 @@ def attachments(self, ledger_id: str) -> LedgerAttachmentsService: class AsyncLedgersService( AsyncCreateMixin[Ledger], + AsyncGetMixin[Ledger], AsyncService[Ledger], LedgersServiceConfig, ): diff --git a/mpt_api_client/resources/billing/manual_overrides.py b/mpt_api_client/resources/billing/manual_overrides.py index 21488de8..a8f0aff4 100644 --- a/mpt_api_client/resources/billing/manual_overrides.py +++ b/mpt_api_client/resources/billing/manual_overrides.py @@ -1,8 +1,10 @@ from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -23,6 +25,7 @@ class ManualOverridesServiceConfig: class ManualOverridesService( CreateMixin[ManualOverride], UpdateMixin[ManualOverride], + GetMixin[ManualOverride], Service[ManualOverride], ManualOverridesServiceConfig, ): @@ -32,6 +35,7 @@ class ManualOverridesService( class AsyncManualOverridesService( AsyncCreateMixin[ManualOverride], AsyncUpdateMixin[ManualOverride], + AsyncGetMixin[ManualOverride], AsyncService[ManualOverride], ManualOverridesServiceConfig, ): diff --git a/mpt_api_client/resources/billing/statement_charges.py b/mpt_api_client/resources/billing/statement_charges.py index 4c7cd5eb..5ef289d5 100644 --- a/mpt_api_client/resources/billing/statement_charges.py +++ b/mpt_api_client/resources/billing/statement_charges.py @@ -1,4 +1,5 @@ from mpt_api_client.http import AsyncService, Service +from mpt_api_client.http.mixins import AsyncGetMixin, GetMixin from mpt_api_client.models import Model @@ -15,6 +16,7 @@ class StatementChargesServiceConfig: class StatementChargesService( + GetMixin[StatementCharge], Service[StatementCharge], StatementChargesServiceConfig, ): @@ -22,6 +24,7 @@ class StatementChargesService( class AsyncStatementChargesService( + AsyncGetMixin[StatementCharge], AsyncService[StatementCharge], StatementChargesServiceConfig, ): diff --git a/mpt_api_client/resources/billing/statements.py b/mpt_api_client/resources/billing/statements.py index 55465ec7..c0fa7729 100644 --- a/mpt_api_client/resources/billing/statements.py +++ b/mpt_api_client/resources/billing/statements.py @@ -1,5 +1,5 @@ from mpt_api_client.http import AsyncService, Service -from mpt_api_client.http.mixins import AsyncUpdateMixin, UpdateMixin +from mpt_api_client.http.mixins import AsyncGetMixin, AsyncUpdateMixin, GetMixin, UpdateMixin from mpt_api_client.models import Model from mpt_api_client.resources.billing.mixins import AsyncIssuableMixin, IssuableMixin from mpt_api_client.resources.billing.statement_charges import ( @@ -23,6 +23,7 @@ class StatementsServiceConfig: class StatementsService( UpdateMixin[Statement], IssuableMixin[Statement], + GetMixin[Statement], Service[Statement], StatementsServiceConfig, ): @@ -39,6 +40,7 @@ def charges(self, statement_id: str) -> StatementChargesService: class AsyncStatementsService( AsyncUpdateMixin[Statement], AsyncIssuableMixin[Statement], + AsyncGetMixin[Statement], AsyncService[Statement], StatementsServiceConfig, ): diff --git a/mpt_api_client/resources/catalog/authorizations.py b/mpt_api_client/resources/catalog/authorizations.py index dbc1cbda..d078a224 100644 --- a/mpt_api_client/resources/catalog/authorizations.py +++ b/mpt_api_client/resources/catalog/authorizations.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -25,6 +27,7 @@ class AuthorizationsServiceConfig: class AuthorizationsService( CreateMixin[Authorization], DeleteMixin, + GetMixin[Authorization], UpdateMixin[Authorization], Service[Authorization], AuthorizationsServiceConfig, @@ -35,6 +38,7 @@ class AuthorizationsService( class AsyncAuthorizationsService( AsyncCreateMixin[Authorization], AsyncDeleteMixin, + AsyncGetMixin[Authorization], AsyncUpdateMixin[Authorization], AsyncService[Authorization], AuthorizationsServiceConfig, diff --git a/mpt_api_client/resources/catalog/items.py b/mpt_api_client/resources/catalog/items.py index 97a6e5f1..5161a602 100644 --- a/mpt_api_client/resources/catalog/items.py +++ b/mpt_api_client/resources/catalog/items.py @@ -1,9 +1,12 @@ -from mpt_api_client.http import AsyncService, CreateMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, + CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -28,6 +31,7 @@ class ItemsServiceConfig: class ItemsService( CreateMixin[Item], DeleteMixin, + GetMixin[Item], UpdateMixin[Item], PublishableMixin[Item], Service[Item], @@ -39,6 +43,7 @@ class ItemsService( class AsyncItemsService( AsyncCreateMixin[Item], AsyncDeleteMixin, + AsyncGetMixin[Item], AsyncUpdateMixin[Item], AsyncPublishableMixin[Item], AsyncService[Item], diff --git a/mpt_api_client/resources/catalog/listings.py b/mpt_api_client/resources/catalog/listings.py index dafbcfa5..170bc604 100644 --- a/mpt_api_client/resources/catalog/listings.py +++ b/mpt_api_client/resources/catalog/listings.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -25,6 +27,7 @@ class ListingsServiceConfig: class ListingsService( CreateMixin[Listing], DeleteMixin, + GetMixin[Listing], UpdateMixin[Listing], Service[Listing], ListingsServiceConfig, @@ -35,6 +38,7 @@ class ListingsService( class AsyncListingsService( AsyncCreateMixin[Listing], AsyncDeleteMixin, + AsyncGetMixin[Listing], AsyncUpdateMixin[Listing], AsyncService[Listing], ListingsServiceConfig, diff --git a/mpt_api_client/resources/catalog/price_list_items.py b/mpt_api_client/resources/catalog/price_list_items.py index cb4dcda6..b2a34d1e 100644 --- a/mpt_api_client/resources/catalog/price_list_items.py +++ b/mpt_api_client/resources/catalog/price_list_items.py @@ -1,8 +1,12 @@ -from mpt_api_client.http import AsyncService, CreateMixin, DeleteMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, + CreateMixin, + DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -23,6 +27,7 @@ class PriceListItemsServiceConfig: class PriceListItemsService( CreateMixin[PriceListItem], DeleteMixin, + GetMixin[PriceListItem], UpdateMixin[PriceListItem], Service[PriceListItem], PriceListItemsServiceConfig, @@ -33,6 +38,7 @@ class PriceListItemsService( class AsyncPriceListItemsService( AsyncCreateMixin[PriceListItem], AsyncDeleteMixin, + AsyncGetMixin[PriceListItem], AsyncUpdateMixin[PriceListItem], AsyncService[PriceListItem], PriceListItemsServiceConfig, diff --git a/mpt_api_client/resources/catalog/price_lists.py b/mpt_api_client/resources/catalog/price_lists.py index 022a027f..2d2afd47 100644 --- a/mpt_api_client/resources/catalog/price_lists.py +++ b/mpt_api_client/resources/catalog/price_lists.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -29,6 +31,7 @@ class PriceListsServiceConfig: class PriceListsService( CreateMixin[PriceList], DeleteMixin, + GetMixin[PriceList], UpdateMixin[PriceList], Service[PriceList], PriceListsServiceConfig, @@ -45,6 +48,7 @@ def items(self, price_list_id: str) -> PriceListItemsService: class AsyncPriceListsService( AsyncCreateMixin[PriceList], AsyncDeleteMixin, + AsyncGetMixin[PriceList], AsyncUpdateMixin[PriceList], AsyncService[PriceList], PriceListsServiceConfig, diff --git a/mpt_api_client/resources/catalog/pricing_policies.py b/mpt_api_client/resources/catalog/pricing_policies.py index 833dba05..f726bc82 100644 --- a/mpt_api_client/resources/catalog/pricing_policies.py +++ b/mpt_api_client/resources/catalog/pricing_policies.py @@ -1,11 +1,8 @@ from mpt_api_client.http import ( - AsyncCreateMixin, - AsyncDeleteMixin, AsyncService, - CreateMixin, - DeleteMixin, Service, ) +from mpt_api_client.http.mixins import AsyncCreateMixin, AsyncDeleteMixin, CreateMixin, DeleteMixin from mpt_api_client.models import Model, ResourceData from mpt_api_client.resources.catalog.pricing_policy_attachments import ( AsyncPricingPolicyAttachmentsService, diff --git a/mpt_api_client/resources/catalog/pricing_policy_attachments.py b/mpt_api_client/resources/catalog/pricing_policy_attachments.py index eb3a397b..53fd9483 100644 --- a/mpt_api_client/resources/catalog/pricing_policy_attachments.py +++ b/mpt_api_client/resources/catalog/pricing_policy_attachments.py @@ -1,9 +1,12 @@ -from mpt_api_client.http import AsyncService, DeleteMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncDeleteMixin, AsyncFileOperationsMixin, + AsyncGetMixin, AsyncUpdateMixin, + DeleteMixin, FileOperationsMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -25,6 +28,7 @@ class PricingPolicyAttachmentsServiceConfig: class PricingPolicyAttachmentsService( FileOperationsMixin[PricingPolicyAttachment], DeleteMixin, + GetMixin[PricingPolicyAttachment], UpdateMixin[PricingPolicyAttachment], ActivatableMixin[PricingPolicyAttachment], Service[PricingPolicyAttachment], @@ -36,6 +40,7 @@ class PricingPolicyAttachmentsService( class AsyncPricingPolicyAttachmentsService( AsyncFileOperationsMixin[PricingPolicyAttachment], AsyncDeleteMixin, + AsyncGetMixin[PricingPolicyAttachment], AsyncUpdateMixin[PricingPolicyAttachment], AsyncActivatableMixin[PricingPolicyAttachment], AsyncService[PricingPolicyAttachment], diff --git a/mpt_api_client/resources/catalog/product_term_variants.py b/mpt_api_client/resources/catalog/product_term_variants.py index 15764ab9..125681e3 100644 --- a/mpt_api_client/resources/catalog/product_term_variants.py +++ b/mpt_api_client/resources/catalog/product_term_variants.py @@ -1,9 +1,12 @@ -from mpt_api_client.http import AsyncService, DeleteMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncDeleteMixin, AsyncFileOperationsMixin, + AsyncGetMixin, AsyncUpdateMixin, + DeleteMixin, FileOperationsMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -28,6 +31,7 @@ class TermVariantServiceConfig: class TermVariantService( FileOperationsMixin[TermVariant], DeleteMixin, + GetMixin[TermVariant], UpdateMixin[TermVariant], PublishableMixin[TermVariant], Service[TermVariant], @@ -39,6 +43,7 @@ class TermVariantService( class AsyncTermVariantService( AsyncFileOperationsMixin[TermVariant], AsyncDeleteMixin, + AsyncGetMixin[TermVariant], AsyncUpdateMixin[TermVariant], AsyncPublishableMixin[TermVariant], AsyncService[TermVariant], diff --git a/mpt_api_client/resources/catalog/product_terms.py b/mpt_api_client/resources/catalog/product_terms.py index 44190c37..11ec391a 100644 --- a/mpt_api_client/resources/catalog/product_terms.py +++ b/mpt_api_client/resources/catalog/product_terms.py @@ -1,8 +1,12 @@ -from mpt_api_client.http import AsyncService, CreateMixin, DeleteMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, + CreateMixin, + DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -28,6 +32,7 @@ class TermServiceConfig: class TermService( CreateMixin[Term], DeleteMixin, + GetMixin[Term], UpdateMixin[Term], PublishableMixin[Term], Service[Term], @@ -46,6 +51,7 @@ def variants(self, term_id: str) -> TermVariantService: class AsyncTermService( AsyncCreateMixin[Term], AsyncDeleteMixin, + AsyncGetMixin[Term], AsyncUpdateMixin[Term], AsyncPublishableMixin[Term], AsyncService[Term], diff --git a/mpt_api_client/resources/catalog/products.py b/mpt_api_client/resources/catalog/products.py index 082c9a18..c3f15643 100644 --- a/mpt_api_client/resources/catalog/products.py +++ b/mpt_api_client/resources/catalog/products.py @@ -1,9 +1,12 @@ -from mpt_api_client.http import AsyncService, CreateMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, + CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model, ResourceData @@ -56,6 +59,7 @@ class ProductsServiceConfig: class ProductsService( CreateMixin[Product], DeleteMixin, + GetMixin[Product], UpdateMixin[Product], PublishableMixin[Product], Service[Product], @@ -111,6 +115,7 @@ def update_settings(self, product_id: str, settings: ResourceData) -> Product: class AsyncProductsService( AsyncCreateMixin[Product], AsyncDeleteMixin, + AsyncGetMixin[Product], AsyncUpdateMixin[Product], AsyncPublishableMixin[Product], AsyncService[Product], diff --git a/mpt_api_client/resources/catalog/products_documents.py b/mpt_api_client/resources/catalog/products_documents.py index 19225ce4..9734b312 100644 --- a/mpt_api_client/resources/catalog/products_documents.py +++ b/mpt_api_client/resources/catalog/products_documents.py @@ -1,9 +1,12 @@ -from mpt_api_client.http import AsyncService, DeleteMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncDeleteMixin, AsyncFileOperationsMixin, + AsyncGetMixin, AsyncUpdateMixin, + DeleteMixin, FileOperationsMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -25,6 +28,7 @@ class DocumentServiceConfig: class DocumentService( FileOperationsMixin[Document], DeleteMixin, + GetMixin[Document], UpdateMixin[Document], PublishableMixin[Document], Service[Document], @@ -36,6 +40,7 @@ class DocumentService( class AsyncDocumentService( AsyncFileOperationsMixin[Document], AsyncDeleteMixin, + AsyncGetMixin[Document], AsyncUpdateMixin[Document], AsyncPublishableMixin[Document], AsyncService[Document], diff --git a/mpt_api_client/resources/catalog/products_item_groups.py b/mpt_api_client/resources/catalog/products_item_groups.py index bace7c0f..7fb6798d 100644 --- a/mpt_api_client/resources/catalog/products_item_groups.py +++ b/mpt_api_client/resources/catalog/products_item_groups.py @@ -1,8 +1,12 @@ -from mpt_api_client.http import AsyncService, CreateMixin, DeleteMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, + CreateMixin, + DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -23,6 +27,7 @@ class ItemGroupsServiceConfig: class ItemGroupsService( CreateMixin[ItemGroup], DeleteMixin, + GetMixin[ItemGroup], UpdateMixin[ItemGroup], Service[ItemGroup], ItemGroupsServiceConfig, @@ -33,6 +38,7 @@ class ItemGroupsService( class AsyncItemGroupsService( AsyncCreateMixin[ItemGroup], AsyncDeleteMixin, + AsyncGetMixin[ItemGroup], AsyncUpdateMixin[ItemGroup], AsyncService[ItemGroup], ItemGroupsServiceConfig, diff --git a/mpt_api_client/resources/catalog/products_media.py b/mpt_api_client/resources/catalog/products_media.py index 7712b430..68fc59f0 100644 --- a/mpt_api_client/resources/catalog/products_media.py +++ b/mpt_api_client/resources/catalog/products_media.py @@ -2,12 +2,15 @@ from httpx._types import FileTypes -from mpt_api_client.http import AsyncService, DeleteMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncDeleteMixin, AsyncFileOperationsMixin, + AsyncGetMixin, AsyncUpdateMixin, + DeleteMixin, FileOperationsMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model, ResourceData @@ -32,6 +35,7 @@ class MediaServiceConfig: class MediaService( FileOperationsMixin[Media], DeleteMixin, + GetMixin[Media], UpdateMixin[Media], PublishableMixin[Media], Service[Media], @@ -85,6 +89,7 @@ def create( class AsyncMediaService( AsyncFileOperationsMixin[Media], AsyncDeleteMixin, + AsyncGetMixin[Media], AsyncUpdateMixin[Media], AsyncPublishableMixin[Media], AsyncService[Media], diff --git a/mpt_api_client/resources/catalog/products_parameter_groups.py b/mpt_api_client/resources/catalog/products_parameter_groups.py index fb4ed0fe..414985a7 100644 --- a/mpt_api_client/resources/catalog/products_parameter_groups.py +++ b/mpt_api_client/resources/catalog/products_parameter_groups.py @@ -1,8 +1,12 @@ -from mpt_api_client.http import AsyncService, CreateMixin, DeleteMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, + CreateMixin, + DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -23,6 +27,7 @@ class ParameterGroupsServiceConfig: class ParameterGroupsService( CreateMixin[ParameterGroup], DeleteMixin, + GetMixin[ParameterGroup], UpdateMixin[ParameterGroup], Service[ParameterGroup], ParameterGroupsServiceConfig, @@ -33,6 +38,7 @@ class ParameterGroupsService( class AsyncParameterGroupsService( AsyncCreateMixin[ParameterGroup], AsyncDeleteMixin, + AsyncGetMixin[ParameterGroup], AsyncUpdateMixin[ParameterGroup], AsyncService[ParameterGroup], ParameterGroupsServiceConfig, diff --git a/mpt_api_client/resources/catalog/products_parameters.py b/mpt_api_client/resources/catalog/products_parameters.py index 1a60b840..ec243d51 100644 --- a/mpt_api_client/resources/catalog/products_parameters.py +++ b/mpt_api_client/resources/catalog/products_parameters.py @@ -1,8 +1,12 @@ -from mpt_api_client.http import AsyncService, CreateMixin, DeleteMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, + CreateMixin, + DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -23,6 +27,7 @@ class ParametersServiceConfig: class ParametersService( CreateMixin[Parameter], DeleteMixin, + GetMixin[Parameter], UpdateMixin[Parameter], Service[Parameter], ParametersServiceConfig, @@ -33,6 +38,7 @@ class ParametersService( class AsyncParametersService( AsyncCreateMixin[Parameter], AsyncDeleteMixin, + AsyncGetMixin[Parameter], AsyncUpdateMixin[Parameter], AsyncService[Parameter], ParametersServiceConfig, diff --git a/mpt_api_client/resources/catalog/products_templates.py b/mpt_api_client/resources/catalog/products_templates.py index c7a0b461..5dc323a0 100644 --- a/mpt_api_client/resources/catalog/products_templates.py +++ b/mpt_api_client/resources/catalog/products_templates.py @@ -1,8 +1,12 @@ -from mpt_api_client.http import AsyncService, CreateMixin, DeleteMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, + CreateMixin, + DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -23,6 +27,7 @@ class TemplatesServiceConfig: class TemplatesService( CreateMixin[Template], DeleteMixin, + GetMixin[Template], UpdateMixin[Template], Service[Template], TemplatesServiceConfig, @@ -33,6 +38,7 @@ class TemplatesService( class AsyncTemplatesService( AsyncCreateMixin[Template], AsyncDeleteMixin, + AsyncGetMixin[Template], AsyncUpdateMixin[Template], AsyncService[Template], TemplatesServiceConfig, diff --git a/mpt_api_client/resources/catalog/units_of_measure.py b/mpt_api_client/resources/catalog/units_of_measure.py index 9a3bfc0f..af7574b4 100644 --- a/mpt_api_client/resources/catalog/units_of_measure.py +++ b/mpt_api_client/resources/catalog/units_of_measure.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -25,6 +27,7 @@ class UnitsOfMeasureServiceConfig: class UnitsOfMeasureService( CreateMixin[UnitOfMeasure], DeleteMixin, + GetMixin[UnitOfMeasure], UpdateMixin[UnitOfMeasure], Service[UnitOfMeasure], UnitsOfMeasureServiceConfig, @@ -35,6 +38,7 @@ class UnitsOfMeasureService( class AsyncUnitsOfMeasureService( AsyncCreateMixin[UnitOfMeasure], AsyncDeleteMixin, + AsyncGetMixin[UnitOfMeasure], AsyncUpdateMixin[UnitOfMeasure], AsyncService[UnitOfMeasure], UnitsOfMeasureServiceConfig, diff --git a/mpt_api_client/resources/commerce/agreements.py b/mpt_api_client/resources/commerce/agreements.py index 071e3497..1efb8b5d 100644 --- a/mpt_api_client/resources/commerce/agreements.py +++ b/mpt_api_client/resources/commerce/agreements.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -29,6 +31,7 @@ class AgreementsServiceConfig: class AgreementsService( # noqa: WPS215 CreateMixin[Agreement], UpdateMixin[Agreement], + GetMixin[Agreement], DeleteMixin, Service[Agreement], AgreementsServiceConfig, @@ -65,6 +68,7 @@ def attachments(self, agreement_id: str) -> AgreementsAttachmentService: class AsyncAgreementsService( # noqa: WPS215 AsyncCreateMixin[Agreement], AsyncUpdateMixin[Agreement], + AsyncGetMixin[Agreement], AsyncDeleteMixin, AsyncService[Agreement], AgreementsServiceConfig, diff --git a/mpt_api_client/resources/commerce/agreements_attachments.py b/mpt_api_client/resources/commerce/agreements_attachments.py index 81428513..e0ba98ab 100644 --- a/mpt_api_client/resources/commerce/agreements_attachments.py +++ b/mpt_api_client/resources/commerce/agreements_attachments.py @@ -1,7 +1,11 @@ -from mpt_api_client.http import AsyncDeleteMixin, AsyncService, DeleteMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( + AsyncDeleteMixin, AsyncFileOperationsMixin, + AsyncGetMixin, + DeleteMixin, FileOperationsMixin, + GetMixin, ) from mpt_api_client.models import Model @@ -21,6 +25,7 @@ class AgreementsAttachmentServiceConfig: class AgreementsAttachmentService( FileOperationsMixin[AgreementAttachment], DeleteMixin, + GetMixin[AgreementAttachment], Service[AgreementAttachment], AgreementsAttachmentServiceConfig, ): @@ -30,6 +35,7 @@ class AgreementsAttachmentService( class AsyncAgreementsAttachmentService( AsyncFileOperationsMixin[AgreementAttachment], AsyncDeleteMixin, + AsyncGetMixin[AgreementAttachment], AsyncService[AgreementAttachment], AgreementsAttachmentServiceConfig, ): diff --git a/mpt_api_client/resources/commerce/orders.py b/mpt_api_client/resources/commerce/orders.py index 58fb06b1..972a5c63 100644 --- a/mpt_api_client/resources/commerce/orders.py +++ b/mpt_api_client/resources/commerce/orders.py @@ -1,12 +1,17 @@ from mpt_api_client.http import ( + AsyncService, + Service, +) +from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, - AsyncService, + AsyncGetMixin, + AsyncUpdateMixin, CreateMixin, DeleteMixin, - Service, + GetMixin, + UpdateMixin, ) -from mpt_api_client.http.mixins import AsyncUpdateMixin, UpdateMixin from mpt_api_client.models import Model, ResourceData from mpt_api_client.resources.commerce.orders_subscription import ( AsyncOrderSubscriptionsService, @@ -29,6 +34,7 @@ class OrdersServiceConfig: class OrdersService( # noqa: WPS215 WPS214 CreateMixin[Order], DeleteMixin, + GetMixin[Order], UpdateMixin[Order], Service[Order], OrdersServiceConfig, @@ -119,6 +125,7 @@ def subscriptions(self, order_id: str) -> OrderSubscriptionsService: class AsyncOrdersService( # noqa: WPS215 WPS214 AsyncCreateMixin[Order], AsyncDeleteMixin, + AsyncGetMixin[Order], AsyncUpdateMixin[Order], AsyncService[Order], OrdersServiceConfig, diff --git a/mpt_api_client/resources/commerce/orders_subscription.py b/mpt_api_client/resources/commerce/orders_subscription.py index d2ef0073..a49d3c7e 100644 --- a/mpt_api_client/resources/commerce/orders_subscription.py +++ b/mpt_api_client/resources/commerce/orders_subscription.py @@ -1,8 +1,12 @@ -from mpt_api_client.http import AsyncService, CreateMixin, DeleteMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, + CreateMixin, + DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -23,6 +27,7 @@ class OrderSubscriptionsServiceConfig: class OrderSubscriptionsService( # noqa: WPS215 CreateMixin[OrderSubscription], DeleteMixin, + GetMixin[OrderSubscription], UpdateMixin[OrderSubscription], Service[OrderSubscription], OrderSubscriptionsServiceConfig, @@ -33,6 +38,7 @@ class OrderSubscriptionsService( # noqa: WPS215 class AsyncOrderSubscriptionsService( # noqa: WPS215 AsyncCreateMixin[OrderSubscription], AsyncDeleteMixin, + AsyncGetMixin[OrderSubscription], AsyncUpdateMixin[OrderSubscription], AsyncService[OrderSubscription], OrderSubscriptionsServiceConfig, diff --git a/mpt_api_client/resources/commerce/subscriptions.py b/mpt_api_client/resources/commerce/subscriptions.py index 83f6dd46..e411b6e6 100644 --- a/mpt_api_client/resources/commerce/subscriptions.py +++ b/mpt_api_client/resources/commerce/subscriptions.py @@ -1,10 +1,14 @@ from mpt_api_client.http import ( + AsyncService, + Service, +) +from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, - AsyncService, + AsyncGetMixin, CreateMixin, DeleteMixin, - Service, + GetMixin, ) from mpt_api_client.models import Model, ResourceData @@ -24,6 +28,7 @@ class SubscriptionsServiceConfig: class SubscriptionsService( # noqa: WPS215 CreateMixin[Subscription], DeleteMixin, + GetMixin[Subscription], Service[Subscription], SubscriptionsServiceConfig, ): @@ -57,6 +62,7 @@ def terminate(self, resource_id: str, resource_data: ResourceData) -> Subscripti class AsyncSubscriptionsService( # noqa: WPS215 AsyncCreateMixin[Subscription], AsyncDeleteMixin, + AsyncGetMixin[Subscription], AsyncService[Subscription], SubscriptionsServiceConfig, ): diff --git a/mpt_api_client/resources/notifications/accounts.py b/mpt_api_client/resources/notifications/accounts.py index 475dbee2..264c9b41 100644 --- a/mpt_api_client/resources/notifications/accounts.py +++ b/mpt_api_client/resources/notifications/accounts.py @@ -1,5 +1,3 @@ -from typing import override - from mpt_api_client.exceptions import MPTError from mpt_api_client.http import AsyncService, Service from mpt_api_client.models import Model @@ -24,16 +22,6 @@ class AccountsServiceConfig: class AccountsService(Service[Contact], AccountsServiceConfig): """Accounts service.""" - @override - def get(self, resource_id: str, select: list[str] | str | None = None) -> Contact: - # TODO: delete. This method does not exist in the api - raise MethodNotAllowedError("Operation not allowed") - class AsyncAccountsService(AsyncService[Contact], AccountsServiceConfig): """Async Accounts service.""" - - @override - async def get(self, resource_id: str, select: list[str] | str | None = None) -> Contact: - # TODO: delete. This method does not exist in the api - raise MethodNotAllowedError("Operation not allowed") diff --git a/mpt_api_client/resources/notifications/batches.py b/mpt_api_client/resources/notifications/batches.py index 8cf21e39..b1e2ae1e 100644 --- a/mpt_api_client/resources/notifications/batches.py +++ b/mpt_api_client/resources/notifications/batches.py @@ -1,7 +1,7 @@ from httpx._types import FileTypes from mpt_api_client.http import AsyncService, Service -from mpt_api_client.http.mixins import _json_to_file_payload +from mpt_api_client.http.mixins import AsyncGetMixin, GetMixin, _json_to_file_payload from mpt_api_client.models import FileModel, Model, ResourceData @@ -18,6 +18,7 @@ class BatchesServiceConfig: class BatchesService( + GetMixin[Batch], Service[Batch], BatchesServiceConfig, ): @@ -67,6 +68,7 @@ def get_batch_attachment(self, batch_id: str, attachment_id: str) -> FileModel: class AsyncBatchesService( + AsyncGetMixin[Batch], AsyncService[Batch], BatchesServiceConfig, ): diff --git a/mpt_api_client/resources/notifications/categories.py b/mpt_api_client/resources/notifications/categories.py index 67bb8dae..f781e3f7 100644 --- a/mpt_api_client/resources/notifications/categories.py +++ b/mpt_api_client/resources/notifications/categories.py @@ -1,5 +1,12 @@ -from mpt_api_client.http import AsyncService, CreateMixin, Service -from mpt_api_client.http.mixins import AsyncDeleteMixin, AsyncUpdateMixin, DeleteMixin, UpdateMixin +from mpt_api_client.http import AsyncService, Service +from mpt_api_client.http.mixins import ( + AsyncCreateMixin, + AsyncDeleteMixin, + AsyncUpdateMixin, + CreateMixin, + DeleteMixin, + UpdateMixin, +) from mpt_api_client.models import Model, ResourceData @@ -44,7 +51,7 @@ def unpublish(self, resource_id: str, resource_data: ResourceData | None = None) class AsyncCategoriesService( - CreateMixin[Category], + AsyncCreateMixin[Category], AsyncUpdateMixin[Category], AsyncDeleteMixin, AsyncService[Category], diff --git a/mpt_api_client/resources/notifications/contacts.py b/mpt_api_client/resources/notifications/contacts.py index 8028685e..dc3557a4 100644 --- a/mpt_api_client/resources/notifications/contacts.py +++ b/mpt_api_client/resources/notifications/contacts.py @@ -1,9 +1,11 @@ -from mpt_api_client.http import AsyncService, CreateMixin, Service +from mpt_api_client.http import AsyncService, Service from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, AsyncUpdateMixin, + CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model, ResourceData @@ -25,6 +27,7 @@ class ContactsService( CreateMixin[Contact], UpdateMixin[Contact], DeleteMixin, + GetMixin[Contact], Service[Contact], ContactsServiceConfig, ): @@ -43,6 +46,7 @@ class AsyncContactsService( AsyncCreateMixin[Contact], AsyncUpdateMixin[Contact], AsyncDeleteMixin, + GetMixin[Contact], AsyncService[Contact], ContactsServiceConfig, ): diff --git a/mpt_api_client/resources/notifications/messages.py b/mpt_api_client/resources/notifications/messages.py index 860e881c..d8727d28 100644 --- a/mpt_api_client/resources/notifications/messages.py +++ b/mpt_api_client/resources/notifications/messages.py @@ -1,4 +1,5 @@ from mpt_api_client.http import AsyncService, Service +from mpt_api_client.http.mixins import AsyncGetMixin, GetMixin from mpt_api_client.models import Model @@ -15,6 +16,7 @@ class MessagesServiceConfig: class MessagesService( + GetMixin[Message], Service[Message], MessagesServiceConfig, ): @@ -22,6 +24,7 @@ class MessagesService( class AsyncMessagesService( + AsyncGetMixin[Message], AsyncService[Message], MessagesServiceConfig, ): diff --git a/mpt_api_client/resources/notifications/subscribers.py b/mpt_api_client/resources/notifications/subscribers.py index c6b7df29..ddc8b599 100644 --- a/mpt_api_client/resources/notifications/subscribers.py +++ b/mpt_api_client/resources/notifications/subscribers.py @@ -2,9 +2,11 @@ from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, + AsyncGetMixin, AsyncUpdateMixin, CreateMixin, DeleteMixin, + GetMixin, UpdateMixin, ) from mpt_api_client.models import Model @@ -25,6 +27,7 @@ class SubscribersServiceConfig: class SubscribersService( # noqa: WPS215 CreateMixin[Subscriber], UpdateMixin[Subscriber], + GetMixin[Subscriber], DeleteMixin, Service[Subscriber], SubscribersServiceConfig, @@ -35,6 +38,7 @@ class SubscribersService( # noqa: WPS215 class AsyncSubscribersService( # noqa: WPS215 AsyncCreateMixin[Subscriber], AsyncUpdateMixin[Subscriber], + AsyncGetMixin[Subscriber], AsyncDeleteMixin, AsyncService[Subscriber], SubscribersServiceConfig, diff --git a/tests/http/conftest.py b/tests/http/conftest.py index 624d14cf..1ed1aa62 100644 --- a/tests/http/conftest.py +++ b/tests/http/conftest.py @@ -3,14 +3,19 @@ from mpt_api_client import RQLQuery from mpt_api_client.http import ( + AsyncService, + Service, +) +from mpt_api_client.http.mixins import ( AsyncCreateMixin, AsyncDeleteMixin, - AsyncService, + AsyncGetMixin, + AsyncUpdateMixin, CreateMixin, DeleteMixin, - Service, + GetMixin, + UpdateMixin, ) -from mpt_api_client.http.mixins import AsyncUpdateMixin, UpdateMixin from tests.conftest import DummyModel @@ -18,6 +23,7 @@ class DummyService( # noqa: WPS215 CreateMixin[DummyModel], DeleteMixin, UpdateMixin[DummyModel], + GetMixin[DummyModel], Service[DummyModel], ): _endpoint = "/api/v1/test" @@ -28,6 +34,7 @@ class AsyncDummyService( # noqa: WPS215 AsyncCreateMixin[DummyModel], AsyncDeleteMixin, AsyncUpdateMixin[DummyModel], + AsyncGetMixin[DummyModel], AsyncService[DummyModel], ): _endpoint = "/api/v1/test" diff --git a/tests/http/test_async_service.py b/tests/http/test_async_service.py index 866dcb13..34bd6d06 100644 --- a/tests/http/test_async_service.py +++ b/tests/http/test_async_service.py @@ -3,7 +3,6 @@ import respx from mpt_api_client.exceptions import MPTAPIError -from tests.conftest import DummyModel from tests.http.conftest import AsyncDummyService @@ -243,22 +242,6 @@ async def test_async_iterate_lazy_evaluation(async_dummy_service): assert mock_route.call_count == 1 -async def test_async_get(async_dummy_service): - resource_data = {"id": "RES-123", "name": "Test Resource"} - with respx.mock: - mock_route = respx.get( - "https://api.example.com/api/v1/test/RES-123", params={"select": "id,name"} - ).mock(return_value=httpx.Response(httpx.codes.OK, json=resource_data)) - - resource = await async_dummy_service.get("RES-123", select=["id", "name"]) - - request = mock_route.calls[0].request - accept_header = (b"Accept", b"application/json") - assert accept_header in request.headers.raw - assert isinstance(resource, DummyModel) - assert resource.to_dict() == resource_data - - async def test_sync_iterate_handles_api_errors(async_dummy_service): with respx.mock: respx.get("https://api.example.com/api/v1/test").mock( diff --git a/tests/http/test_mixins.py b/tests/http/test_mixins.py index 11c503a4..1df1e5df 100644 --- a/tests/http/test_mixins.py +++ b/tests/http/test_mixins.py @@ -284,3 +284,34 @@ def test_sync_file_create_no_data(media_service): b"Image content\r\n" in request.content ) assert new_media.to_dict() == media_data + + +def test_sync_get_mixin(dummy_service): + """Test GetMixin get method.""" + resource_data = {"id": "RES-123", "name": "Test Resource"} + with respx.mock: + mock_route = respx.get( + "https://api.example.com/api/v1/test/RES-123", params={"select": "id,name"} + ).mock(return_value=httpx.Response(httpx.codes.OK, json=resource_data)) + + resource = dummy_service.get("RES-123", select=["id", "name"]) + + request = mock_route.calls[0].request + accept_header = (b"Accept", b"application/json") + assert accept_header in request.headers.raw + assert resource.to_dict() == resource_data + + +async def test_async_get(async_dummy_service): + resource_data = {"id": "RES-123", "name": "Test Resource"} + with respx.mock: + mock_route = respx.get( + "https://api.example.com/api/v1/test/RES-123", params={"select": "id,name"} + ).mock(return_value=httpx.Response(httpx.codes.OK, json=resource_data)) + + resource = await async_dummy_service.get("RES-123", select=["id", "name"]) + + request = mock_route.calls[0].request + accept_header = (b"Accept", b"application/json") + assert accept_header in request.headers.raw + assert resource.to_dict() == resource_data diff --git a/tests/resources/billing/test_invoices.py b/tests/resources/billing/test_invoices.py index 600b4d7f..1ffbc8d5 100644 --- a/tests/resources/billing/test_invoices.py +++ b/tests/resources/billing/test_invoices.py @@ -24,7 +24,7 @@ def async_invoices_service(async_http_client): "method", ["get", "create", "update"], ) -def test_mixins_present(invoices_service, method): +def test_methods_present(invoices_service, method): assert hasattr(invoices_service, method) @@ -32,7 +32,7 @@ def test_mixins_present(invoices_service, method): "method", ["get", "create", "update"], ) -def test_async_mixins_present(async_invoices_service, method): +def test_async_methods_present(async_invoices_service, method): assert hasattr(async_invoices_service, method) diff --git a/tests/resources/commerce/test_subscriptions.py b/tests/resources/commerce/test_subscriptions.py index 73519011..c4c73030 100644 --- a/tests/resources/commerce/test_subscriptions.py +++ b/tests/resources/commerce/test_subscriptions.py @@ -18,6 +18,16 @@ def async_subscriptions_service(async_http_client): return AsyncSubscriptionsService(http_client=async_http_client) +@pytest.mark.parametrize("method", ["get", "create", "delete"]) +def test_methods_present(subscriptions_service, method): + assert hasattr(subscriptions_service, method) + + +@pytest.mark.parametrize("method", ["get", "create", "delete"]) +def test_async_methods_present(async_subscriptions_service, method): + assert hasattr(async_subscriptions_service, method) + + async def test_async_terminate(async_subscriptions_service): subscription_expected = {"id": "SUB-123", "status": "Terminated", "name": "Terminated SUB-123"} with respx.mock: diff --git a/tests/resources/notifications/test_accounts.py b/tests/resources/notifications/test_accounts.py index dff8ab58..f71238c2 100644 --- a/tests/resources/notifications/test_accounts.py +++ b/tests/resources/notifications/test_accounts.py @@ -3,7 +3,6 @@ from mpt_api_client.resources.notifications.accounts import ( AccountsService, AsyncAccountsService, - MethodNotAllowedError, ) @@ -15,14 +14,3 @@ def accounts_service(http_client): @pytest.fixture def async_accounts_service(async_http_client): return AsyncAccountsService(http_client=async_http_client) - - -def test_accounts_service_get_raises(accounts_service): - with pytest.raises(MethodNotAllowedError): - accounts_service.get("CONTACT-123") - - -@pytest.mark.asyncio -async def test_async_accounts_service_get_raises(async_accounts_service): - with pytest.raises(MethodNotAllowedError): - await async_accounts_service.get("CONTACT-123")