88)
99from mpt_api_client .http .mixins import AsyncUpdateMixin , UpdateMixin
1010from mpt_api_client .models import Model , ResourceData
11+ from mpt_api_client .resources .commerce .orders_subscription import (
12+ AsyncOrderSubscriptionsService ,
13+ OrderSubscriptionsService ,
14+ )
1115
1216
1317class Order (Model ):
@@ -22,7 +26,7 @@ class OrdersServiceConfig:
2226 _collection_key = "data"
2327
2428
25- class OrdersService ( # noqa: WPS215
29+ class OrdersService ( # noqa: WPS215 WPS214
2630 CreateMixin [Order ],
2731 DeleteMixin ,
2832 UpdateMixin [Order ],
@@ -97,8 +101,22 @@ def template(self, resource_id: str) -> str:
97101 response = self ._resource_do_request (resource_id , "GET" , "template" )
98102 return response .text
99103
104+ def subscriptions (self , order_id : str ) -> OrderSubscriptionsService :
105+ """Get the subscription service for the given Order id.
106+
107+ Args:
108+ order_id: Order ID.
109+
110+ Returns:
111+ Order Subscription service.
112+ """
113+ return OrderSubscriptionsService (
114+ http_client = self .http_client ,
115+ endpoint_params = {"order_id" : order_id },
116+ )
117+
100118
101- class AsyncOrdersService ( # noqa: WPS215
119+ class AsyncOrdersService ( # noqa: WPS215 WPS214
102120 AsyncCreateMixin [Order ],
103121 AsyncDeleteMixin ,
104122 AsyncUpdateMixin [Order ],
@@ -187,3 +205,17 @@ async def template(self, resource_id: str) -> str:
187205 """
188206 response = await self ._resource_do_request (resource_id , "GET" , "template" )
189207 return response .text
208+
209+ def subscriptions (self , order_id : str ) -> AsyncOrderSubscriptionsService :
210+ """Get the subscription service for the given Order id.
211+
212+ Args:
213+ order_id: Order ID.
214+
215+ Returns:
216+ Order Subscription service.
217+ """
218+ return AsyncOrderSubscriptionsService (
219+ http_client = self .http_client ,
220+ endpoint_params = {"order_id" : order_id },
221+ )
0 commit comments