Skip to content

Commit e96b961

Browse files
updated changelog
1 parent 013fc4e commit e96b961

File tree

3 files changed

+82
-22
lines changed

3 files changed

+82
-22
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Added `network_interceptor` to the `supertokens_config` in `init`.
1414
- This can be used to capture/modify all the HTTP requests sent to the core.
1515
- Solves the issue - https://github.com/supertokens/supertokens-core/issues/865
16+
- Functions `get_users_oldest_first`, `get_users_newest_first`, `get_user_count`, `delete_user`, `create_user_id_mapping`, `get_user_id_mapping`, `delete_user_id_mapping` and `update_or_delete_user_id_mapping_info` now accept `user_context` as an optional argument.
1617
- Fixed the dependencies in the example apps
1718
- Example apps will now fetch the latest version of the frameworks
1819

supertokens_python/asyncio/__init__.py

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
1212
# License for the specific language governing permissions and limitations
1313
# under the License.
14-
from typing import Dict, List, Optional, Union
14+
from typing import Dict, List, Optional, Union, Any
1515

1616
from supertokens_python import Supertokens
1717
from supertokens_python.interfaces import (
@@ -33,9 +33,16 @@ async def get_users_oldest_first(
3333
pagination_token: Union[str, None] = None,
3434
include_recipe_ids: Union[None, List[str]] = None,
3535
query: Union[None, Dict[str, str]] = None,
36+
user_context: Optional[Dict[str, Any]] = None,
3637
) -> UsersResponse:
3738
return await Supertokens.get_instance().get_users(
38-
tenant_id, "ASC", limit, pagination_token, include_recipe_ids, query
39+
tenant_id,
40+
"ASC",
41+
limit,
42+
pagination_token,
43+
include_recipe_ids,
44+
query,
45+
user_context,
3946
)
4047

4148

@@ -45,61 +52,82 @@ async def get_users_newest_first(
4552
pagination_token: Union[str, None] = None,
4653
include_recipe_ids: Union[None, List[str]] = None,
4754
query: Union[None, Dict[str, str]] = None,
55+
user_context: Optional[Dict[str, Any]] = None,
4856
) -> UsersResponse:
4957
return await Supertokens.get_instance().get_users(
50-
tenant_id, "DESC", limit, pagination_token, include_recipe_ids, query
58+
tenant_id,
59+
"DESC",
60+
limit,
61+
pagination_token,
62+
include_recipe_ids,
63+
query,
64+
user_context,
5165
)
5266

5367

5468
async def get_user_count(
55-
include_recipe_ids: Union[None, List[str]] = None, tenant_id: Optional[str] = None
69+
include_recipe_ids: Union[None, List[str]] = None,
70+
tenant_id: Optional[str] = None,
71+
user_context: Optional[Dict[str, Any]] = None,
5672
) -> int:
5773
return await Supertokens.get_instance().get_user_count(
58-
include_recipe_ids, tenant_id
74+
include_recipe_ids, tenant_id, user_context
5975
)
6076

6177

62-
async def delete_user(user_id: str) -> None:
63-
return await Supertokens.get_instance().delete_user(user_id)
78+
async def delete_user(
79+
user_id: str, user_context: Optional[Dict[str, Any]] = None
80+
) -> None:
81+
return await Supertokens.get_instance().delete_user(user_id, user_context)
6482

6583

6684
async def create_user_id_mapping(
6785
supertokens_user_id: str,
6886
external_user_id: str,
6987
external_user_id_info: Optional[str] = None,
7088
force: Optional[bool] = None,
89+
user_context: Optional[Dict[str, Any]] = None,
7190
) -> Union[
7291
CreateUserIdMappingOkResult,
7392
UnknownSupertokensUserIDError,
7493
UserIdMappingAlreadyExistsError,
7594
]:
7695
return await Supertokens.get_instance().create_user_id_mapping(
77-
supertokens_user_id, external_user_id, external_user_id_info, force
96+
supertokens_user_id,
97+
external_user_id,
98+
external_user_id_info,
99+
force,
100+
user_context,
78101
)
79102

80103

81104
async def get_user_id_mapping(
82105
user_id: str,
83106
user_id_type: Optional[UserIDTypes] = None,
107+
user_context: Optional[Dict[str, Any]] = None,
84108
) -> Union[GetUserIdMappingOkResult, UnknownMappingError]:
85-
return await Supertokens.get_instance().get_user_id_mapping(user_id, user_id_type)
109+
return await Supertokens.get_instance().get_user_id_mapping(
110+
user_id, user_id_type, user_context
111+
)
86112

87113

88114
async def delete_user_id_mapping(
89115
user_id: str,
90116
user_id_type: Optional[UserIDTypes] = None,
91117
force: Optional[bool] = None,
118+
user_context: Optional[Dict[str, Any]] = None,
92119
) -> DeleteUserIdMappingOkResult:
93120
return await Supertokens.get_instance().delete_user_id_mapping(
94-
user_id, user_id_type, force
121+
user_id, user_id_type, force, user_context
95122
)
96123

97124

98125
async def update_or_delete_user_id_mapping_info(
99126
user_id: str,
100127
user_id_type: Optional[UserIDTypes] = None,
101128
external_user_id_info: Optional[str] = None,
129+
user_context: Optional[Dict[str, Any]] = None,
102130
) -> Union[UpdateOrDeleteUserIdMappingInfoOkResult, UnknownMappingError]:
103131
return await Supertokens.get_instance().update_or_delete_user_id_mapping_info(
104-
user_id, user_id_type, external_user_id_info
132+
user_id, user_id_type, external_user_id_info, user_context
105133
)

supertokens_python/syncio/__init__.py

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
1212
# License for the specific language governing permissions and limitations
1313
# under the License.
14-
from typing import Dict, List, Optional, Union
14+
from typing import Dict, List, Optional, Union, Any
1515

1616
from supertokens_python import Supertokens
1717
from supertokens_python.async_to_sync_wrapper import sync
@@ -34,10 +34,17 @@ def get_users_oldest_first(
3434
pagination_token: Union[str, None] = None,
3535
include_recipe_ids: Union[None, List[str]] = None,
3636
query: Union[None, Dict[str, str]] = None,
37+
user_context: Optional[Dict[str, Any]] = None,
3738
) -> UsersResponse:
3839
return sync(
3940
Supertokens.get_instance().get_users(
40-
tenant_id, "ASC", limit, pagination_token, include_recipe_ids, query
41+
tenant_id,
42+
"ASC",
43+
limit,
44+
pagination_token,
45+
include_recipe_ids,
46+
query,
47+
user_context,
4148
)
4249
)
4350

@@ -48,65 +55,89 @@ def get_users_newest_first(
4855
pagination_token: Union[str, None] = None,
4956
include_recipe_ids: Union[None, List[str]] = None,
5057
query: Union[None, Dict[str, str]] = None,
58+
user_context: Optional[Dict[str, Any]] = None,
5159
) -> UsersResponse:
5260
return sync(
5361
Supertokens.get_instance().get_users(
54-
tenant_id, "DESC", limit, pagination_token, include_recipe_ids, query
62+
tenant_id,
63+
"DESC",
64+
limit,
65+
pagination_token,
66+
include_recipe_ids,
67+
query,
68+
user_context,
5569
)
5670
)
5771

5872

5973
def get_user_count(
6074
include_recipe_ids: Union[None, List[str]] = None,
6175
tenant_id: Optional[str] = None,
76+
user_context: Optional[Dict[str, Any]] = None,
6277
) -> int:
6378
return sync(
64-
Supertokens.get_instance().get_user_count(include_recipe_ids, tenant_id)
79+
Supertokens.get_instance().get_user_count(
80+
include_recipe_ids, tenant_id, user_context
81+
)
6582
)
6683

6784

68-
def delete_user(user_id: str) -> None:
69-
return sync(Supertokens.get_instance().delete_user(user_id))
85+
def delete_user(user_id: str, user_context: Optional[Dict[str, Any]] = None) -> None:
86+
return sync(Supertokens.get_instance().delete_user(user_id, user_context))
7087

7188

7289
def create_user_id_mapping(
7390
supertokens_user_id: str,
7491
external_user_id: str,
7592
external_user_id_info: Optional[str] = None,
93+
user_context: Optional[Dict[str, Any]] = None,
7694
) -> Union[
7795
CreateUserIdMappingOkResult,
7896
UnknownSupertokensUserIDError,
7997
UserIdMappingAlreadyExistsError,
8098
]:
8199
return sync(
82100
Supertokens.get_instance().create_user_id_mapping(
83-
supertokens_user_id, external_user_id, external_user_id_info
101+
supertokens_user_id,
102+
external_user_id,
103+
external_user_id_info,
104+
user_context=user_context,
84105
)
85106
)
86107

87108

88109
def get_user_id_mapping(
89110
user_id: str,
90111
user_id_type: Optional[UserIDTypes] = None,
112+
user_context: Optional[Dict[str, Any]] = None,
91113
) -> Union[GetUserIdMappingOkResult, UnknownMappingError]:
92-
return sync(Supertokens.get_instance().get_user_id_mapping(user_id, user_id_type))
114+
return sync(
115+
Supertokens.get_instance().get_user_id_mapping(
116+
user_id, user_id_type, user_context
117+
)
118+
)
93119

94120

95121
def delete_user_id_mapping(
96-
user_id: str, user_id_type: Optional[UserIDTypes] = None
122+
user_id: str,
123+
user_id_type: Optional[UserIDTypes] = None,
124+
user_context: Optional[Dict[str, Any]] = None,
97125
) -> DeleteUserIdMappingOkResult:
98126
return sync(
99-
Supertokens.get_instance().delete_user_id_mapping(user_id, user_id_type)
127+
Supertokens.get_instance().delete_user_id_mapping(
128+
user_id, user_id_type, user_context=user_context
129+
)
100130
)
101131

102132

103133
def update_or_delete_user_id_mapping_info(
104134
user_id: str,
105135
user_id_type: Optional[UserIDTypes] = None,
106136
external_user_id_info: Optional[str] = None,
137+
user_context: Optional[Dict[str, Any]] = None,
107138
) -> Union[UpdateOrDeleteUserIdMappingInfoOkResult, UnknownMappingError]:
108139
return sync(
109140
Supertokens.get_instance().update_or_delete_user_id_mapping_info(
110-
user_id, user_id_type, external_user_id_info
141+
user_id, user_id_type, external_user_id_info, user_context
111142
)
112143
)

0 commit comments

Comments
 (0)