Skip to content

Commit de0e1f0

Browse files
committed
add delivery search/products list
1 parent 3ccf12a commit de0e1f0

10 files changed

Lines changed: 22014 additions & 138 deletions

chizhik_api/endpoints/catalog.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,26 @@ async def products_list(
8484
url += f"&term={urllib.parse.quote(search)}"
8585
return await self._parent._request(HttpMethod.GET, url)
8686

87-
async def products_list_v2():
88-
url = "https://app.chizhik.club/delivery/api/catalog/v2/stores/HB55/categories/264C39153/products?mode=store&include_restrict=true&limit=499&offset=0"
87+
@autotest
88+
async def delivery_products_list(self,
89+
store_id: str,
90+
category_alias: str,
91+
offset: int = 0,
92+
limit: int = 499,
93+
mode: DeliveryMode = DeliveryMode.STORE,
94+
include_restrict: bool = True):
95+
url = f"{self._parent.DELIVERY_API_URL}/catalog/v2/stores/{store_id}/categories/{category_alias}/products?mode={mode}&include_restrict={str(include_restrict).lower()}&limit={limit}&offset={offset}"
96+
return await self._parent._request(HttpMethod.GET, url)
97+
98+
@autotest
99+
async def delivery_search(self,
100+
store_id: str,
101+
query: str,
102+
limit: int = 12,
103+
mode: DeliveryMode = DeliveryMode.STORE,
104+
include_restrict: bool = True):
105+
url = f"{self._parent.DELIVERY_API_URL}/catalog/v3/stores/{store_id}/search?mode={mode}&include_restrict={str(include_restrict).lower()}&q={query}&limit={limit}"
106+
return await self._parent._request(HttpMethod.GET, url)
89107

90108
class ProductService(ApiChild["ChizhikAPI"]):
91109
"""Сервис для работы с товарами в каталоге."""

0 commit comments

Comments
 (0)