|
| 1 | +# Copyright (c) 2023, VRAI Labs and/or its affiliates. All rights reserved. |
| 2 | +# |
| 3 | +# This software is licensed under the Apache License, Version 2.0 (the |
| 4 | +# "License") as published by the Apache Software Foundation. |
| 5 | +# |
| 6 | +# You may not use this file except in compliance with the License. You may |
| 7 | +# obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | +# License for the specific language governing permissions and limitations |
| 13 | +# under the License. |
| 14 | + |
| 15 | +from __future__ import annotations |
| 16 | + |
| 17 | +from typing import TYPE_CHECKING, Any, Dict |
| 18 | + |
| 19 | +if TYPE_CHECKING: |
| 20 | + from supertokens_python.recipe.dashboard.interfaces import ( |
| 21 | + APIOptions, |
| 22 | + APIInterface, |
| 23 | + ) |
| 24 | + from supertokens_python.types import APIResponse |
| 25 | + |
| 26 | +from supertokens_python.recipe.multitenancy.asyncio import list_all_tenants |
| 27 | +from supertokens_python.recipe.dashboard.interfaces import ( |
| 28 | + DashboardListTenantsGetResponse, |
| 29 | +) |
| 30 | + |
| 31 | + |
| 32 | +async def handle_list_tenants_api( |
| 33 | + _api_implementation: APIInterface, |
| 34 | + _tenant_id: str, |
| 35 | + _api_options: APIOptions, |
| 36 | + user_context: Dict[str, Any], |
| 37 | +) -> APIResponse: |
| 38 | + tenants = await list_all_tenants(user_context) |
| 39 | + return DashboardListTenantsGetResponse(tenants.tenants) |
0 commit comments