vtexpy 0.0.0b10__py3-none-any.whl → 0.0.0b12__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/__init__.py CHANGED
@@ -1,10 +1,10 @@
1
1
  from . import _constants as VTEXConstants # noqa: N812
2
2
  from ._dto import (
3
3
  VTEXCartItem,
4
- VTEXListResponse,
5
- VTEXPaginatedListResponse,
4
+ VTEXDataResponse,
5
+ VTEXItemsResponse,
6
+ VTEXPaginatedItemsResponse,
6
7
  VTEXResponse,
7
- VTEXScrollListResponse,
8
8
  )
9
9
  from ._exceptions import VTEXError, VTEXRequestError, VTEXResponseError
10
10
  from ._vtex import VTEX
@@ -14,12 +14,12 @@ __all__ = [
14
14
  "VTEXCartItem",
15
15
  "VTEXConstants",
16
16
  "VTEXError",
17
- "VTEXListResponse",
18
- "VTEXPaginatedListResponse",
17
+ "VTEXDataResponse",
18
+ "VTEXItemsResponse",
19
+ "VTEXPaginatedItemsResponse",
19
20
  "VTEXRequestError",
20
21
  "VTEXResponse",
21
22
  "VTEXResponseError",
22
- "VTEXScrollListResponse",
23
23
  ]
24
24
 
25
25
 
vtex/_api/base.py CHANGED
@@ -28,7 +28,7 @@ from tenacity import (
28
28
 
29
29
  from .._config import Config # type: ignore[attr-defined]
30
30
  from .._constants import APP_KEY_HEADER, APP_TOKEN_HEADER
31
- from .._dto import VTEXResponse, VTEXResponseType
31
+ from .._dto import VTEXDataResponse, VTEXResponseType
32
32
  from .._exceptions import VTEXRequestError, VTEXResponseError
33
33
  from .._logging import get_logger, log_before_retry
34
34
  from .._types import HTTPMethodType
@@ -38,7 +38,7 @@ from .._vtex import VTEX
38
38
 
39
39
  class BaseAPI:
40
40
  """
41
- Base client for VTEX API.
41
+ Base client for a VTEX API.
42
42
  """
43
43
 
44
44
  def __init__(self, client: VTEX) -> None:
@@ -138,7 +138,7 @@ class BaseAPI:
138
138
 
139
139
  return cast(
140
140
  VTEXResponseType,
141
- (response_class or VTEXResponse).factory(response),
141
+ (response_class or VTEXDataResponse).factory(response),
142
142
  )
143
143
 
144
144
  def _raise_from_response(self, response: Response, config: Config) -> None:
vtex/_api/catalog.py CHANGED
@@ -1,6 +1,5 @@
1
- from typing import Any, Union
1
+ from typing import Any, List, Union
2
2
 
3
- from .. import VTEXPaginatedListResponse
4
3
  from .._constants import (
5
4
  GET_CATEGORY_TREE_MAX_LEVELS,
6
5
  LIST_CATEGORIES_MAX_PAGE_SIZE,
@@ -9,8 +8,9 @@ from .._constants import (
9
8
  LIST_SKU_IDS_START_PAGE,
10
9
  MIN_PAGE_SIZE,
11
10
  )
12
- from .._dto import VTEXListResponse, VTEXResponse
11
+ from .._dto import VTEXDataResponse, VTEXItemsResponse, VTEXPaginatedItemsResponse
13
12
  from .._sentinels import UNDEFINED, UndefinedSentinel
13
+ from .._types import DictType
14
14
  from .._utils import exclude_undefined_values
15
15
  from .base import BaseAPI
16
16
 
@@ -29,7 +29,7 @@ class CatalogAPI(BaseAPI):
29
29
  seller_type: Union[int, UndefinedSentinel] = UNDEFINED,
30
30
  is_better_scope: Union[bool, UndefinedSentinel] = UNDEFINED,
31
31
  **kwargs: Any,
32
- ) -> VTEXListResponse:
32
+ ) -> VTEXItemsResponse[DictType, DictType]:
33
33
  return self._request(
34
34
  method="GET",
35
35
  environment=self.ENVIRONMENT,
@@ -40,7 +40,7 @@ class CatalogAPI(BaseAPI):
40
40
  "isBetterScope": is_better_scope,
41
41
  }),
42
42
  config=self.client.config.with_overrides(**kwargs),
43
- response_class=VTEXListResponse,
43
+ response_class=VTEXItemsResponse[DictType, DictType],
44
44
  )
45
45
 
46
46
  def list_sku_ids(
@@ -48,7 +48,7 @@ class CatalogAPI(BaseAPI):
48
48
  page: int = LIST_SKU_IDS_START_PAGE,
49
49
  page_size: int = LIST_SKU_IDS_MAX_PAGE_SIZE,
50
50
  **kwargs: Any,
51
- ) -> VTEXListResponse:
51
+ ) -> VTEXItemsResponse[List[str], str]:
52
52
  return self._request(
53
53
  method="GET",
54
54
  environment=self.ENVIRONMENT,
@@ -61,16 +61,20 @@ class CatalogAPI(BaseAPI):
61
61
  ),
62
62
  },
63
63
  config=self.client.config.with_overrides(**kwargs),
64
- response_class=VTEXListResponse,
64
+ response_class=VTEXItemsResponse[List[str], str],
65
65
  )
66
66
 
67
- def get_sku_with_context(self, sku_id: int, **kwargs: Any) -> VTEXResponse:
67
+ def get_sku_with_context(
68
+ self,
69
+ sku_id: int,
70
+ **kwargs: Any,
71
+ ) -> VTEXDataResponse[DictType]:
68
72
  return self._request(
69
73
  method="GET",
70
74
  environment=self.ENVIRONMENT,
71
75
  endpoint=f"/api/catalog_system/pvt/sku/stockkeepingunitbyid/{sku_id}",
72
76
  config=self.client.config.with_overrides(**kwargs),
73
- response_class=VTEXResponse,
77
+ response_class=VTEXDataResponse[DictType],
74
78
  )
75
79
 
76
80
  def list_categories(
@@ -78,7 +82,7 @@ class CatalogAPI(BaseAPI):
78
82
  page: int = LIST_SKU_IDS_START_PAGE,
79
83
  page_size: int = LIST_SKU_IDS_MAX_PAGE_SIZE,
80
84
  **kwargs: Any,
81
- ) -> VTEXPaginatedListResponse:
85
+ ) -> VTEXPaginatedItemsResponse[DictType, DictType]:
82
86
  return self._request(
83
87
  method="GET",
84
88
  environment=self.ENVIRONMENT,
@@ -91,27 +95,31 @@ class CatalogAPI(BaseAPI):
91
95
  ),
92
96
  },
93
97
  config=self.client.config.with_overrides(**kwargs),
94
- response_class=VTEXPaginatedListResponse,
98
+ response_class=VTEXPaginatedItemsResponse[DictType, DictType],
95
99
  )
96
100
 
97
101
  def get_category_tree(
98
102
  self,
99
103
  levels: int = GET_CATEGORY_TREE_MAX_LEVELS,
100
104
  **kwargs: Any,
101
- ) -> VTEXResponse:
105
+ ) -> VTEXDataResponse[DictType]:
102
106
  return self._request(
103
107
  method="GET",
104
108
  environment=self.ENVIRONMENT,
105
109
  endpoint=f"/api/catalog_system/pub/category/tree/{levels}",
106
110
  config=self.client.config.with_overrides(**kwargs),
107
- response_class=VTEXResponse,
111
+ response_class=VTEXDataResponse[DictType],
108
112
  )
109
113
 
110
- def get_category(self, category_id: str, **kwargs: Any) -> VTEXResponse:
114
+ def get_category(
115
+ self,
116
+ category_id: str,
117
+ **kwargs: Any,
118
+ ) -> VTEXDataResponse[DictType]:
111
119
  return self._request(
112
120
  method="GET",
113
121
  environment=self.ENVIRONMENT,
114
122
  endpoint=f"/api/catalog/pvt/category/{category_id}",
115
123
  config=self.client.config.with_overrides(**kwargs),
116
- response_class=VTEXResponse,
124
+ response_class=VTEXDataResponse[DictType],
117
125
  )
vtex/_api/checkout.py CHANGED
@@ -1,7 +1,8 @@
1
1
  from typing import Any, List, Union
2
2
 
3
- from .._dto import VTEXCartItem, VTEXResponse
3
+ from .._dto import VTEXCartItem, VTEXDataResponse
4
4
  from .._sentinels import UNDEFINED, UndefinedSentinel
5
+ from .._types import DictType
5
6
  from .._utils import exclude_undefined_values
6
7
  from .base import BaseAPI
7
8
 
@@ -14,7 +15,7 @@ class CheckoutAPI(BaseAPI):
14
15
 
15
16
  ENVIRONMENT = "vtexcommercestable"
16
17
 
17
- def cart_simulation(
18
+ def run_cart_simulation(
18
19
  self,
19
20
  cart: List[VTEXCartItem],
20
21
  country: Union[str, UndefinedSentinel] = UNDEFINED,
@@ -24,7 +25,7 @@ class CheckoutAPI(BaseAPI):
24
25
  sales_channel: Union[int, UndefinedSentinel] = UNDEFINED,
25
26
  individual_shipping_estimates: Union[bool, UndefinedSentinel] = UNDEFINED,
26
27
  **kwargs: Any,
27
- ) -> VTEXResponse:
28
+ ) -> VTEXDataResponse[DictType]:
28
29
  return self._request(
29
30
  method="POST",
30
31
  environment=self.ENVIRONMENT,
@@ -41,5 +42,5 @@ class CheckoutAPI(BaseAPI):
41
42
  "geoCoordinates": geo_coordinates,
42
43
  }),
43
44
  config=self.client.config.with_overrides(**kwargs),
44
- response_class=VTEXResponse,
45
+ response_class=VTEXDataResponse[DictType],
45
46
  )
vtex/_api/custom.py CHANGED
@@ -60,19 +60,26 @@ class CustomAPI(BaseAPI):
60
60
  self.client.license_manager.get_account().data["creation_date"],
61
61
  )
62
62
 
63
+ def get_account_site_names(self) -> datetime:
64
+ return to_datetime(
65
+ self.client.license_manager.get_account().data["creation_date"],
66
+ )
67
+
63
68
  def get_main_seller(self) -> str:
64
69
  return "1"
65
70
 
66
- def get_market_place_sellers(self) -> List[str]:
71
+ def get_market_place_sellers(self, include_inactive: bool = False) -> List[str]:
67
72
  return [
68
73
  seller["seller_id"]
69
- for seller in self.client.catalog.list_sellers(seller_type=1).items
70
- if seller["seller_id"] != "1"
74
+ for seller in self.client.catalog.list_sellers().items
75
+ if seller["seller_type"] == 1
76
+ and seller["seller_id"] != "1"
77
+ and (seller["is_active"] or include_inactive)
71
78
  ]
72
79
 
73
- def get_franchise_sellers(self) -> List[str]:
80
+ def get_franchise_sellers(self, include_inactive: bool = False) -> List[str]:
74
81
  return [
75
82
  seller["seller_id"]
76
- for seller in
77
- self.client.catalog.list_sellers(seller_type=2).items
83
+ for seller in self.client.catalog.list_sellers().items
84
+ if seller["seller_type"] == 2 and (seller["is_active"] or include_inactive)
78
85
  ]
@@ -1,7 +1,8 @@
1
1
  from typing import Any
2
2
 
3
- from .._dto import VTEXResponse
3
+ from .._dto import VTEXDataResponse
4
4
  from .base import BaseAPI
5
+ from .types.license_manager import GetAccountData
5
6
 
6
7
 
7
8
  class LicenseManagerAPI(BaseAPI):
@@ -12,11 +13,11 @@ class LicenseManagerAPI(BaseAPI):
12
13
 
13
14
  ENVIRONMENT = "vtexcommercestable"
14
15
 
15
- def get_account(self, **kwargs: Any) -> VTEXResponse:
16
+ def get_account(self, **kwargs: Any) -> VTEXDataResponse[GetAccountData]:
16
17
  return self._request(
17
18
  method="GET",
18
19
  environment=self.ENVIRONMENT,
19
20
  endpoint="/api/vlm/account",
20
21
  config=self.client.config.with_overrides(**kwargs),
21
- response_class=VTEXResponse,
22
+ response_class=VTEXDataResponse[GetAccountData],
22
23
  )
vtex/_api/logistics.py CHANGED
@@ -9,7 +9,8 @@ from .._constants import (
9
9
  LIST_SHIPPING_POLICIES_START_PAGE,
10
10
  MIN_PAGE_SIZE,
11
11
  )
12
- from .._dto import VTEXPaginatedListResponse, VTEXResponse
12
+ from .._dto import VTEXDataResponse, VTEXPaginatedItemsResponse
13
+ from .._types import DictType
13
14
  from .base import BaseAPI
14
15
 
15
16
 
@@ -26,7 +27,7 @@ class LogisticsAPI(BaseAPI):
26
27
  page: int = LIST_SHIPPING_POLICIES_START_PAGE,
27
28
  page_size: int = LIST_SHIPPING_POLICIES_MAX_PAGE_SIZE,
28
29
  **kwargs: Any,
29
- ) -> VTEXPaginatedListResponse:
30
+ ) -> VTEXPaginatedItemsResponse[DictType, DictType]:
30
31
  return self._request(
31
32
  method="GET",
32
33
  environment=self.ENVIRONMENT,
@@ -39,20 +40,20 @@ class LogisticsAPI(BaseAPI):
39
40
  ),
40
41
  },
41
42
  config=self.client.config.with_overrides(**kwargs),
42
- response_class=VTEXPaginatedListResponse,
43
+ response_class=VTEXPaginatedItemsResponse[DictType, DictType],
43
44
  )
44
45
 
45
46
  def get_shipping_policy(
46
47
  self,
47
48
  shipping_policy_id: str,
48
49
  **kwargs: Any,
49
- ) -> VTEXResponse:
50
+ ) -> VTEXDataResponse[DictType]:
50
51
  return self._request(
51
52
  method="GET",
52
53
  environment=self.ENVIRONMENT,
53
54
  endpoint=f"/api/logistics/pvt/shipping-policies/{shipping_policy_id}",
54
55
  config=self.client.config.with_overrides(**kwargs),
55
- response_class=VTEXResponse,
56
+ response_class=VTEXDataResponse[DictType],
56
57
  )
57
58
 
58
59
  def list_carriers(
@@ -60,7 +61,7 @@ class LogisticsAPI(BaseAPI):
60
61
  page: int = LIST_CARRIERS_START_PAGE,
61
62
  page_size: int = LIST_CARRIERS_MAX_PAGE_SIZE,
62
63
  **kwargs: Any,
63
- ) -> VTEXPaginatedListResponse:
64
+ ) -> VTEXPaginatedItemsResponse[DictType, DictType]:
64
65
  return self._request(
65
66
  method="GET",
66
67
  environment=self.ENVIRONMENT,
@@ -73,20 +74,20 @@ class LogisticsAPI(BaseAPI):
73
74
  ),
74
75
  },
75
76
  config=self.client.config.with_overrides(**kwargs),
76
- response_class=VTEXPaginatedListResponse,
77
+ response_class=VTEXPaginatedItemsResponse[DictType, DictType],
77
78
  )
78
79
 
79
80
  def get_carrier(
80
81
  self,
81
82
  carrier_id: str,
82
83
  **kwargs: Any,
83
- ) -> VTEXResponse:
84
+ ) -> VTEXDataResponse[DictType]:
84
85
  return self._request(
85
86
  method="GET",
86
87
  environment=self.ENVIRONMENT,
87
88
  endpoint=f"/api/logistics/pvt/configuration/carriers/{carrier_id}",
88
89
  config=self.client.config.with_overrides(**kwargs),
89
- response_class=VTEXResponse,
90
+ response_class=VTEXDataResponse[DictType],
90
91
  )
91
92
 
92
93
  def list_docks(
@@ -94,7 +95,7 @@ class LogisticsAPI(BaseAPI):
94
95
  page: int = LIST_DOCKS_START_PAGE,
95
96
  page_size: int = LIST_DOCKS_MAX_PAGE_SIZE,
96
97
  **kwargs: Any,
97
- ) -> VTEXPaginatedListResponse:
98
+ ) -> VTEXPaginatedItemsResponse[DictType, DictType]:
98
99
  return self._request(
99
100
  method="GET",
100
101
  environment=self.ENVIRONMENT,
@@ -107,23 +108,27 @@ class LogisticsAPI(BaseAPI):
107
108
  ),
108
109
  },
109
110
  config=self.client.config.with_overrides(**kwargs),
110
- response_class=VTEXPaginatedListResponse,
111
+ response_class=VTEXPaginatedItemsResponse[DictType, DictType],
111
112
  )
112
113
 
113
- def get_dock(self, dock_id: str, **kwargs: Any) -> VTEXResponse:
114
+ def get_dock(self, dock_id: str, **kwargs: Any) -> VTEXDataResponse[DictType]:
114
115
  return self._request(
115
116
  method="GET",
116
117
  environment=self.ENVIRONMENT,
117
118
  endpoint=f"/api/logistics/pvt/configuration/docks/{dock_id}",
118
119
  config=self.client.config.with_overrides(**kwargs),
119
- response_class=VTEXResponse,
120
+ response_class=VTEXDataResponse[DictType],
120
121
  )
121
122
 
122
- def get_sku_inventories(self, sku_id: str, **kwargs: Any) -> VTEXResponse:
123
+ def get_sku_inventories(
124
+ self,
125
+ sku_id: str,
126
+ **kwargs: Any,
127
+ ) -> VTEXDataResponse[DictType]:
123
128
  return self._request(
124
129
  method="GET",
125
130
  environment=self.ENVIRONMENT,
126
131
  endpoint=f"/api/logistics/pvt/inventory/skus/{sku_id}",
127
132
  config=self.client.config.with_overrides(**kwargs),
128
- response_class=VTEXResponse,
133
+ response_class=VTEXDataResponse[DictType],
129
134
  )
vtex/_api/master_data.py CHANGED
@@ -1,13 +1,13 @@
1
- from typing import Any, Iterable, Union
1
+ from typing import Any, List, Union
2
2
 
3
3
  from .._constants import (
4
4
  MIN_PAGE_SIZE,
5
5
  SEARCH_DOCUMENTS_MAX_PAGE_SIZE,
6
6
  SEARCH_DOCUMENTS_START_PAGE,
7
7
  )
8
- from .._dto import VTEXPaginatedListResponse
8
+ from .._dto import VTEXPaginatedItemsResponse
9
9
  from .._sentinels import UNDEFINED, UndefinedSentinel
10
- from .._types import IterableType, OrderingDirectionType
10
+ from .._types import DictType, OrderingDirectionType
11
11
  from .._utils import exclude_undefined_values
12
12
  from .base import BaseAPI
13
13
 
@@ -20,17 +20,17 @@ class MasterDataAPI(BaseAPI):
20
20
 
21
21
  ENVIRONMENT = "vtexcommercestable"
22
22
 
23
- def search_documents(
23
+ def list_documents(
24
24
  self,
25
25
  entity_name: str,
26
26
  where: Union[str, UndefinedSentinel] = UNDEFINED,
27
- fields: Union[IterableType[str], str, UndefinedSentinel] = UNDEFINED,
27
+ fields: Union[List[str], str, UndefinedSentinel] = UNDEFINED,
28
28
  order_by_field: str = "id",
29
29
  order_by_direction: OrderingDirectionType = "DESC",
30
30
  page: int = SEARCH_DOCUMENTS_START_PAGE,
31
31
  page_size: int = SEARCH_DOCUMENTS_MAX_PAGE_SIZE,
32
32
  **kwargs: Any,
33
- ) -> VTEXPaginatedListResponse:
33
+ ) -> VTEXPaginatedItemsResponse[DictType, DictType]:
34
34
  params = {
35
35
  "_where": where,
36
36
  "_sort": f"{order_by_field} {order_by_direction.upper()}",
@@ -38,7 +38,7 @@ class MasterDataAPI(BaseAPI):
38
38
 
39
39
  if fields is UNDEFINED:
40
40
  params["_fields"] = "all"
41
- elif not isinstance(fields, str) and isinstance(fields, Iterable):
41
+ elif not isinstance(fields, str) and isinstance(fields, list):
42
42
  params["_fields"] = ",".join(fields)
43
43
  else:
44
44
  params["_fields"] = fields
@@ -58,5 +58,5 @@ class MasterDataAPI(BaseAPI):
58
58
  "REST-Range": f"resources={(page - 1) * page_size}-{page * page_size}",
59
59
  },
60
60
  config=self.client.config.with_overrides(**kwargs),
61
- response_class=VTEXPaginatedListResponse,
61
+ response_class=VTEXPaginatedItemsResponse[DictType, DictType],
62
62
  )
vtex/_api/orders.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from datetime import datetime, timedelta, timezone
2
- from typing import Any, Dict, Union
2
+ from typing import Any, Dict, List, Union
3
3
 
4
4
  from .._constants import (
5
5
  LIST_FEED_ORDERS_MAX_PAGE_SIZE,
@@ -8,9 +8,9 @@ from .._constants import (
8
8
  LIST_ORDERS_START_PAGE,
9
9
  MIN_PAGE_SIZE,
10
10
  )
11
- from .._dto import VTEXListResponse, VTEXPaginatedListResponse, VTEXResponse
11
+ from .._dto import VTEXDataResponse, VTEXItemsResponse, VTEXPaginatedItemsResponse
12
12
  from .._sentinels import UNDEFINED, UndefinedSentinel
13
- from .._types import IterableType, OrderingDirectionType
13
+ from .._types import DictType, OrderingDirectionType
14
14
  from .._utils import now, three_years_ago
15
15
  from .base import BaseAPI
16
16
 
@@ -35,7 +35,7 @@ class OrdersAPI(BaseAPI):
35
35
  page: int = LIST_ORDERS_START_PAGE,
36
36
  page_size: int = LIST_ORDERS_MAX_PAGE_SIZE,
37
37
  **kwargs: Any,
38
- ) -> VTEXPaginatedListResponse:
38
+ ) -> VTEXPaginatedItemsResponse[DictType, DictType]:
39
39
  if page > LIST_ORDERS_MAX_PAGE:
40
40
  raise ValueError("List Orders endpoint can only return up to page 30")
41
41
 
@@ -84,7 +84,7 @@ class OrdersAPI(BaseAPI):
84
84
  endpoint="/api/oms/pvt/orders/",
85
85
  params=params,
86
86
  config=self.client.config.with_overrides(**kwargs),
87
- response_class=VTEXPaginatedListResponse,
87
+ response_class=VTEXPaginatedItemsResponse[DictType, DictType],
88
88
  )
89
89
 
90
90
  pagination = response.pagination
@@ -93,20 +93,20 @@ class OrdersAPI(BaseAPI):
93
93
 
94
94
  return response
95
95
 
96
- def get_order(self, order_id: str, **kwargs: Any) -> VTEXResponse:
96
+ def get_order(self, order_id: str, **kwargs: Any) -> VTEXDataResponse[DictType]:
97
97
  return self._request(
98
98
  method="GET",
99
99
  environment=self.ENVIRONMENT,
100
100
  endpoint=f"/api/oms/pvt/orders/{order_id}",
101
101
  config=self.client.config.with_overrides(**kwargs),
102
- response_class=VTEXResponse,
102
+ response_class=VTEXDataResponse[DictType],
103
103
  )
104
104
 
105
105
  def list_feed_orders(
106
106
  self,
107
107
  page_size: int = LIST_FEED_ORDERS_MAX_PAGE_SIZE,
108
108
  **kwargs: Any,
109
- ) -> VTEXListResponse:
109
+ ) -> VTEXItemsResponse[DictType, DictType]:
110
110
  return self._request(
111
111
  method="GET",
112
112
  environment=self.ENVIRONMENT,
@@ -118,14 +118,14 @@ class OrdersAPI(BaseAPI):
118
118
  ),
119
119
  },
120
120
  config=self.client.config.with_overrides(**kwargs),
121
- response_class=VTEXListResponse,
121
+ response_class=VTEXItemsResponse[DictType, DictType],
122
122
  )
123
123
 
124
124
  def commit_feed_orders(
125
125
  self,
126
- handles: IterableType[str],
126
+ handles: List[str],
127
127
  **kwargs: Any,
128
- ) -> VTEXResponse:
128
+ ) -> VTEXDataResponse[DictType]:
129
129
  if not handles:
130
130
  raise ValueError(
131
131
  "At least one handle must be provided to commit to the feed"
@@ -142,5 +142,5 @@ class OrdersAPI(BaseAPI):
142
142
  endpoint="/api/orders/feed/",
143
143
  json={"handles": handles},
144
144
  config=self.client.config.with_overrides(**kwargs),
145
- response_class=VTEXResponse,
145
+ response_class=VTEXDataResponse[DictType],
146
146
  )
@@ -1,6 +1,7 @@
1
1
  from typing import Any
2
2
 
3
- from .._dto import VTEXListResponse, VTEXResponse
3
+ from .._dto import VTEXDataResponse, VTEXItemsResponse
4
+ from .._types import DictType
4
5
  from .base import BaseAPI
5
6
 
6
7
 
@@ -12,39 +13,43 @@ class PaymentsGatewayAPI(BaseAPI):
12
13
 
13
14
  ENVIRONMENT = "vtexpayments"
14
15
 
15
- def get_transaction(self, transaction_id: str, **kwargs: Any) -> VTEXResponse:
16
+ def get_transaction(
17
+ self,
18
+ transaction_id: str,
19
+ **kwargs: Any,
20
+ ) -> VTEXDataResponse[DictType]:
16
21
  return self._request(
17
22
  method="GET",
18
23
  environment=self.ENVIRONMENT,
19
24
  endpoint=f"/api/pvt/transactions/{transaction_id}",
20
25
  config=self.client.config.with_overrides(**kwargs),
21
- response_class=VTEXResponse,
26
+ response_class=VTEXDataResponse[DictType],
22
27
  )
23
28
 
24
29
  def list_transaction_interactions(
25
30
  self,
26
31
  transaction_id: str,
27
32
  **kwargs: Any,
28
- ) -> VTEXListResponse:
33
+ ) -> VTEXItemsResponse[DictType, DictType]:
29
34
  return self._request(
30
35
  method="GET",
31
36
  environment=self.ENVIRONMENT,
32
37
  endpoint=f"/api/pvt/transactions/{transaction_id}/interactions",
33
38
  config=self.client.config.with_overrides(**kwargs),
34
- response_class=VTEXListResponse,
39
+ response_class=VTEXItemsResponse[DictType, DictType],
35
40
  )
36
41
 
37
42
  def list_transaction_payments(
38
43
  self,
39
44
  transaction_id: str,
40
45
  **kwargs: Any,
41
- ) -> VTEXListResponse:
46
+ ) -> VTEXItemsResponse[DictType, DictType]:
42
47
  return self._request(
43
48
  method="GET",
44
49
  environment=self.ENVIRONMENT,
45
50
  endpoint=f"/api/pvt/transactions/{transaction_id}/payments",
46
51
  config=self.client.config.with_overrides(**kwargs),
47
- response_class=VTEXListResponse,
52
+ response_class=VTEXItemsResponse[DictType, DictType],
48
53
  )
49
54
 
50
55
  def get_transaction_payment(
@@ -52,63 +57,63 @@ class PaymentsGatewayAPI(BaseAPI):
52
57
  transaction_id: str,
53
58
  payment_id: str,
54
59
  **kwargs: Any,
55
- ) -> VTEXResponse:
60
+ ) -> VTEXDataResponse[DictType]:
56
61
  return self._request(
57
62
  method="GET",
58
63
  environment=self.ENVIRONMENT,
59
64
  endpoint=f"/api/pvt/transactions/{transaction_id}/payments/{payment_id}",
60
65
  config=self.client.config.with_overrides(**kwargs),
61
- response_class=VTEXResponse,
66
+ response_class=VTEXDataResponse[DictType],
62
67
  )
63
68
 
64
69
  def get_transaction_capabilities(
65
70
  self,
66
71
  transaction_id: str,
67
72
  **kwargs: Any,
68
- ) -> VTEXResponse:
73
+ ) -> VTEXDataResponse[DictType]:
69
74
  return self._request(
70
75
  method="GET",
71
76
  environment=self.ENVIRONMENT,
72
77
  endpoint=f"/api/pvt/transactions/{transaction_id}/capabilities",
73
78
  config=self.client.config.with_overrides(**kwargs),
74
- response_class=VTEXResponse,
79
+ response_class=VTEXDataResponse[DictType],
75
80
  )
76
81
 
77
82
  def get_transaction_cancellations(
78
83
  self,
79
84
  transaction_id: str,
80
85
  **kwargs: Any,
81
- ) -> VTEXResponse:
86
+ ) -> VTEXDataResponse[DictType]:
82
87
  return self._request(
83
88
  method="GET",
84
89
  environment=self.ENVIRONMENT,
85
90
  endpoint=f"/api/pvt/transactions/{transaction_id}/cancellations",
86
91
  config=self.client.config.with_overrides(**kwargs),
87
- response_class=VTEXResponse,
92
+ response_class=VTEXDataResponse[DictType],
88
93
  )
89
94
 
90
95
  def get_transaction_refunds(
91
96
  self,
92
97
  transaction_id: str,
93
98
  **kwargs: Any,
94
- ) -> VTEXResponse:
99
+ ) -> VTEXDataResponse[DictType]:
95
100
  return self._request(
96
101
  method="GET",
97
102
  environment=self.ENVIRONMENT,
98
103
  endpoint=f"/api/pvt/transactions/{transaction_id}/refunds",
99
104
  config=self.client.config.with_overrides(**kwargs),
100
- response_class=VTEXResponse,
105
+ response_class=VTEXDataResponse[DictType],
101
106
  )
102
107
 
103
108
  def get_transaction_settlements(
104
109
  self,
105
110
  transaction_id: str,
106
111
  **kwargs: Any,
107
- ) -> VTEXResponse:
112
+ ) -> VTEXDataResponse[DictType]:
108
113
  return self._request(
109
114
  method="GET",
110
115
  environment=self.ENVIRONMENT,
111
116
  endpoint=f"/api/pvt/transactions/{transaction_id}/settlements",
112
117
  config=self.client.config.with_overrides(**kwargs),
113
- response_class=VTEXResponse,
118
+ response_class=VTEXDataResponse[DictType],
114
119
  )
@@ -1,7 +1,7 @@
1
1
  from typing import Any
2
2
 
3
- from .. import VTEXListResponse
4
- from .._dto import VTEXResponse
3
+ from .._dto import VTEXDataResponse, VTEXItemsResponse
4
+ from .._types import DictType
5
5
  from .base import BaseAPI
6
6
 
7
7
 
@@ -13,42 +13,45 @@ class PromotionsAndTaxesAPI(BaseAPI):
13
13
 
14
14
  ENVIRONMENT = "vtexcommercestable"
15
15
 
16
- def list_archived_promotions(self, **kwargs: Any) -> VTEXListResponse:
16
+ def list_archived_promotions(
17
+ self,
18
+ **kwargs: Any,
19
+ ) -> VTEXItemsResponse[DictType, DictType]:
17
20
  return self._request(
18
21
  method="GET",
19
22
  environment=self.ENVIRONMENT,
20
23
  endpoint="api/rnb/pvt/archive/benefits/calculatorconfiguration",
21
24
  config=self.client.config.with_overrides(**kwargs),
22
- response_class=VTEXListResponse,
25
+ response_class=VTEXItemsResponse[DictType, DictType],
23
26
  )
24
27
 
25
- def list_promotions(self, **kwargs: Any) -> VTEXResponse:
28
+ def get_promotions(self, **kwargs: Any) -> VTEXDataResponse[DictType]:
26
29
  return self._request(
27
30
  method="GET",
28
31
  environment=self.ENVIRONMENT,
29
32
  endpoint="api/rnb/pvt/benefits/calculatorconfiguration",
30
33
  config=self.client.config.with_overrides(**kwargs),
31
- response_class=VTEXResponse,
34
+ response_class=VTEXDataResponse[DictType],
32
35
  )
33
36
 
34
- def list_taxes(self, **kwargs: Any) -> VTEXResponse:
37
+ def get_taxes(self, **kwargs: Any) -> VTEXDataResponse[DictType]:
35
38
  return self._request(
36
39
  method="GET",
37
40
  environment=self.ENVIRONMENT,
38
41
  endpoint="api/rnb/pvt/taxes/calculatorconfiguration",
39
42
  config=self.client.config.with_overrides(**kwargs),
40
- response_class=VTEXResponse,
43
+ response_class=VTEXDataResponse[DictType],
41
44
  )
42
45
 
43
46
  def get_promotion_or_tax(
44
47
  self,
45
48
  promotion_or_tax_id: str,
46
49
  **kwargs: Any,
47
- ) -> VTEXResponse:
50
+ ) -> VTEXDataResponse[DictType]:
48
51
  return self._request(
49
52
  method="GET",
50
53
  environment=self.ENVIRONMENT,
51
54
  endpoint=f"/api/rnb/pvt/calculatorconfiguration/{promotion_or_tax_id}",
52
55
  config=self.client.config.with_overrides(**kwargs),
53
- response_class=VTEXResponse,
56
+ response_class=VTEXDataResponse[DictType],
54
57
  )
File without changes
@@ -0,0 +1,17 @@
1
+ from typing import TypedDict, Union
2
+
3
+
4
+ class GetAccountData(TypedDict, total=False):
5
+ account_name: str
6
+ company_name: str
7
+ creation_date: str
8
+ have_parent_account: bool
9
+ id: str
10
+ inactivation_date: Union[str, None]
11
+ is_active: bool
12
+ is_operating: bool
13
+ name: str
14
+ operation_date: Union[str, None]
15
+ parent_account_id: Union[str, None]
16
+ parent_account_name: Union[str, None]
17
+ trading_name: str
vtex/_config.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # type: ignore
2
2
  from os import getenv
3
- from typing import Union
3
+ from typing import List, Union
4
4
 
5
5
  from ._constants import (
6
6
  ACCOUNT_NAME_ENV_VAR,
@@ -24,7 +24,6 @@ from ._constants import (
24
24
  TIMEOUT_ENV_VAR,
25
25
  )
26
26
  from ._sentinels import UNDEFINED, UndefinedSentinel
27
- from ._types import IterableType
28
27
  from ._utils import is_nullish_str, str_to_bool
29
28
 
30
29
 
@@ -41,7 +40,7 @@ class Config:
41
40
  retry_backoff_exponential: Union[
42
41
  bool, float, int, UndefinedSentinel
43
42
  ] = UNDEFINED,
44
- retry_statuses: Union[IterableType[int], UndefinedSentinel] = UNDEFINED,
43
+ retry_statuses: Union[List[int], UndefinedSentinel] = UNDEFINED,
45
44
  retry_logs: Union[bool, UndefinedSentinel] = UNDEFINED,
46
45
  raise_for_status: Union[bool, UndefinedSentinel] = UNDEFINED,
47
46
  ) -> None:
@@ -72,9 +71,12 @@ class Config:
72
71
  retry_backoff_min: Union[float, int, UndefinedSentinel] = UNDEFINED,
73
72
  retry_backoff_max: Union[float, int, UndefinedSentinel] = UNDEFINED,
74
73
  retry_backoff_exponential: Union[
75
- bool, int, float, UndefinedSentinel
74
+ bool,
75
+ int,
76
+ float,
77
+ UndefinedSentinel,
76
78
  ] = UNDEFINED,
77
- retry_statuses: Union[IterableType[int], UndefinedSentinel] = UNDEFINED,
79
+ retry_statuses: Union[List[int], UndefinedSentinel] = UNDEFINED,
78
80
  retry_logs: Union[bool, UndefinedSentinel] = UNDEFINED,
79
81
  raise_for_status: Union[bool, UndefinedSentinel] = UNDEFINED,
80
82
  ) -> "Config":
@@ -162,7 +164,7 @@ class Config:
162
164
 
163
165
  return self._retry_backoff_exponential
164
166
 
165
- def get_retry_statuses(self) -> IterableType[int]:
167
+ def get_retry_statuses(self) -> List[int]:
166
168
  if self._retry_statuses is UNDEFINED:
167
169
  return DEFAULT_RETRY_STATUSES
168
170
 
@@ -398,8 +400,8 @@ class Config:
398
400
 
399
401
  def _parse_retry_statuses(
400
402
  self,
401
- retry_statuses: Union[IterableType[int], UndefinedSentinel] = UNDEFINED,
402
- ) -> Union[IterableType[int], UndefinedSentinel]:
403
+ retry_statuses: Union[List[int], UndefinedSentinel] = UNDEFINED,
404
+ ) -> Union[List[int], UndefinedSentinel]:
403
405
  if isinstance(retry_statuses, (list, set, tuple)) and all(
404
406
  isinstance(status, int) and 100 <= status <= 599
405
407
  for status in retry_statuses
vtex/_dto.py CHANGED
@@ -1,14 +1,15 @@
1
1
  from dataclasses import dataclass
2
2
  from json import JSONDecodeError
3
3
  from math import ceil
4
- from typing import Dict, TypeVar, Union
4
+ from typing import Any, Dict, Generic, List, TypeVar, Union
5
5
 
6
6
  from httpx import Request, Response
7
7
 
8
- from ._types import IterableType, JSONType
9
- from ._utils import to_snake_case_deep
8
+ from ._utils import remove_null_bytes, to_snake_case_deep
10
9
 
11
- VTEXResponseType = TypeVar("VTEXResponseType", bound="VTEXResponse", covariant=True)
10
+ VTEXResponseType = TypeVar("VTEXResponseType", bound="VTEXResponse")
11
+ DataType = TypeVar("DataType", bound=Any)
12
+ ItemType = TypeVar("ItemType", bound=Any)
12
13
 
13
14
 
14
15
  @dataclass
@@ -32,34 +33,51 @@ class VTEXRequest:
32
33
  class VTEXResponse:
33
34
  request: VTEXRequest
34
35
  response: Response
35
- data: JSONType
36
36
  status: int
37
37
  headers: Dict[str, str]
38
38
 
39
39
  @classmethod
40
40
  def factory(cls, response: Response) -> "VTEXResponse":
41
- try:
42
- data = to_snake_case_deep(response.json(strict=False))
43
- except JSONDecodeError:
44
- data = response.text
45
-
46
41
  return cls(
47
42
  request=VTEXRequest.factory(response.request),
48
43
  response=response,
49
- data=data,
50
44
  status=int(response.status_code),
51
45
  headers=dict(response.headers),
52
46
  )
53
47
 
54
48
 
55
49
  @dataclass
56
- class VTEXListResponse(VTEXResponse):
57
- items: IterableType[JSONType]
50
+ class VTEXDataResponse(VTEXResponse, Generic[DataType]):
51
+ data: DataType
58
52
 
59
53
  @classmethod
60
- def factory(cls, response: Response) -> "VTEXListResponse":
54
+ def get_original_response_data(cls, response: Response) -> Any:
55
+ try:
56
+ return to_snake_case_deep(response.json(strict=False))
57
+ except JSONDecodeError:
58
+ return remove_null_bytes(response.text)
59
+
60
+ @classmethod
61
+ def factory(cls, response: Response) -> "VTEXDataResponse[DataType]":
61
62
  vtex_response = VTEXResponse.factory(response)
62
- data = vtex_response.data
63
+
64
+ return cls(
65
+ request=vtex_response.request,
66
+ response=vtex_response.response,
67
+ status=vtex_response.status,
68
+ headers=vtex_response.headers,
69
+ data=cls.get_original_response_data(response),
70
+ )
71
+
72
+
73
+ @dataclass
74
+ class VTEXItemsResponse(VTEXDataResponse[DataType], Generic[DataType, ItemType]):
75
+ items: List[ItemType]
76
+
77
+ @classmethod
78
+ def factory(cls, response: Response) -> "VTEXItemsResponse[DataType, ItemType]":
79
+ vtex_data_response = VTEXDataResponse[DataType].factory(response)
80
+ data = vtex_data_response.data
63
81
 
64
82
  if isinstance(data, list):
65
83
  items = data
@@ -70,15 +88,15 @@ class VTEXListResponse(VTEXResponse):
70
88
  elif isinstance(data, dict) and isinstance(data.get("data"), list):
71
89
  items = data["data"]
72
90
  else:
73
- raise ValueError(f"Not a valid list response: {data}")
91
+ raise ValueError(f"Not a valid items response: {data}")
74
92
 
75
93
  return cls(
76
- request=vtex_response.request,
77
- response=vtex_response.response,
78
- data=vtex_response.data,
79
- status=vtex_response.status,
80
- headers=vtex_response.headers,
81
- items=items,
94
+ request=vtex_data_response.request,
95
+ response=vtex_data_response.response,
96
+ status=vtex_data_response.status,
97
+ headers=vtex_data_response.headers,
98
+ data=vtex_data_response.data,
99
+ items=list(items),
82
100
  )
83
101
 
84
102
 
@@ -92,10 +110,13 @@ class VTEXPagination:
92
110
  next_page: Union[int, None]
93
111
 
94
112
  @classmethod
95
- def factory(cls, vtex_list_response: VTEXListResponse) -> "VTEXPagination":
96
- data = vtex_list_response.data
97
- request_headers = vtex_list_response.request.headers
98
- response_headers = vtex_list_response.headers
113
+ def factory(
114
+ cls,
115
+ vtex_items_response: VTEXItemsResponse[DataType, ItemType],
116
+ ) -> "VTEXPagination":
117
+ data = vtex_items_response.data
118
+ request_headers = vtex_items_response.request.headers
119
+ response_headers = vtex_items_response.headers
99
120
 
100
121
  total, pages, page_size, page = -1, -1, -1, -1
101
122
  if isinstance(data, dict) and data.get("paging"):
@@ -132,53 +153,25 @@ class VTEXPagination:
132
153
  next_page=page + 1 if page < pages else None,
133
154
  )
134
155
 
135
- raise ValueError(f"Not a valid paginated list response: {vtex_list_response}")
156
+ raise ValueError(f"Not a valid paginated items response: {vtex_items_response}")
136
157
 
137
158
 
138
159
  @dataclass
139
- class VTEXPaginatedListResponse(VTEXListResponse):
160
+ class VTEXPaginatedItemsResponse(VTEXItemsResponse[DataType, ItemType]):
140
161
  pagination: VTEXPagination
141
162
 
142
163
  @classmethod
143
- def factory(cls, response: Response) -> "VTEXPaginatedListResponse":
144
- vtex_list_response = VTEXListResponse.factory(response)
145
-
146
- return cls(
147
- request=vtex_list_response.request,
148
- response=vtex_list_response.response,
149
- data=vtex_list_response.data,
150
- status=vtex_list_response.status,
151
- headers=vtex_list_response.headers,
152
- items=vtex_list_response.items,
153
- pagination=VTEXPagination.factory(vtex_list_response),
154
- )
155
-
156
-
157
- @dataclass
158
- class VTEXScroll:
159
- token: Union[str, None]
160
-
161
- @classmethod
162
- def factory(cls, vtex_list_response: VTEXListResponse) -> "VTEXScroll":
163
- return cls(token=None)
164
-
165
-
166
- @dataclass
167
- class VTEXScrollListResponse(VTEXListResponse):
168
- scroll: VTEXScroll
169
-
170
- @classmethod
171
- def factory(cls, response: Response) -> "VTEXScrollListResponse":
172
- vtex_list_response = VTEXListResponse.factory(response)
164
+ def factory(cls, response: Response) -> "VTEXItemsResponse[DataType, ItemType]":
165
+ vtex_items_response = VTEXItemsResponse[DataType, ItemType].factory(response)
173
166
 
174
167
  return cls(
175
- request=vtex_list_response.request,
176
- response=vtex_list_response.response,
177
- data=vtex_list_response.data,
178
- status=vtex_list_response.status,
179
- headers=vtex_list_response.headers,
180
- items=vtex_list_response.items,
181
- scroll=VTEXScroll.factory(vtex_list_response),
168
+ request=vtex_items_response.request,
169
+ response=vtex_items_response.response,
170
+ data=vtex_items_response.data,
171
+ status=vtex_items_response.status,
172
+ headers=vtex_items_response.headers,
173
+ items=vtex_items_response.items,
174
+ pagination=VTEXPagination.factory(vtex_items_response),
182
175
  )
183
176
 
184
177
 
vtex/_exceptions.py CHANGED
@@ -2,8 +2,6 @@ from typing import Any, Dict, Union
2
2
 
3
3
  from httpx import Headers
4
4
 
5
- from ._types import JSONType
6
-
7
5
 
8
6
  class VTEXError(Exception):
9
7
  def __init__(self, *args: Any, **kwags: Any) -> None:
@@ -46,7 +44,7 @@ class VTEXResponseError(VTEXError):
46
44
  url: Union[str, None] = None,
47
45
  request_headers: Union[Headers, Dict[str, str], None] = None,
48
46
  status: Union[int, None] = None,
49
- data: JSONType = None,
47
+ data: Any = None,
50
48
  response_headers: Union[Headers, Dict[str, str], None] = None,
51
49
  **kwargs: Any,
52
50
  ) -> None:
vtex/_types.py CHANGED
@@ -1,19 +1,4 @@
1
- from typing import (
2
- List,
3
- Literal,
4
- Mapping,
5
- Set,
6
- Tuple,
7
- TypeVar,
8
- Union,
9
- )
10
-
11
- IterableValueType = TypeVar("IterableValueType")
12
- IterableType = Union[
13
- Tuple[IterableValueType, ...],
14
- Set[IterableValueType],
15
- List[IterableValueType],
16
- ]
1
+ from typing import Any, Dict, Literal
17
2
 
18
3
  OrderingDirectionType = Literal["ASC", "DESC", "asc", "desc"]
19
4
 
@@ -34,5 +19,4 @@ HTTPMethodType = Literal[
34
19
  "put",
35
20
  ]
36
21
 
37
- PrimitiveTypes = Union[None, bool, int, float, str]
38
- JSONType = Union[PrimitiveTypes, IterableType["JSONType"], Mapping[str, "JSONType"]]
22
+ DictType = Dict[str, Any]
vtex/_utils.py CHANGED
@@ -10,7 +10,6 @@ from distutils.util import strtobool
10
10
  from ._constants import APP_KEY_HEADER, APP_TOKEN_HEADER
11
11
  from ._logging import UTILS_LOGGER
12
12
  from ._sentinels import UNDEFINED
13
- from ._types import JSONType
14
13
 
15
14
  TO_SNAKE_CASE_STEP_1_PATTERN = compile(r"(.)([A-Z][a-z]+)")
16
15
  TO_SNAKE_CASE_STEP_2_PATTERN = compile(r"([a-z0-9])([A-Z])")
@@ -44,7 +43,7 @@ def to_snake_case(string: str) -> str:
44
43
  return string
45
44
 
46
45
 
47
- def to_snake_case_deep(obj: JSONType) -> JSONType:
46
+ def to_snake_case_deep(obj: Any) -> Any:
48
47
  if isinstance(obj, dict):
49
48
  snake_cased_obj = {}
50
49
 
vtex/_vtex.py CHANGED
@@ -1,10 +1,9 @@
1
1
  from functools import cached_property
2
- from typing import TYPE_CHECKING, Union
2
+ from typing import TYPE_CHECKING, List, Union
3
3
 
4
4
  from ._config import Config # type: ignore[attr-defined]
5
5
  from ._logging import CLIENT_LOGGER
6
6
  from ._sentinels import UNDEFINED, UndefinedSentinel
7
- from ._types import IterableType
8
7
 
9
8
  if TYPE_CHECKING:
10
9
  from ._api import (
@@ -36,7 +35,7 @@ class VTEX:
36
35
  retry_backoff_min: Union[float, UndefinedSentinel] = UNDEFINED,
37
36
  retry_backoff_max: Union[float, UndefinedSentinel] = UNDEFINED,
38
37
  retry_backoff_exponential: Union[bool, float, UndefinedSentinel] = UNDEFINED,
39
- retry_statuses: Union[IterableType[int], UndefinedSentinel] = UNDEFINED,
38
+ retry_statuses: Union[List[int], UndefinedSentinel] = UNDEFINED,
40
39
  retry_logs: Union[bool, UndefinedSentinel] = UNDEFINED,
41
40
  raise_for_status: Union[bool, UndefinedSentinel] = UNDEFINED,
42
41
  ) -> None:
@@ -58,44 +57,53 @@ class VTEX:
58
57
  @cached_property
59
58
  def custom(self) -> "CustomAPI":
60
59
  from ._api import CustomAPI
60
+
61
61
  return CustomAPI(client=self)
62
62
 
63
63
  @cached_property
64
64
  def catalog(self) -> "CatalogAPI":
65
65
  from ._api import CatalogAPI
66
+
66
67
  return CatalogAPI(client=self)
67
68
 
68
69
  @cached_property
69
70
  def checkout(self) -> "CheckoutAPI":
70
71
  from ._api import CheckoutAPI
72
+
71
73
  return CheckoutAPI(client=self)
72
74
 
73
75
  @cached_property
74
76
  def license_manager(self) -> "LicenseManagerAPI":
75
77
  from ._api import LicenseManagerAPI
78
+
76
79
  return LicenseManagerAPI(client=self)
77
80
 
78
81
  @cached_property
79
82
  def logistics(self) -> "LogisticsAPI":
80
83
  from ._api import LogisticsAPI
84
+
81
85
  return LogisticsAPI(client=self)
82
86
 
83
87
  @cached_property
84
88
  def master_data(self) -> "MasterDataAPI":
85
89
  from ._api import MasterDataAPI
90
+
86
91
  return MasterDataAPI(client=self)
87
92
 
88
93
  @cached_property
89
94
  def orders(self) -> "OrdersAPI":
90
95
  from ._api import OrdersAPI
96
+
91
97
  return OrdersAPI(client=self)
92
98
 
93
99
  @cached_property
94
100
  def payments_gateway(self) -> "PaymentsGatewayAPI":
95
101
  from ._api import PaymentsGatewayAPI
102
+
96
103
  return PaymentsGatewayAPI(client=self)
97
104
 
98
105
  @cached_property
99
106
  def promotions_and_taxes(self) -> "PromotionsAndTaxesAPI":
100
107
  from ._api import PromotionsAndTaxesAPI
108
+
101
109
  return PromotionsAndTaxesAPI(client=self)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vtexpy
3
- Version: 0.0.0b10
3
+ Version: 0.0.0b12
4
4
  Summary: Unofficial Python SDK for VTEX API
5
5
  Home-page: https://github.com/lvieirajr/vtex-python
6
6
  License: MIT
@@ -67,13 +67,29 @@ pip install vtexpy
67
67
 
68
68
  #### Usage
69
69
 
70
+ If the API you want to call is not yet implemented, feel free to create an issue on the
71
+ VTEXPY Github repository and request it to be added.
72
+
70
73
  ```python
71
74
  from vtex import VTEX
72
75
 
76
+ # 1 - Instantiate the VTEX client for the account you want to access:
73
77
  vtex_client = VTEX(
74
78
  account_name="<ACCOUNT_NAME>",
75
79
  app_key="<APP_KEY>",
76
80
  app_token="<APP_TOKEN>",
77
81
  )
82
+
83
+ # 2 - Call one of the available APIs, e.g.:
84
+ vtex_client.license_manager.get_account()
85
+ vtex_client.catalog.list_sku_ids(page=1, page_size=1000)
86
+ vtex_client.orders.list_orders(page=1, page_size=100)
87
+
88
+ # 3 - If the API you want to call is not yet implemented you can use the `custom` API.
89
+ vtex_client.custom.request(
90
+ method="GET",
91
+ environment="vtexcommercestable",
92
+ endpoint="/api/catalog_system/pvt/commercialcondition/list",
93
+ )
78
94
  ```
79
95
 
@@ -0,0 +1,28 @@
1
+ vtex/__init__.py,sha256=OwOtOH0pFnXplGHndMz7gOM6WE12etFD6orzxLNlkA8,586
2
+ vtex/_api/__init__.py,sha256=V4n0SQrqCcVFWtm8J7jbmwIRI9mCSURwdD_8uHGueAI,353
3
+ vtex/_api/base.py,sha256=rux3pUNhz76B4dm6I1I9ojnuWKp8oR2EhnJ12anxnCU,5564
4
+ vtex/_api/catalog.py,sha256=nqiAZ3W4IXMcXED2x0WwDToTihTHvdnldoahnQc85bw,4290
5
+ vtex/_api/checkout.py,sha256=Q_PxFvWyWNzRJw-YJuHi2NSjRqQfQ-R2NIlYhXl3Dh0,1751
6
+ vtex/_api/custom.py,sha256=QzxN1bst3Rnd4guy1e-9c8SmE7ILFu0fUpmAG7Ki0Dg,2699
7
+ vtex/_api/license_manager.py,sha256=mYEUSYLkFdaBPEmhyNx2jUbhaHubcOwpqLG0SutoQMo,692
8
+ vtex/_api/logistics.py,sha256=tXg9V2wIBqNJuUUTJEZx4esN9T66ZKVxPb7X_4hPbUU,4618
9
+ vtex/_api/master_data.py,sha256=1q_OKY5Cf2Cfe1lcGI2hOplXZb-VSLFIO3jXReVHMVI,2088
10
+ vtex/_api/orders.py,sha256=2x84ym5aJD7VSHid16ize2hz57JwCC4ri61Qx2HPazY,5134
11
+ vtex/_api/payments_gateway.py,sha256=d6Lr3D7Aj6HXXP2gX8TA961C75JQ1lelTmdb2Sjo5Os,3934
12
+ vtex/_api/promotions_and_taxes.py,sha256=S8Vp0tlZAyJITAXEnxPi8LZMjE4wl_aChDRV1YAqt34,1973
13
+ vtex/_api/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ vtex/_api/types/license_manager.py,sha256=NhKr9pBoVAhp_hK4mAbXsjGM24oglf9ItWbQ7dgosZI,431
15
+ vtex/_config.py,sha256=RmsQG_hILqEU5HHnnuLh--LxFhn8uSfrk-yPE-_WJhE,16836
16
+ vtex/_constants.py,sha256=BV6BRgbYA6_jcp2t_SBXjXgVgg2-iDdJrYYXsXETU_8,1701
17
+ vtex/_dto.py,sha256=gX_r0685dXRo916A-ZSw9vYfN7XcxFLxkaiIBRbxA6M,6092
18
+ vtex/_exceptions.py,sha256=yglSMmPy4oYWU65oGY1XWA1CbmW1MJO8K-bGYIjoXeg,2127
19
+ vtex/_logging.py,sha256=66tjBs0KvbU3dB14PdSjhdi0C4RT60GEuMPvOe87j7s,1622
20
+ vtex/_sentinels.py,sha256=HLkYBJVHTx9GoyACPO1SuINaGlU2YiqOPuFXUa7iG8A,1120
21
+ vtex/_types.py,sha256=I_vca-7hqRiMXJOXMB40OVTlypXdujduf4LSwW-tGKk,333
22
+ vtex/_utils.py,sha256=OdKGAyGks0sYo8z9ljVVUnWyPZttEluE4hWCrK0hcJA,3483
23
+ vtex/_vtex.py,sha256=kz3SfwSW8rcRVSW_-5MXb8njpqWNknzA8JDYZu9-Vjo,3321
24
+ vtex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
+ vtexpy-0.0.0b12.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
26
+ vtexpy-0.0.0b12.dist-info/METADATA,sha256=7k75Qq19-nI_iQXAle04uCaxQCVtoq8Yb_UGK4n7Vxw,2956
27
+ vtexpy-0.0.0b12.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
28
+ vtexpy-0.0.0b12.dist-info/RECORD,,
@@ -1,26 +0,0 @@
1
- vtex/__init__.py,sha256=MHSWXYxS1emq7iO1iIwmMtrg_rbCROdHO20mra0gdEs,594
2
- vtex/_api/__init__.py,sha256=V4n0SQrqCcVFWtm8J7jbmwIRI9mCSURwdD_8uHGueAI,353
3
- vtex/_api/base.py,sha256=32PJNl0En-YtrMU06VjvuTXlJgpO72gs1qFQ_RUYIWE,5554
4
- vtex/_api/catalog.py,sha256=o2J1FNXtqFMhNbU2mZDNy-fAunkMg1BZWx5piaPHTWk,3998
5
- vtex/_api/checkout.py,sha256=jywcSnI5nZMycUPpglNzTS5eUOlYkmHD9yvR6MvyvFw,1685
6
- vtex/_api/custom.py,sha256=9p1x_vxUkj84vORWRqrdxXMOdtN1GxCFBZJ2TAPT1CU,2318
7
- vtex/_api/license_manager.py,sha256=HlPrD_sSqsWCaCPDwZ0YbuzeHxXFFXRWQwnbyWBGdEg,598
8
- vtex/_api/logistics.py,sha256=3qPkcyurN5vnsBLmvDd7AMlNYYY-dj7jRMr27Mna5EM,4314
9
- vtex/_api/master_data.py,sha256=LHe0uSx2FYmj5vzcyHIX2HKKd3qnfJqI8W83f1Oq1bs,2067
10
- vtex/_api/orders.py,sha256=tns1ExwNEQnKbpByeaQT-iy0asiR3rExCSuCCQAtzo0,4994
11
- vtex/_api/payments_gateway.py,sha256=_CI_R3rtYxc8w-jfEpYdIuS4juXY3CjPG-W4DrogdVI,3616
12
- vtex/_api/promotions_and_taxes.py,sha256=vG7p4izxdCLJCr3xL4x5sKOgUhN7TjOHrFobM33bvKI,1805
13
- vtex/_config.py,sha256=pOtyvpPF7hFTsdd4jb3oTTuBrkIlpE0cWF4-hqLBmpM,16866
14
- vtex/_constants.py,sha256=BV6BRgbYA6_jcp2t_SBXjXgVgg2-iDdJrYYXsXETU_8,1701
15
- vtex/_dto.py,sha256=N4fgcXCq0D4xVmD6ntG5X9vR_Clfl_F4NVLmDFPddjY,6030
16
- vtex/_exceptions.py,sha256=8aly7jBClpWKdZoC8SqJrCljeucebYDZNZeSS1nfaOg,2162
17
- vtex/_logging.py,sha256=66tjBs0KvbU3dB14PdSjhdi0C4RT60GEuMPvOe87j7s,1622
18
- vtex/_sentinels.py,sha256=HLkYBJVHTx9GoyACPO1SuINaGlU2YiqOPuFXUa7iG8A,1120
19
- vtex/_types.py,sha256=zx5DLAjaxMeYbvC_Wno7-9UwoLc8j-awkoW2SjhVXAU,675
20
- vtex/_utils.py,sha256=oqQ0y8_PHmvv4exV9hAZIyS0Nsp8c4BcSXlpEv2KRQE,3522
21
- vtex/_vtex.py,sha256=qAKeawNvFBqqut6_BT-zoHE1CljVxNYl_YGXw1u46MU,3347
22
- vtex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- vtexpy-0.0.0b10.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
24
- vtexpy-0.0.0b10.dist-info/METADATA,sha256=iu6RO9ywnR8AVVT5bNK2aJHDHbwk4PO1Px5s4v2m9Iw,2306
25
- vtexpy-0.0.0b10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
26
- vtexpy-0.0.0b10.dist-info/RECORD,,