Skip to content

Commit d636253

Browse files
Lingling PengLingling Peng
authored andcommitted
point user to sync rather than async method
1 parent 230f32a commit d636253

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

synapseclient/client.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6023,7 +6023,7 @@ def get_team_open_invitations(
60236023
@deprecated(
60246024
version="4.9.0",
60256025
reason="To be removed in 5.0.0. "
6026-
"Use the `get_user_membership_status_async` method on the `Team` class from `synapseclient.models` instead. "
6026+
"Use the `get_user_membership_status` method on the `Team` class from `synapseclient.models` instead. "
60276027
"Check the docstring for the replacement function example.",
60286028
)
60296029
def get_membership_status(self, userid, team):
@@ -6050,12 +6050,22 @@ def get_membership_status(self, userid, team):
60506050
```python
60516051
from synapseclient import Synapse
60526052
from synapseclient.models import Team
6053-
import asyncio
60546053
60556054
# Login to Synapse
60566055
syn = Synapse()
60576056
syn.login()
60586057
6058+
# Use synchronous version (recommended for most use cases)
6059+
team = Team.from_id(id="67890")
6060+
status = team.get_user_membership_status(
6061+
user_id="12345",
6062+
team="67890"
6063+
)
6064+
print(status)
6065+
6066+
# Alternative: Use async version for advanced use cases
6067+
import asyncio
6068+
60596069
async def get_membership_status():
60606070
# Get the team object
60616071
team = await Team.from_id_async(id="67890")
@@ -6070,14 +6080,6 @@ async def get_membership_status():
60706080
# Run the async function
60716081
status = asyncio.run(get_membership_status())
60726082
print(status)
6073-
6074-
# Alternative: Use synchronous version
6075-
team = Team.from_id(id="67890")
6076-
status = team.get_user_membership_status(
6077-
user_id="12345",
6078-
team="67890"
6079-
)
6080-
print(status)
60816083
```
60826084
"""
60836085
teamid = id_of(team)

0 commit comments

Comments
 (0)