vtexpy 0.0.0b12__py3-none-any.whl → 0.0.0b14__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.

Potentially problematic release.


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

vtex/_api/catalog.py CHANGED
@@ -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
- ) -> VTEXItemsResponse[List[str], str]:
51
+ ) -> VTEXItemsResponse[List[int], int]:
52
52
  return self._request(
53
53
  method="GET",
54
54
  environment=self.ENVIRONMENT,
@@ -61,7 +61,7 @@ class CatalogAPI(BaseAPI):
61
61
  ),
62
62
  },
63
63
  config=self.client.config.with_overrides(**kwargs),
64
- response_class=VTEXItemsResponse[List[str], str],
64
+ response_class=VTEXItemsResponse[List[int], int],
65
65
  )
66
66
 
67
67
  def get_sku_with_context(
@@ -1,8 +1,11 @@
1
- from typing import Any
1
+ from typing import Any, List, Union
2
2
 
3
- from .._dto import VTEXDataResponse
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
4
7
  from .base import BaseAPI
5
- from .types.license_manager import GetAccountData
8
+ from .types.license_manager import GetAccountData, ListRolesData, Role, UserRole
6
9
 
7
10
 
8
11
  class LicenseManagerAPI(BaseAPI):
@@ -21,3 +24,51 @@ class LicenseManagerAPI(BaseAPI):
21
24
  config=self.client.config.with_overrides(**kwargs),
22
25
  response_class=VTEXDataResponse[GetAccountData],
23
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
+ )
vtex/_api/orders.py CHANGED
@@ -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
@@ -1,8 +1,19 @@
1
- from typing import TypedDict, Union
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
2
12
 
3
13
 
4
14
  class GetAccountData(TypedDict, total=False):
5
15
  account_name: str
16
+ app_keys: List[AccountAppKey]
6
17
  company_name: str
7
18
  creation_date: str
8
19
  have_parent_account: bool
@@ -15,3 +26,25 @@ class GetAccountData(TypedDict, total=False):
15
26
  parent_account_id: Union[str, None]
16
27
  parent_account_name: Union[str, None]
17
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
vtex/_constants.py CHANGED
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vtexpy
3
- Version: 0.0.0b12
3
+ Version: 0.0.0b14
4
4
  Summary: Unofficial Python SDK for VTEX API
5
5
  Home-page: https://github.com/lvieirajr/vtex-python
6
6
  License: MIT
@@ -1,19 +1,20 @@
1
1
  vtex/__init__.py,sha256=OwOtOH0pFnXplGHndMz7gOM6WE12etFD6orzxLNlkA8,586
2
2
  vtex/_api/__init__.py,sha256=V4n0SQrqCcVFWtm8J7jbmwIRI9mCSURwdD_8uHGueAI,353
3
3
  vtex/_api/base.py,sha256=rux3pUNhz76B4dm6I1I9ojnuWKp8oR2EhnJ12anxnCU,5564
4
- vtex/_api/catalog.py,sha256=nqiAZ3W4IXMcXED2x0WwDToTihTHvdnldoahnQc85bw,4290
4
+ vtex/_api/catalog.py,sha256=fEKAHeHk_bOWG1qTLHvfHnCH_M9jYsSUzhbaAIKumqg,4290
5
5
  vtex/_api/checkout.py,sha256=Q_PxFvWyWNzRJw-YJuHi2NSjRqQfQ-R2NIlYhXl3Dh0,1751
6
6
  vtex/_api/custom.py,sha256=QzxN1bst3Rnd4guy1e-9c8SmE7ILFu0fUpmAG7Ki0Dg,2699
7
- vtex/_api/license_manager.py,sha256=mYEUSYLkFdaBPEmhyNx2jUbhaHubcOwpqLG0SutoQMo,692
7
+ vtex/_api/license_manager.py,sha256=9X6sdkIUwry-gDNtO5-5q9HNqxXw4q-nPs_IGbG4CkE,2678
8
8
  vtex/_api/logistics.py,sha256=tXg9V2wIBqNJuUUTJEZx4esN9T66ZKVxPb7X_4hPbUU,4618
9
9
  vtex/_api/master_data.py,sha256=1q_OKY5Cf2Cfe1lcGI2hOplXZb-VSLFIO3jXReVHMVI,2088
10
- vtex/_api/orders.py,sha256=2x84ym5aJD7VSHid16ize2hz57JwCC4ri61Qx2HPazY,5134
10
+ vtex/_api/orders.py,sha256=Im-82XoFd1CI-nAQm-ByeS68Mg6mvfw7nhh_WS63SWU,5134
11
11
  vtex/_api/payments_gateway.py,sha256=d6Lr3D7Aj6HXXP2gX8TA961C75JQ1lelTmdb2Sjo5Os,3934
12
12
  vtex/_api/promotions_and_taxes.py,sha256=S8Vp0tlZAyJITAXEnxPi8LZMjE4wl_aChDRV1YAqt34,1973
13
13
  vtex/_api/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- vtex/_api/types/license_manager.py,sha256=NhKr9pBoVAhp_hK4mAbXsjGM24oglf9ItWbQ7dgosZI,431
14
+ vtex/_api/types/generic.py,sha256=ek7LyfYLpc3KFCJFy8A-yukTNZhhvvjaikOOHZSL6EE,377
15
+ vtex/_api/types/license_manager.py,sha256=U0PPQSVBX1UGTU_of6dsHJyYgAh1WI1yIR45bbE8170,997
15
16
  vtex/_config.py,sha256=RmsQG_hILqEU5HHnnuLh--LxFhn8uSfrk-yPE-_WJhE,16836
16
- vtex/_constants.py,sha256=BV6BRgbYA6_jcp2t_SBXjXgVgg2-iDdJrYYXsXETU_8,1701
17
+ vtex/_constants.py,sha256=pBUOzw33JsKKdlDEXYTH_yuoLlnm1fJYDUayzCGc3qI,1779
17
18
  vtex/_dto.py,sha256=gX_r0685dXRo916A-ZSw9vYfN7XcxFLxkaiIBRbxA6M,6092
18
19
  vtex/_exceptions.py,sha256=yglSMmPy4oYWU65oGY1XWA1CbmW1MJO8K-bGYIjoXeg,2127
19
20
  vtex/_logging.py,sha256=66tjBs0KvbU3dB14PdSjhdi0C4RT60GEuMPvOe87j7s,1622
@@ -22,7 +23,7 @@ vtex/_types.py,sha256=I_vca-7hqRiMXJOXMB40OVTlypXdujduf4LSwW-tGKk,333
22
23
  vtex/_utils.py,sha256=OdKGAyGks0sYo8z9ljVVUnWyPZttEluE4hWCrK0hcJA,3483
23
24
  vtex/_vtex.py,sha256=kz3SfwSW8rcRVSW_-5MXb8njpqWNknzA8JDYZu9-Vjo,3321
24
25
  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,,
26
+ vtexpy-0.0.0b14.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
27
+ vtexpy-0.0.0b14.dist-info/METADATA,sha256=hVA2b_TY-tNmDKv_Dt1NLWnJZ9janqrZFYnrMq9Nzcs,2956
28
+ vtexpy-0.0.0b14.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
29
+ vtexpy-0.0.0b14.dist-info/RECORD,,