File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -448,6 +448,35 @@ async def get_user_membership_status_async(
448448
449449 Returns:
450450 TeamMembershipStatus object
451+
452+ Example: Check if a user is a member of a team
453+ This example shows how to check a user's membership status in a team.
454+
455+ ```python
456+ import asyncio
457+ from synapseclient import Synapse
458+ from synapseclient.models import Team
459+
460+ syn = Synapse()
461+ syn.login()
462+
463+ async def check_membership():
464+ # Get a team by ID
465+ team = await Team.from_id_async(123456)
466+
467+ # Check membership status for a specific user
468+ user_id = "3350396" # Replace with actual user ID
469+ status = await team.get_user_membership_status_async(user_id)
470+
471+ print(f"User ID: {status.user_id}")
472+ print(f"Is member: {status.is_member}")
473+ print(f"Can join: {status.can_join}")
474+ print(f"Has open invitation: {status.has_open_invitation}")
475+ print(f"Has open request: {status.has_open_request}")
476+ print(f"Membership approval required: {status.membership_approval_required}")
477+
478+ asyncio.run(check_membership())
479+ ```
451480 """
452481 from synapseclient import Synapse
453482
You can’t perform that action at this time.
0 commit comments