vtexpy 0.0.0b39__py3-none-any.whl → 0.0.0b40__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vtex/_api/__init__.py +1 -1
- vtex/_api/search.py +29 -0
- vtex/_vtex.py +7 -7
- {vtexpy-0.0.0b39.dist-info → vtexpy-0.0.0b40.dist-info}/METADATA +1 -1
- {vtexpy-0.0.0b39.dist-info → vtexpy-0.0.0b40.dist-info}/RECORD +7 -7
- vtex/_api/intelligent_search.py +0 -68
- {vtexpy-0.0.0b39.dist-info → vtexpy-0.0.0b40.dist-info}/WHEEL +0 -0
- {vtexpy-0.0.0b39.dist-info → vtexpy-0.0.0b40.dist-info}/licenses/LICENSE +0 -0
vtex/_api/__init__.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from .catalog import CatalogAPI
|
|
2
2
|
from .checkout import CheckoutAPI
|
|
3
3
|
from .custom import CustomAPI
|
|
4
|
-
from .intelligent_search import IntelligentSearchAPI
|
|
5
4
|
from .license_manager import LicenseManagerAPI
|
|
6
5
|
from .logistics import LogisticsAPI
|
|
7
6
|
from .master_data import MasterDataAPI
|
|
@@ -9,3 +8,4 @@ from .orders import OrdersAPI
|
|
|
9
8
|
from .payments_gateway import PaymentsGatewayAPI
|
|
10
9
|
from .pricing import PricingAPI
|
|
11
10
|
from .promotions_and_taxes import PromotionsAndTaxesAPI
|
|
11
|
+
from .search import SearchAPI
|
vtex/_api/search.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from typing import Any, Union
|
|
2
|
+
|
|
3
|
+
from .._dto import VTEXDataResponse
|
|
4
|
+
from .base import BaseAPI
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SearchAPI(BaseAPI):
|
|
8
|
+
"""
|
|
9
|
+
Client for the Search API.
|
|
10
|
+
https://developers.vtex.com/docs/api-reference/search-api
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
ENVIRONMENT = "vtexcommercestable"
|
|
14
|
+
|
|
15
|
+
def search_sku_offers(
|
|
16
|
+
self,
|
|
17
|
+
product_id: Union[int, str],
|
|
18
|
+
sku_id: Union[int, str],
|
|
19
|
+
**kwargs: Any,
|
|
20
|
+
) -> VTEXDataResponse[Any]:
|
|
21
|
+
return self._request(
|
|
22
|
+
method="GET",
|
|
23
|
+
endpoint=(
|
|
24
|
+
f"/api/catalog_system/pub/products/offers/{product_id}/sku/{sku_id}"
|
|
25
|
+
),
|
|
26
|
+
environment=self.ENVIRONMENT,
|
|
27
|
+
config=self.client.config.with_overrides(**kwargs),
|
|
28
|
+
response_class=VTEXDataResponse[Any],
|
|
29
|
+
)
|
vtex/_vtex.py
CHANGED
|
@@ -9,7 +9,6 @@ if TYPE_CHECKING:
|
|
|
9
9
|
CatalogAPI,
|
|
10
10
|
CheckoutAPI,
|
|
11
11
|
CustomAPI,
|
|
12
|
-
IntelligentSearchAPI,
|
|
13
12
|
LicenseManagerAPI,
|
|
14
13
|
LogisticsAPI,
|
|
15
14
|
MasterDataAPI,
|
|
@@ -17,6 +16,7 @@ if TYPE_CHECKING:
|
|
|
17
16
|
PaymentsGatewayAPI,
|
|
18
17
|
PricingAPI,
|
|
19
18
|
PromotionsAndTaxesAPI,
|
|
19
|
+
SearchAPI,
|
|
20
20
|
)
|
|
21
21
|
|
|
22
22
|
|
|
@@ -54,12 +54,6 @@ class VTEX:
|
|
|
54
54
|
|
|
55
55
|
return CheckoutAPI(client=self)
|
|
56
56
|
|
|
57
|
-
@cached_property
|
|
58
|
-
def intelligent_search(self) -> "IntelligentSearchAPI":
|
|
59
|
-
from ._api import IntelligentSearchAPI
|
|
60
|
-
|
|
61
|
-
return IntelligentSearchAPI(client=self)
|
|
62
|
-
|
|
63
57
|
@cached_property
|
|
64
58
|
def license_manager(self) -> "LicenseManagerAPI":
|
|
65
59
|
from ._api import LicenseManagerAPI
|
|
@@ -101,3 +95,9 @@ class VTEX:
|
|
|
101
95
|
from ._api import PromotionsAndTaxesAPI
|
|
102
96
|
|
|
103
97
|
return PromotionsAndTaxesAPI(client=self)
|
|
98
|
+
|
|
99
|
+
@cached_property
|
|
100
|
+
def search(self) -> "SearchAPI":
|
|
101
|
+
from ._api import SearchAPI
|
|
102
|
+
|
|
103
|
+
return SearchAPI(client=self)
|
|
@@ -7,14 +7,13 @@ vtex/_logging.py,sha256=zahPJIk10YvNs6qoNqhUy7OoDG7dr634CPwiGjT0aEk,2246
|
|
|
7
7
|
vtex/_sentinels.py,sha256=HLkYBJVHTx9GoyACPO1SuINaGlU2YiqOPuFXUa7iG8A,1120
|
|
8
8
|
vtex/_types.py,sha256=xrqHzmrc0IhE5fc1aGf0StCm3BQbVFyk3LG4Hd7Wd2Q,631
|
|
9
9
|
vtex/_utils.py,sha256=GHNxlqBs73KXHN8Aejh7dT9dhFLhBk13EN-9nIEaimk,3413
|
|
10
|
-
vtex/_vtex.py,sha256=
|
|
10
|
+
vtex/_vtex.py,sha256=HyA5qEzzXNn8LqyI2BFL2OODBN6XLtKqqXRCknIMYUA,2495
|
|
11
11
|
vtex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
vtex/_api/__init__.py,sha256=
|
|
12
|
+
vtex/_api/__init__.py,sha256=If5RrL74DVKisrllDNjMDrf-hGsgBe7uHu8xxXh1EnY,415
|
|
13
13
|
vtex/_api/base.py,sha256=Pjww58gnM31C7Oo0AC_TNOcqLM8mSmfk2kQfnVyaQnQ,7079
|
|
14
14
|
vtex/_api/catalog.py,sha256=vfUHWd6lbRyivszzgIIexJB-bt2mpBLZLfQZAJAcngg,4667
|
|
15
15
|
vtex/_api/checkout.py,sha256=ViFJq2GZRAA6yyjaFC3rz0oMYKxzBIsi8tzGKCWRxQ0,1693
|
|
16
16
|
vtex/_api/custom.py,sha256=3yIwTj1Ikf30oq0GzdNz0P9APYxjBeoRvdlbh0rT9gs,2930
|
|
17
|
-
vtex/_api/intelligent_search.py,sha256=28BbxveOyd-7xaQ_ynxBSNX1H5t9fsOvxnBPllE-OB8,2596
|
|
18
17
|
vtex/_api/license_manager.py,sha256=GAdRpizeGUFem-up-SYNzehs5uBY0elTElJ9bEQUlFo,2805
|
|
19
18
|
vtex/_api/logistics.py,sha256=bd55wipbnql3OFnDCBsjP0-jp7OY6FP10Yz5acOsG2o,5052
|
|
20
19
|
vtex/_api/master_data.py,sha256=HGoWr908iQYb0kzq_KNvKyWKtaNQ9vTv7CXxvKey0AM,2046
|
|
@@ -22,11 +21,12 @@ vtex/_api/orders.py,sha256=XvT40L9_MDzzxGS45TOuqGLjk7HiPhUIp7aSs30GPmI,5161
|
|
|
22
21
|
vtex/_api/payments_gateway.py,sha256=GbSsCUtYjzp0oL6reKjkG_F7TZCPN86xmbd8GX2C2U0,3804
|
|
23
22
|
vtex/_api/pricing.py,sha256=gZX9MmUKsj0iPjJKT2-Ko9dzT6rZR_DR4ruqs1c9IdY,535
|
|
24
23
|
vtex/_api/promotions_and_taxes.py,sha256=wtNxTrc36u10AMbOq2NMtOVp1HLzrBWxqJDmBYpdXXY,1893
|
|
24
|
+
vtex/_api/search.py,sha256=6PCe0lLqPgx8azk2zsV_D9kbmLF8OjQBD7giooADzAE,782
|
|
25
25
|
vtex/_api/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
26
|
vtex/_api/types/catalog.py,sha256=O_qLoiGMyBxRdmxPclbbPobUxJSzViqzHiKf8tgfm_I,394
|
|
27
27
|
vtex/_api/types/generic.py,sha256=m1lFTPeyBNi-K0shvK4uxE5SUyvhTTX_5Ls2VockkdI,344
|
|
28
28
|
vtex/_api/types/license_manager.py,sha256=KYISnKdQ548g6x5cNieoaN6gh9C1LQVFv4sH-II1maI,1015
|
|
29
|
-
vtexpy-0.0.
|
|
30
|
-
vtexpy-0.0.
|
|
31
|
-
vtexpy-0.0.
|
|
32
|
-
vtexpy-0.0.
|
|
29
|
+
vtexpy-0.0.0b40.dist-info/METADATA,sha256=5-zfDw5rmSpxX58rzKO_MDlazaaJQEkdPmM8U4cErOY,3408
|
|
30
|
+
vtexpy-0.0.0b40.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
31
|
+
vtexpy-0.0.0b40.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
32
|
+
vtexpy-0.0.0b40.dist-info/RECORD,,
|
vtex/_api/intelligent_search.py
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
from typing import Any, Literal, Union
|
|
2
|
-
|
|
3
|
-
from .._constants import (
|
|
4
|
-
INTELLIGENT_PRODUCT_SEARCH_MAX_PAGE_SIZE,
|
|
5
|
-
INTELLIGENT_PRODUCT_SEARCH_START_PAGE,
|
|
6
|
-
MIN_PAGE_SIZE,
|
|
7
|
-
)
|
|
8
|
-
from .._dto import VTEXPaginatedItemsResponse
|
|
9
|
-
from .._sentinels import UNDEFINED, UndefinedSentinel
|
|
10
|
-
from .._types import OrderingDirectionType
|
|
11
|
-
from .._utils import omitting_undefined
|
|
12
|
-
from .base import BaseAPI
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class IntelligentSearchAPI(BaseAPI):
|
|
16
|
-
"""
|
|
17
|
-
Client for the Intelligent Search API.
|
|
18
|
-
https://developers.vtex.com/docs/api-reference/intelligent-search-api
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
ENVIRONMENT = "vtexcommercestable"
|
|
22
|
-
|
|
23
|
-
def search_products(
|
|
24
|
-
self,
|
|
25
|
-
product_ids: Union[list[str], UndefinedSentinel] = UNDEFINED,
|
|
26
|
-
sku_ids: Union[list[str], UndefinedSentinel] = UNDEFINED,
|
|
27
|
-
simulation_behavior: str = "skip",
|
|
28
|
-
show_sponsored: bool = True,
|
|
29
|
-
fuzzy: bool = True,
|
|
30
|
-
operator: Literal["and", "or"] = "and",
|
|
31
|
-
order_by_field: str = "release",
|
|
32
|
-
order_by_direction: OrderingDirectionType = "desc",
|
|
33
|
-
page: int = INTELLIGENT_PRODUCT_SEARCH_START_PAGE,
|
|
34
|
-
page_size: int = INTELLIGENT_PRODUCT_SEARCH_MAX_PAGE_SIZE,
|
|
35
|
-
**kwargs: Any,
|
|
36
|
-
) -> VTEXPaginatedItemsResponse[Any, Any]:
|
|
37
|
-
"""
|
|
38
|
-
Search for products in the catalog.
|
|
39
|
-
"""
|
|
40
|
-
if product_ids and sku_ids:
|
|
41
|
-
raise ValueError("You can only search by product IDs or SKU IDs, not both.")
|
|
42
|
-
|
|
43
|
-
q: Union[str, UndefinedSentinel] = UNDEFINED
|
|
44
|
-
if isinstance(product_ids, list) and product_ids:
|
|
45
|
-
q = f"product.id:{';'.join([str(id) for id in product_ids])}"
|
|
46
|
-
elif isinstance(sku_ids, list) and sku_ids:
|
|
47
|
-
q = f"sku.id:{';'.join([str(id) for id in sku_ids])}"
|
|
48
|
-
|
|
49
|
-
return self._request(
|
|
50
|
-
method="GET",
|
|
51
|
-
endpoint="/api/io/_v/api/intelligent-search/product_search/",
|
|
52
|
-
environment=self.ENVIRONMENT,
|
|
53
|
-
params=omitting_undefined({
|
|
54
|
-
"q": q,
|
|
55
|
-
"simulationBehavior": simulation_behavior,
|
|
56
|
-
"showSponsored": show_sponsored,
|
|
57
|
-
"fuzzy": fuzzy,
|
|
58
|
-
"operator": operator,
|
|
59
|
-
"sort": f"{order_by_field}:{order_by_direction}",
|
|
60
|
-
"page": max(page, INTELLIGENT_PRODUCT_SEARCH_START_PAGE),
|
|
61
|
-
"count": max(
|
|
62
|
-
min(page_size, INTELLIGENT_PRODUCT_SEARCH_MAX_PAGE_SIZE),
|
|
63
|
-
MIN_PAGE_SIZE,
|
|
64
|
-
),
|
|
65
|
-
}),
|
|
66
|
-
config=self.client.config.with_overrides(**kwargs),
|
|
67
|
-
response_class=VTEXPaginatedItemsResponse[Any, Any],
|
|
68
|
-
)
|
|
File without changes
|
|
File without changes
|