@@ -73,6 +73,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
7373 from .utils import MultitenancyConfig
7474
7575from supertokens_python.querier import NormalisedURLPath
76+ from .constants import DEFAULT_TENANT_ID
7677
7778
7879def parse_tenant_config(tenant: Dict[str, Any]) -> TenantConfigResponse:
@@ -189,7 +190,9 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
189190 self, tenant_id: Optional[str], user_context: Dict[str, Any]
190191 ) -> Optional[GetTenantOkResult]:
191192 res = await self.querier.send_get_request(
192- NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/tenant"),
193+ NormalisedURLPath(
194+ f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant"
195+ ),
193196 )
194197
195198 if res["status"] == "TENANT_NOT_FOUND_ERROR":
@@ -237,7 +240,9 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
237240 user_context: Dict[str, Any],
238241 ) -> CreateOrUpdateThirdPartyConfigOkResult:
239242 response = await self.querier.send_put_request(
240- NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/config/thirdparty"),
243+ NormalisedURLPath(
244+ f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/config/thirdparty"
245+ ),
241246 {
242247 "config": config.to_json(),
243248 "skipValidation": skip_validation is True,
@@ -256,7 +261,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
256261 ) -> DeleteThirdPartyConfigOkResult:
257262 response = await self.querier.send_post_request(
258263 NormalisedURLPath(
259- f"{tenant_id}/recipe/multitenancy/config/thirdparty/remove"
264+ f"{tenant_id or DEFAULT_TENANT_ID }/recipe/multitenancy/config/thirdparty/remove"
260265 ),
261266 {
262267 "thirdPartyId": third_party_id,
@@ -268,7 +273,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
268273 )
269274
270275 async def associate_user_to_tenant(
271- self, tenant_id: str | None , user_id: str, user_context: Dict[str, Any]
276+ self, tenant_id: Optional[ str] , user_id: str, user_context: Dict[str, Any]
272277 ) -> Union[
273278 AssociateUserToTenantOkResult,
274279 AssociateUserToTenantUnknownUserIdError,
@@ -277,7 +282,9 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
277282 AssociateUserToTenantThirdPartyUserAlreadyExistsError,
278283 ]:
279284 response: Dict[str, Any] = await self.querier.send_post_request(
280- NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/tenant/user"),
285+ NormalisedURLPath(
286+ f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant/user"
287+ ),
281288 {
282289 "userId": user_id,
283290 },
@@ -305,10 +312,12 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
305312 raise Exception("Should never come here")
306313
307314 async def dissociate_user_from_tenant(
308- self, tenant_id: str | None , user_id: str, user_context: Dict[str, Any]
315+ self, tenant_id: Optional[ str] , user_id: str, user_context: Dict[str, Any]
309316 ) -> DisassociateUserFromTenantOkResult:
310317 response = await self.querier.send_post_request(
311- NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/tenant/user/remove"),
318+ NormalisedURLPath(
319+ f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant/user/remove"
320+ ),
312321 {
313322 "userId": user_id,
314323 },
@@ -465,7 +474,9 @@ <h2 class="section-title" id="header-classes">Classes</h2>
465474 self, tenant_id: Optional[str], user_context: Dict[str, Any]
466475 ) -> Optional[GetTenantOkResult]:
467476 res = await self.querier.send_get_request(
468- NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/tenant"),
477+ NormalisedURLPath(
478+ f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant"
479+ ),
469480 )
470481
471482 if res["status"] == "TENANT_NOT_FOUND_ERROR":
@@ -513,7 +524,9 @@ <h2 class="section-title" id="header-classes">Classes</h2>
513524 user_context: Dict[str, Any],
514525 ) -> CreateOrUpdateThirdPartyConfigOkResult:
515526 response = await self.querier.send_put_request(
516- NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/config/thirdparty"),
527+ NormalisedURLPath(
528+ f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/config/thirdparty"
529+ ),
517530 {
518531 "config": config.to_json(),
519532 "skipValidation": skip_validation is True,
@@ -532,7 +545,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
532545 ) -> DeleteThirdPartyConfigOkResult:
533546 response = await self.querier.send_post_request(
534547 NormalisedURLPath(
535- f"{tenant_id}/recipe/multitenancy/config/thirdparty/remove"
548+ f"{tenant_id or DEFAULT_TENANT_ID }/recipe/multitenancy/config/thirdparty/remove"
536549 ),
537550 {
538551 "thirdPartyId": third_party_id,
@@ -544,7 +557,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
544557 )
545558
546559 async def associate_user_to_tenant(
547- self, tenant_id: str | None , user_id: str, user_context: Dict[str, Any]
560+ self, tenant_id: Optional[ str] , user_id: str, user_context: Dict[str, Any]
548561 ) -> Union[
549562 AssociateUserToTenantOkResult,
550563 AssociateUserToTenantUnknownUserIdError,
@@ -553,7 +566,9 @@ <h2 class="section-title" id="header-classes">Classes</h2>
553566 AssociateUserToTenantThirdPartyUserAlreadyExistsError,
554567 ]:
555568 response: Dict[str, Any] = await self.querier.send_post_request(
556- NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/tenant/user"),
569+ NormalisedURLPath(
570+ f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant/user"
571+ ),
557572 {
558573 "userId": user_id,
559574 },
@@ -581,10 +596,12 @@ <h2 class="section-title" id="header-classes">Classes</h2>
581596 raise Exception("Should never come here")
582597
583598 async def dissociate_user_from_tenant(
584- self, tenant_id: str | None , user_id: str, user_context: Dict[str, Any]
599+ self, tenant_id: Optional[ str] , user_id: str, user_context: Dict[str, Any]
585600 ) -> DisassociateUserFromTenantOkResult:
586601 response = await self.querier.send_post_request(
587- NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/tenant/user/remove"),
602+ NormalisedURLPath(
603+ f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant/user/remove"
604+ ),
588605 {
589606 "userId": user_id,
590607 },
@@ -602,7 +619,7 @@ <h3>Ancestors</h3>
602619< h3 > Methods</ h3 >
603620< dl >
604621< dt id ="supertokens_python.recipe.multitenancy.recipe_implementation.RecipeImplementation.associate_user_to_tenant "> < code class ="name flex ">
605- < span > async def < span class ="ident "> associate_user_to_tenant</ span > </ span > (< span > self, tenant_id: str | None, user_id: str, user_context: Dict[str, Any]) ‑> Union[AssociateUserToTenantOkResult, AssociateUserToTenantUnknownUserIdError, AssociateUserToTenantEmailAlreadyExistsError, AssociateUserToTenantPhoneNumberAlreadyExistsError, AssociateUserToTenantThirdPartyUserAlreadyExistsError]</ span >
622+ < span > async def < span class ="ident "> associate_user_to_tenant</ span > </ span > (< span > self, tenant_id: Optional[str], user_id: str, user_context: Dict[str, Any]) ‑> Union[< a title ="supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantOkResult " href ="interfaces.html#supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantOkResult "> AssociateUserToTenantOkResult</ a > , < a title ="supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantUnknownUserIdError " href ="interfaces.html#supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantUnknownUserIdError "> AssociateUserToTenantUnknownUserIdError</ a > , < a title ="supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantEmailAlreadyExistsError " href ="interfaces.html#supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantEmailAlreadyExistsError "> AssociateUserToTenantEmailAlreadyExistsError</ a > , < a title ="supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantPhoneNumberAlreadyExistsError " href ="interfaces.html#supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantPhoneNumberAlreadyExistsError "> AssociateUserToTenantPhoneNumberAlreadyExistsError</ a > , < a title ="supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantThirdPartyUserAlreadyExistsError " href ="interfaces.html#supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantThirdPartyUserAlreadyExistsError "> AssociateUserToTenantThirdPartyUserAlreadyExistsError</ a > ]</ span >
606623</ code > </ dt >
607624< dd >
608625< div class ="desc "> </ div >
@@ -611,7 +628,7 @@ <h3>Methods</h3>
611628< span > Expand source code</ span >
612629</ summary >
613630< pre > < code class ="python "> async def associate_user_to_tenant(
614- self, tenant_id: str | None , user_id: str, user_context: Dict[str, Any]
631+ self, tenant_id: Optional[ str] , user_id: str, user_context: Dict[str, Any]
615632) -> Union[
616633 AssociateUserToTenantOkResult,
617634 AssociateUserToTenantUnknownUserIdError,
@@ -620,7 +637,9 @@ <h3>Methods</h3>
620637 AssociateUserToTenantThirdPartyUserAlreadyExistsError,
621638]:
622639 response: Dict[str, Any] = await self.querier.send_post_request(
623- NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/tenant/user"),
640+ NormalisedURLPath(
641+ f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant/user"
642+ ),
624643 {
625644 "userId": user_id,
626645 },
@@ -692,7 +711,9 @@ <h3>Methods</h3>
692711 user_context: Dict[str, Any],
693712) -> CreateOrUpdateThirdPartyConfigOkResult:
694713 response = await self.querier.send_put_request(
695- NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/config/thirdparty"),
714+ NormalisedURLPath(
715+ f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/config/thirdparty"
716+ ),
696717 {
697718 "config": config.to_json(),
698719 "skipValidation": skip_validation is True,
@@ -742,7 +763,7 @@ <h3>Methods</h3>
742763) -> DeleteThirdPartyConfigOkResult:
743764 response = await self.querier.send_post_request(
744765 NormalisedURLPath(
745- f"{tenant_id}/recipe/multitenancy/config/thirdparty/remove"
766+ f"{tenant_id or DEFAULT_TENANT_ID }/recipe/multitenancy/config/thirdparty/remove"
746767 ),
747768 {
748769 "thirdPartyId": third_party_id,
@@ -755,7 +776,7 @@ <h3>Methods</h3>
755776</ details >
756777</ dd >
757778< dt id ="supertokens_python.recipe.multitenancy.recipe_implementation.RecipeImplementation.dissociate_user_from_tenant "> < code class ="name flex ">
758- < span > async def < span class ="ident "> dissociate_user_from_tenant</ span > </ span > (< span > self, tenant_id: str | None , user_id: str, user_context: Dict[str, Any]) ‑> DisassociateUserFromTenantOkResult</ span >
779+ < span > async def < span class ="ident "> dissociate_user_from_tenant</ span > </ span > (< span > self, tenant_id: Optional[ str] , user_id: str, user_context: Dict[str, Any]) ‑> < a title =" supertokens_python.recipe.multitenancy.interfaces. DisassociateUserFromTenantOkResult" href =" interfaces.html#supertokens_python.recipe.multitenancy.interfaces.DisassociateUserFromTenantOkResult " > DisassociateUserFromTenantOkResult </ a > </ span >
759780</ code > </ dt >
760781< dd >
761782< div class ="desc "> </ div >
@@ -764,10 +785,12 @@ <h3>Methods</h3>
764785< span > Expand source code</ span >
765786</ summary >
766787< pre > < code class ="python "> async def dissociate_user_from_tenant(
767- self, tenant_id: str | None , user_id: str, user_context: Dict[str, Any]
788+ self, tenant_id: Optional[ str] , user_id: str, user_context: Dict[str, Any]
768789) -> DisassociateUserFromTenantOkResult:
769790 response = await self.querier.send_post_request(
770- NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/tenant/user/remove"),
791+ NormalisedURLPath(
792+ f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant/user/remove"
793+ ),
771794 {
772795 "userId": user_id,
773796 },
@@ -791,7 +814,9 @@ <h3>Methods</h3>
791814 self, tenant_id: Optional[str], user_context: Dict[str, Any]
792815) -> Optional[GetTenantOkResult]:
793816 res = await self.querier.send_get_request(
794- NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/tenant"),
817+ NormalisedURLPath(
818+ f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant"
819+ ),
795820 )
796821
797822 if res["status"] == "TENANT_NOT_FOUND_ERROR":
0 commit comments