Skip to content

Commit

Permalink
updated changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
IamMayankThakur committed Nov 9, 2023
1 parent 013fc4e commit e96b961
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `network_interceptor` to the `supertokens_config` in `init`.
- This can be used to capture/modify all the HTTP requests sent to the core.
- Solves the issue - https://github.com/supertokens/supertokens-core/issues/865
- 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.
- Fixed the dependencies in the example apps
- Example apps will now fetch the latest version of the frameworks

Expand Down
50 changes: 39 additions & 11 deletions supertokens_python/asyncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from typing import Dict, List, Optional, Union
from typing import Dict, List, Optional, Union, Any

from supertokens_python import Supertokens
from supertokens_python.interfaces import (
Expand All @@ -33,9 +33,16 @@ async def get_users_oldest_first(
pagination_token: Union[str, None] = None,
include_recipe_ids: Union[None, List[str]] = None,
query: Union[None, Dict[str, str]] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> UsersResponse:
return await Supertokens.get_instance().get_users(
tenant_id, "ASC", limit, pagination_token, include_recipe_ids, query
tenant_id,
"ASC",
limit,
pagination_token,
include_recipe_ids,
query,
user_context,
)


Expand All @@ -45,61 +52,82 @@ async def get_users_newest_first(
pagination_token: Union[str, None] = None,
include_recipe_ids: Union[None, List[str]] = None,
query: Union[None, Dict[str, str]] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> UsersResponse:
return await Supertokens.get_instance().get_users(
tenant_id, "DESC", limit, pagination_token, include_recipe_ids, query
tenant_id,
"DESC",
limit,
pagination_token,
include_recipe_ids,
query,
user_context,
)


async def get_user_count(
include_recipe_ids: Union[None, List[str]] = None, tenant_id: Optional[str] = None
include_recipe_ids: Union[None, List[str]] = None,
tenant_id: Optional[str] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> int:
return await Supertokens.get_instance().get_user_count(
include_recipe_ids, tenant_id
include_recipe_ids, tenant_id, user_context
)


async def delete_user(user_id: str) -> None:
return await Supertokens.get_instance().delete_user(user_id)
async def delete_user(
user_id: str, user_context: Optional[Dict[str, Any]] = None
) -> None:
return await Supertokens.get_instance().delete_user(user_id, user_context)


async def create_user_id_mapping(
supertokens_user_id: str,
external_user_id: str,
external_user_id_info: Optional[str] = None,
force: Optional[bool] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> Union[
CreateUserIdMappingOkResult,
UnknownSupertokensUserIDError,
UserIdMappingAlreadyExistsError,
]:
return await Supertokens.get_instance().create_user_id_mapping(
supertokens_user_id, external_user_id, external_user_id_info, force
supertokens_user_id,
external_user_id,
external_user_id_info,
force,
user_context,
)


async def get_user_id_mapping(
user_id: str,
user_id_type: Optional[UserIDTypes] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> Union[GetUserIdMappingOkResult, UnknownMappingError]:
return await Supertokens.get_instance().get_user_id_mapping(user_id, user_id_type)
return await Supertokens.get_instance().get_user_id_mapping(
user_id, user_id_type, user_context
)


async def delete_user_id_mapping(
user_id: str,
user_id_type: Optional[UserIDTypes] = None,
force: Optional[bool] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> DeleteUserIdMappingOkResult:
return await Supertokens.get_instance().delete_user_id_mapping(
user_id, user_id_type, force
user_id, user_id_type, force, user_context
)


async def update_or_delete_user_id_mapping_info(
user_id: str,
user_id_type: Optional[UserIDTypes] = None,
external_user_id_info: Optional[str] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> Union[UpdateOrDeleteUserIdMappingInfoOkResult, UnknownMappingError]:
return await Supertokens.get_instance().update_or_delete_user_id_mapping_info(
user_id, user_id_type, external_user_id_info
user_id, user_id_type, external_user_id_info, user_context
)
53 changes: 42 additions & 11 deletions supertokens_python/syncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from typing import Dict, List, Optional, Union
from typing import Dict, List, Optional, Union, Any

from supertokens_python import Supertokens
from supertokens_python.async_to_sync_wrapper import sync
Expand All @@ -34,10 +34,17 @@ def get_users_oldest_first(
pagination_token: Union[str, None] = None,
include_recipe_ids: Union[None, List[str]] = None,
query: Union[None, Dict[str, str]] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> UsersResponse:
return sync(
Supertokens.get_instance().get_users(
tenant_id, "ASC", limit, pagination_token, include_recipe_ids, query
tenant_id,
"ASC",
limit,
pagination_token,
include_recipe_ids,
query,
user_context,
)
)

Expand All @@ -48,65 +55,89 @@ def get_users_newest_first(
pagination_token: Union[str, None] = None,
include_recipe_ids: Union[None, List[str]] = None,
query: Union[None, Dict[str, str]] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> UsersResponse:
return sync(
Supertokens.get_instance().get_users(
tenant_id, "DESC", limit, pagination_token, include_recipe_ids, query
tenant_id,
"DESC",
limit,
pagination_token,
include_recipe_ids,
query,
user_context,
)
)


def get_user_count(
include_recipe_ids: Union[None, List[str]] = None,
tenant_id: Optional[str] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> int:
return sync(
Supertokens.get_instance().get_user_count(include_recipe_ids, tenant_id)
Supertokens.get_instance().get_user_count(
include_recipe_ids, tenant_id, user_context
)
)


def delete_user(user_id: str) -> None:
return sync(Supertokens.get_instance().delete_user(user_id))
def delete_user(user_id: str, user_context: Optional[Dict[str, Any]] = None) -> None:
return sync(Supertokens.get_instance().delete_user(user_id, user_context))


def create_user_id_mapping(
supertokens_user_id: str,
external_user_id: str,
external_user_id_info: Optional[str] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> Union[
CreateUserIdMappingOkResult,
UnknownSupertokensUserIDError,
UserIdMappingAlreadyExistsError,
]:
return sync(
Supertokens.get_instance().create_user_id_mapping(
supertokens_user_id, external_user_id, external_user_id_info
supertokens_user_id,
external_user_id,
external_user_id_info,
user_context=user_context,
)
)


def get_user_id_mapping(
user_id: str,
user_id_type: Optional[UserIDTypes] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> Union[GetUserIdMappingOkResult, UnknownMappingError]:
return sync(Supertokens.get_instance().get_user_id_mapping(user_id, user_id_type))
return sync(
Supertokens.get_instance().get_user_id_mapping(
user_id, user_id_type, user_context
)
)


def delete_user_id_mapping(
user_id: str, user_id_type: Optional[UserIDTypes] = None
user_id: str,
user_id_type: Optional[UserIDTypes] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> DeleteUserIdMappingOkResult:
return sync(
Supertokens.get_instance().delete_user_id_mapping(user_id, user_id_type)
Supertokens.get_instance().delete_user_id_mapping(
user_id, user_id_type, user_context=user_context
)
)


def update_or_delete_user_id_mapping_info(
user_id: str,
user_id_type: Optional[UserIDTypes] = None,
external_user_id_info: Optional[str] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> Union[UpdateOrDeleteUserIdMappingInfoOkResult, UnknownMappingError]:
return sync(
Supertokens.get_instance().update_or_delete_user_id_mapping_info(
user_id, user_id_type, external_user_id_info
user_id, user_id_type, external_user_id_info, user_context
)
)

0 comments on commit e96b961

Please sign in to comment.