-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcatalog.py
More file actions
92 lines (74 loc) · 3.07 KB
/
catalog.py
File metadata and controls
92 lines (74 loc) · 3.07 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from mpt_api_client.http import AsyncHTTPClient, HTTPClient
from mpt_api_client.resources.catalog.authorizations import (
AsyncAuthorizationsService,
AuthorizationsService,
)
from mpt_api_client.resources.catalog.items import AsyncItemsService, ItemsService
from mpt_api_client.resources.catalog.listings import AsyncListingsService, ListingsService
from mpt_api_client.resources.catalog.price_list_items import (
AsyncPriceListItemsService,
PriceListItemsService,
)
from mpt_api_client.resources.catalog.price_lists import (
AsyncPriceListsService,
PriceListsService,
)
from mpt_api_client.resources.catalog.products import AsyncProductsService, ProductsService
class Catalog:
"""Catalog MPT API Module."""
def __init__(self, *, http_client: HTTPClient):
self.http_client = http_client
@property
def authorizations(self) -> AuthorizationsService:
"""Authorizations service."""
return AuthorizationsService(http_client=self.http_client)
def price_list_items(self, price_list_id: str) -> PriceListItemsService:
"""Price List Items service."""
return PriceListItemsService(
http_client=self.http_client, endpoint_params={"price_list_id": price_list_id}
)
@property
def price_lists(self) -> PriceListsService:
"""Price Lists service."""
return PriceListsService(http_client=self.http_client)
@property
def listings(self) -> ListingsService:
"""Listings service."""
return ListingsService(http_client=self.http_client)
@property
def products(self) -> ProductsService:
"""Products service."""
return ProductsService(http_client=self.http_client)
@property
def items(self) -> ItemsService: # noqa: WPS110
"""Items service."""
return ItemsService(http_client=self.http_client)
class AsyncCatalog:
"""Catalog MPT API Module."""
def __init__(self, *, http_client: AsyncHTTPClient):
self.http_client = http_client
@property
def authorizations(self) -> AsyncAuthorizationsService:
"""Authorizations service."""
return AsyncAuthorizationsService(http_client=self.http_client)
def price_list_items(self, price_list_id: str) -> AsyncPriceListItemsService:
"""Price List Items service."""
return AsyncPriceListItemsService(
http_client=self.http_client, endpoint_params={"price_list_id": price_list_id}
)
@property
def price_lists(self) -> AsyncPriceListsService:
"""Price Lists service."""
return AsyncPriceListsService(http_client=self.http_client)
@property
def listings(self) -> AsyncListingsService:
"""Listings service."""
return AsyncListingsService(http_client=self.http_client)
@property
def products(self) -> AsyncProductsService:
"""Products service."""
return AsyncProductsService(http_client=self.http_client)
@property
def items(self) -> AsyncItemsService: # noqa: WPS110
"""Items service."""
return AsyncItemsService(http_client=self.http_client)