-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsellers.py
More file actions
63 lines (50 loc) · 1.68 KB
/
sellers.py
File metadata and controls
63 lines (50 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from mpt_api_client.http import AsyncService, Service
from mpt_api_client.http.mixins import (
AsyncCollectionMixin,
AsyncManagedResourceMixin,
CollectionMixin,
ManagedResourceMixin,
)
from mpt_api_client.models import Model
from mpt_api_client.models.model import ResourceData
from mpt_api_client.resources.accounts.mixins import (
ActivatableMixin,
AsyncActivatableMixin,
)
class Seller(Model):
"""Seller Model."""
class SellersServiceConfig:
"""Sellers Service Configuration."""
_endpoint = "/public/v1/accounts/sellers"
_model_class = Seller
_collection_key = "data"
class SellersService(
ActivatableMixin[Seller],
ManagedResourceMixin[Seller],
CollectionMixin[Seller],
Service[Seller],
SellersServiceConfig,
):
"""Sellers Service."""
def disable(self, resource_id: str, resource_data: ResourceData | None = None) -> Seller:
"""Disable a seller.
Args:
resource_id: Resource ID
resource_data: Resource data will be updated
"""
return self._resource_action(resource_id, "POST", "disable", json=resource_data)
class AsyncSellersService(
AsyncActivatableMixin[Seller],
AsyncManagedResourceMixin[Seller],
AsyncCollectionMixin[Seller],
AsyncService[Seller],
SellersServiceConfig,
):
"""Async Sellers Service."""
async def disable(self, resource_id: str, resource_data: ResourceData | None = None) -> Seller:
"""Disable a seller.
Args:
resource_id: Resource ID
resource_data: Resource data will be updated
"""
return await self._resource_action(resource_id, "POST", "disable", json=resource_data)