@@ -73,6 +73,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
73
73
from .utils import MultitenancyConfig
74
74
75
75
from supertokens_python.querier import NormalisedURLPath
76
+ from .constants import DEFAULT_TENANT_ID
76
77
77
78
78
79
def parse_tenant_config(tenant: Dict[str, Any]) -> TenantConfigResponse:
@@ -189,7 +190,9 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
189
190
self, tenant_id: Optional[str], user_context: Dict[str, Any]
190
191
) -> Optional[GetTenantOkResult]:
191
192
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
+ ),
193
196
)
194
197
195
198
if res["status"] == "TENANT_NOT_FOUND_ERROR":
@@ -237,7 +240,9 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
237
240
user_context: Dict[str, Any],
238
241
) -> CreateOrUpdateThirdPartyConfigOkResult:
239
242
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
+ ),
241
246
{
242
247
"config": config.to_json(),
243
248
"skipValidation": skip_validation is True,
@@ -256,7 +261,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
256
261
) -> DeleteThirdPartyConfigOkResult:
257
262
response = await self.querier.send_post_request(
258
263
NormalisedURLPath(
259
- f"{tenant_id}/recipe/multitenancy/config/thirdparty/remove"
264
+ f"{tenant_id or DEFAULT_TENANT_ID }/recipe/multitenancy/config/thirdparty/remove"
260
265
),
261
266
{
262
267
"thirdPartyId": third_party_id,
@@ -268,7 +273,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
268
273
)
269
274
270
275
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]
272
277
) -> Union[
273
278
AssociateUserToTenantOkResult,
274
279
AssociateUserToTenantUnknownUserIdError,
@@ -277,7 +282,9 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
277
282
AssociateUserToTenantThirdPartyUserAlreadyExistsError,
278
283
]:
279
284
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
+ ),
281
288
{
282
289
"userId": user_id,
283
290
},
@@ -305,10 +312,12 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
305
312
raise Exception("Should never come here")
306
313
307
314
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]
309
316
) -> DisassociateUserFromTenantOkResult:
310
317
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
+ ),
312
321
{
313
322
"userId": user_id,
314
323
},
@@ -465,7 +474,9 @@ <h2 class="section-title" id="header-classes">Classes</h2>
465
474
self, tenant_id: Optional[str], user_context: Dict[str, Any]
466
475
) -> Optional[GetTenantOkResult]:
467
476
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
+ ),
469
480
)
470
481
471
482
if res["status"] == "TENANT_NOT_FOUND_ERROR":
@@ -513,7 +524,9 @@ <h2 class="section-title" id="header-classes">Classes</h2>
513
524
user_context: Dict[str, Any],
514
525
) -> CreateOrUpdateThirdPartyConfigOkResult:
515
526
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
+ ),
517
530
{
518
531
"config": config.to_json(),
519
532
"skipValidation": skip_validation is True,
@@ -532,7 +545,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
532
545
) -> DeleteThirdPartyConfigOkResult:
533
546
response = await self.querier.send_post_request(
534
547
NormalisedURLPath(
535
- f"{tenant_id}/recipe/multitenancy/config/thirdparty/remove"
548
+ f"{tenant_id or DEFAULT_TENANT_ID }/recipe/multitenancy/config/thirdparty/remove"
536
549
),
537
550
{
538
551
"thirdPartyId": third_party_id,
@@ -544,7 +557,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
544
557
)
545
558
546
559
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]
548
561
) -> Union[
549
562
AssociateUserToTenantOkResult,
550
563
AssociateUserToTenantUnknownUserIdError,
@@ -553,7 +566,9 @@ <h2 class="section-title" id="header-classes">Classes</h2>
553
566
AssociateUserToTenantThirdPartyUserAlreadyExistsError,
554
567
]:
555
568
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
+ ),
557
572
{
558
573
"userId": user_id,
559
574
},
@@ -581,10 +596,12 @@ <h2 class="section-title" id="header-classes">Classes</h2>
581
596
raise Exception("Should never come here")
582
597
583
598
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]
585
600
) -> DisassociateUserFromTenantOkResult:
586
601
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
+ ),
588
605
{
589
606
"userId": user_id,
590
607
},
@@ -602,7 +619,7 @@ <h3>Ancestors</h3>
602
619
< h3 > Methods</ h3 >
603
620
< dl >
604
621
< 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 >
606
623
</ code > </ dt >
607
624
< dd >
608
625
< div class ="desc "> </ div >
@@ -611,7 +628,7 @@ <h3>Methods</h3>
611
628
< span > Expand source code</ span >
612
629
</ summary >
613
630
< 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]
615
632
) -> Union[
616
633
AssociateUserToTenantOkResult,
617
634
AssociateUserToTenantUnknownUserIdError,
@@ -620,7 +637,9 @@ <h3>Methods</h3>
620
637
AssociateUserToTenantThirdPartyUserAlreadyExistsError,
621
638
]:
622
639
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
+ ),
624
643
{
625
644
"userId": user_id,
626
645
},
@@ -692,7 +711,9 @@ <h3>Methods</h3>
692
711
user_context: Dict[str, Any],
693
712
) -> CreateOrUpdateThirdPartyConfigOkResult:
694
713
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
+ ),
696
717
{
697
718
"config": config.to_json(),
698
719
"skipValidation": skip_validation is True,
@@ -742,7 +763,7 @@ <h3>Methods</h3>
742
763
) -> DeleteThirdPartyConfigOkResult:
743
764
response = await self.querier.send_post_request(
744
765
NormalisedURLPath(
745
- f"{tenant_id}/recipe/multitenancy/config/thirdparty/remove"
766
+ f"{tenant_id or DEFAULT_TENANT_ID }/recipe/multitenancy/config/thirdparty/remove"
746
767
),
747
768
{
748
769
"thirdPartyId": third_party_id,
@@ -755,7 +776,7 @@ <h3>Methods</h3>
755
776
</ details >
756
777
</ dd >
757
778
< 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 >
759
780
</ code > </ dt >
760
781
< dd >
761
782
< div class ="desc "> </ div >
@@ -764,10 +785,12 @@ <h3>Methods</h3>
764
785
< span > Expand source code</ span >
765
786
</ summary >
766
787
< 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]
768
789
) -> DisassociateUserFromTenantOkResult:
769
790
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
+ ),
771
794
{
772
795
"userId": user_id,
773
796
},
@@ -791,7 +814,9 @@ <h3>Methods</h3>
791
814
self, tenant_id: Optional[str], user_context: Dict[str, Any]
792
815
) -> Optional[GetTenantOkResult]:
793
816
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
+ ),
795
820
)
796
821
797
822
if res["status"] == "TENANT_NOT_FOUND_ERROR":
0 commit comments