vtexpy 0.0.0b11__tar.gz → 0.0.0b13__tar.gz

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.

Potentially problematic release.


This version of vtexpy might be problematic. Click here for more details.

Files changed (31) hide show
  1. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/PKG-INFO +1 -1
  2. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/pyproject.toml +1 -1
  3. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_api/custom.py +8 -5
  4. vtexpy-0.0.0b13/vtex/_api/license_manager.py +74 -0
  5. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_api/orders.py +1 -1
  6. vtexpy-0.0.0b13/vtex/_api/types/generic.py +22 -0
  7. vtexpy-0.0.0b13/vtex/_api/types/license_manager.py +50 -0
  8. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_config.py +4 -1
  9. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_constants.py +4 -0
  10. vtexpy-0.0.0b11/vtex/_api/license_manager.py +0 -23
  11. vtexpy-0.0.0b11/vtex/_api/types/license_manager.py +0 -17
  12. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/LICENSE +0 -0
  13. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/README.md +0 -0
  14. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/__init__.py +0 -0
  15. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_api/__init__.py +0 -0
  16. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_api/base.py +0 -0
  17. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_api/catalog.py +0 -0
  18. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_api/checkout.py +0 -0
  19. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_api/logistics.py +0 -0
  20. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_api/master_data.py +0 -0
  21. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_api/payments_gateway.py +0 -0
  22. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_api/promotions_and_taxes.py +0 -0
  23. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_api/types/__init__.py +0 -0
  24. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_dto.py +0 -0
  25. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_exceptions.py +0 -0
  26. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_logging.py +0 -0
  27. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_sentinels.py +0 -0
  28. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_types.py +0 -0
  29. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_utils.py +0 -0
  30. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/_vtex.py +0 -0
  31. {vtexpy-0.0.0b11 → vtexpy-0.0.0b13}/vtex/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vtexpy
3
- Version: 0.0.0b11
3
+ Version: 0.0.0b13
4
4
  Summary: Unofficial Python SDK for VTEX API
5
5
  Home-page: https://github.com/lvieirajr/vtex-python
6
6
  License: MIT
@@ -32,7 +32,7 @@ classifiers = [
32
32
  packages = [
33
33
  {include = "vtex"},
34
34
  ]
35
- version = "0.0.0b11"
35
+ version = "0.0.0b13"
36
36
 
37
37
  [build-system]
38
38
  requires = ["poetry-core"]
@@ -68,15 +68,18 @@ class CustomAPI(BaseAPI):
68
68
  def get_main_seller(self) -> str:
69
69
  return "1"
70
70
 
71
- def get_market_place_sellers(self) -> List[str]:
71
+ def get_market_place_sellers(self, include_inactive: bool = False) -> List[str]:
72
72
  return [
73
73
  seller["seller_id"]
74
- for seller in self.client.catalog.list_sellers(seller_type=1).items
75
- 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)
76
78
  ]
77
79
 
78
- def get_franchise_sellers(self) -> List[str]:
80
+ def get_franchise_sellers(self, include_inactive: bool = False) -> List[str]:
79
81
  return [
80
82
  seller["seller_id"]
81
- for seller in 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)
82
85
  ]
@@ -0,0 +1,74 @@
1
+ from typing import Any, List, Union
2
+
3
+ from .._constants import LIST_ROLES_MAX_PAGE_SIZE, LIST_ROLES_START_PAGE, MIN_PAGE_SIZE
4
+ from .._dto import VTEXDataResponse, VTEXItemsResponse, VTEXPaginatedItemsResponse
5
+ from .._sentinels import UNDEFINED, UndefinedSentinel
6
+ from .._types import OrderingDirectionType
7
+ from .base import BaseAPI
8
+ from .types.license_manager import GetAccountData, ListRolesData, Role, UserRole
9
+
10
+
11
+ class LicenseManagerAPI(BaseAPI):
12
+ """
13
+ Client for the License Manager API.
14
+ https://developers.vtex.com/docs/api-reference/license-manager-api
15
+ """
16
+
17
+ ENVIRONMENT = "vtexcommercestable"
18
+
19
+ def get_account(self, **kwargs: Any) -> VTEXDataResponse[GetAccountData]:
20
+ return self._request(
21
+ method="GET",
22
+ environment=self.ENVIRONMENT,
23
+ endpoint="/api/vlm/account",
24
+ config=self.client.config.with_overrides(**kwargs),
25
+ response_class=VTEXDataResponse[GetAccountData],
26
+ )
27
+
28
+ def get_user_roles(
29
+ self,
30
+ user_id: Union[str, UndefinedSentinel] = UNDEFINED,
31
+ **kwargs: Any,
32
+ ) -> VTEXItemsResponse[List[UserRole], UserRole]:
33
+ config = self.client.config.with_overrides(**kwargs)
34
+
35
+ if not user_id:
36
+ app_keys = {
37
+ app_key["app_key"]: app_key
38
+ for app_key in self.get_account().data["app_keys"]
39
+ }
40
+
41
+ user_id = app_keys[config.get_app_key()]["id"]
42
+
43
+ return self._request(
44
+ method="GET",
45
+ environment=self.ENVIRONMENT,
46
+ endpoint=f"/api/license-manager/users/{user_id}/roles",
47
+ config=config,
48
+ response_class=VTEXItemsResponse[List[UserRole], UserRole],
49
+ )
50
+
51
+ def list_roles(
52
+ self,
53
+ order_by_field: str = "id",
54
+ order_by_direction: OrderingDirectionType = "DESC",
55
+ page: int = LIST_ROLES_START_PAGE,
56
+ page_size: int = LIST_ROLES_MAX_PAGE_SIZE,
57
+ **kwargs: Any,
58
+ ) -> VTEXPaginatedItemsResponse[ListRolesData, Role]:
59
+ return self._request(
60
+ method="GET",
61
+ environment=self.ENVIRONMENT,
62
+ endpoint="/api/license-manager/site/pvt/roles/list/paged",
63
+ params={
64
+ "sort": order_by_field,
65
+ "sortType": order_by_direction,
66
+ "pageNumber": max(page, LIST_ROLES_START_PAGE),
67
+ "numItems": max(
68
+ min(page_size, LIST_ROLES_MAX_PAGE_SIZE),
69
+ MIN_PAGE_SIZE,
70
+ ),
71
+ },
72
+ config=self.client.config.with_overrides(**kwargs),
73
+ response_class=VTEXPaginatedItemsResponse[ListRolesData, Role],
74
+ )
@@ -31,7 +31,7 @@ class OrdersAPI(BaseAPI):
31
31
  creation_date_to: Union[datetime, UndefinedSentinel] = UNDEFINED,
32
32
  incomplete: bool = False,
33
33
  order_by_field: str = "creationDate",
34
- order_by_direction: OrderingDirectionType = "desc",
34
+ order_by_direction: OrderingDirectionType = "DESC",
35
35
  page: int = LIST_ORDERS_START_PAGE,
36
36
  page_size: int = LIST_ORDERS_MAX_PAGE_SIZE,
37
37
  **kwargs: Any,
@@ -0,0 +1,22 @@
1
+ from typing import TypedDict
2
+
3
+
4
+ class CurrentPagePagination(TypedDict, total=True):
5
+ current_page: int
6
+ pages: int
7
+ per_page: int
8
+ total: int
9
+
10
+
11
+ class PagePagination(TypedDict, total=True):
12
+ page: int
13
+ pages: int
14
+ per_page: int
15
+ total: int
16
+
17
+
18
+ class RowsPagination(TypedDict, total=True):
19
+ page: int
20
+ size: int
21
+ total_page: int
22
+ total_rows: int
@@ -0,0 +1,50 @@
1
+ from typing import List, TypedDict, Union
2
+
3
+ from .generic import PagePagination
4
+
5
+
6
+ class AccountAppKey(TypedDict, total=False):
7
+ app_key: str
8
+ id: str
9
+ is_active: bool
10
+ is_blocked: bool
11
+ label: str
12
+
13
+
14
+ class GetAccountData(TypedDict, total=False):
15
+ account_name: str
16
+ app_keys: List[AccountAppKey]
17
+ company_name: str
18
+ creation_date: str
19
+ have_parent_account: bool
20
+ id: str
21
+ inactivation_date: Union[str, None]
22
+ is_active: bool
23
+ is_operating: bool
24
+ name: str
25
+ operation_date: Union[str, None]
26
+ parent_account_id: Union[str, None]
27
+ parent_account_name: Union[str, None]
28
+ trading_name: str
29
+
30
+
31
+ class UserRole(TypedDict, total=False):
32
+ id: int
33
+ name: str
34
+
35
+
36
+ class RoleProduct(TypedDict, total=False):
37
+ name: str
38
+
39
+
40
+ class Role(TypedDict, total=False):
41
+ id: int
42
+ is_admin: bool
43
+ name: str
44
+ products: List[RoleProduct]
45
+ role_type: int
46
+
47
+
48
+ class ListRolesData(TypedDict, total=False):
49
+ items: List[Role]
50
+ paging: PagePagination
@@ -71,7 +71,10 @@ class Config:
71
71
  retry_backoff_min: Union[float, int, UndefinedSentinel] = UNDEFINED,
72
72
  retry_backoff_max: Union[float, int, UndefinedSentinel] = UNDEFINED,
73
73
  retry_backoff_exponential: Union[
74
- bool, int, float, UndefinedSentinel
74
+ bool,
75
+ int,
76
+ float,
77
+ UndefinedSentinel,
75
78
  ] = UNDEFINED,
76
79
  retry_statuses: Union[List[int], UndefinedSentinel] = UNDEFINED,
77
80
  retry_logs: Union[bool, UndefinedSentinel] = UNDEFINED,
@@ -50,6 +50,10 @@ LIST_CATEGORIES_MAX_PAGE_SIZE = 50
50
50
 
51
51
  GET_CATEGORY_TREE_MAX_LEVELS = 1_000_000
52
52
 
53
+ # License Manager
54
+ LIST_ROLES_START_PAGE = 1
55
+ LIST_ROLES_MAX_PAGE_SIZE = 1_000
56
+
53
57
  # Logistics
54
58
  LIST_CARRIERS_START_PAGE = 1
55
59
  LIST_CARRIERS_MAX_PAGE_SIZE = 1_000
@@ -1,23 +0,0 @@
1
- from typing import Any
2
-
3
- from .._dto import VTEXDataResponse
4
- from .base import BaseAPI
5
- from .types.license_manager import GetAccountData
6
-
7
-
8
- class LicenseManagerAPI(BaseAPI):
9
- """
10
- Client for the License Manager API.
11
- https://developers.vtex.com/docs/api-reference/license-manager-api
12
- """
13
-
14
- ENVIRONMENT = "vtexcommercestable"
15
-
16
- def get_account(self, **kwargs: Any) -> VTEXDataResponse[GetAccountData]:
17
- return self._request(
18
- method="GET",
19
- environment=self.ENVIRONMENT,
20
- endpoint="/api/vlm/account",
21
- config=self.client.config.with_overrides(**kwargs),
22
- response_class=VTEXDataResponse[GetAccountData],
23
- )
@@ -1,17 +0,0 @@
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes