@@ -25,6 +25,23 @@ def create(self, *, synapse_client: Optional[Synapse] = None) -> "Team":
2525
2626 Returns:
2727 Team: The Team object.
28+
29+ Example: Create a new team
30+
31+ Create a new team on Synapse by storing a Team object with a name.
32+ ```python
33+ from synapseclient import Synapse
34+ from synapseclient.models import Team
35+
36+ syn = Synapse()
37+ syn.login()
38+
39+ team = Team(
40+ name="My Uniquely Named Team",
41+ description="A team for my project collaborators",
42+ can_public_join=False,
43+ ).create()
44+ ```
2845 """
2946 return self
3047
@@ -38,6 +55,35 @@ def delete(self, *, synapse_client: Optional[Synapse] = None) -> None:
3855
3956 Returns:
4057 None
58+
59+ Example: Delete a team by ID
60+
61+ Delete a team using its ID.
62+ ```python
63+ from synapseclient import Synapse
64+ from synapseclient.models import Team
65+
66+ syn = Synapse()
67+ syn.login()
68+
69+ Team(id=123456).delete()
70+ ```
71+
72+ Example: Get and then delete a team
73+
74+ If you do not have the ID of the team, you can first retrieve it from
75+ Synapse by name. That will populate the ID attribute in your Team object,
76+ at which point you can delete it.
77+ ```python
78+ from synapseclient import Synapse
79+ from synapseclient.models import Team
80+
81+ syn = Synapse()
82+ syn.login()
83+
84+ team = Team.from_name(name="My Uniquely Named Team")
85+ team.delete()
86+ ```
4187 """
4288 return None
4389
@@ -56,6 +102,32 @@ def get(self, *, synapse_client: Optional[Synapse] = None) -> "Team":
56102
57103 Returns:
58104 Team: The Team object.
105+
106+ Example: Get a team by ID
107+
108+ Retrieve an existing team using its ID.
109+ ```python
110+ from synapseclient import Synapse
111+ from synapseclient.models import Team
112+
113+ syn = Synapse()
114+ syn.login()
115+
116+ team = Team(id=123456).get()
117+ ```
118+
119+ Example: Get a team by name
120+
121+ Retrieve an existing team using its name.
122+ ```python
123+ from synapseclient import Synapse
124+ from synapseclient.models import Team
125+
126+ syn = Synapse()
127+ syn.login()
128+
129+ team = Team(name="My Uniquely Named Team").get()
130+ ```
59131 """
60132 return self
61133
@@ -71,6 +143,19 @@ def from_id(cls, id: int, *, synapse_client: Optional[Synapse] = None) -> "Team"
71143
72144 Returns:
73145 Team: The Team object.
146+
147+ Example: Get a team by its ID
148+
149+ Retrieve an existing team using its ID.
150+ ```python
151+ from synapseclient import Synapse
152+ from synapseclient.models import Team
153+
154+ syn = Synapse()
155+ syn.login()
156+
157+ team = Team.from_id(id=123456)
158+ ```
74159 """
75160 from synapseclient .models .team import Team
76161
@@ -95,6 +180,19 @@ def from_name(
95180
96181 Returns:
97182 Team: The Team object.
183+
184+ Example: Get a team by its name
185+
186+ Retrieve an existing team using its name.
187+ ```python
188+ from synapseclient import Synapse
189+ from synapseclient.models import Team
190+
191+ syn = Synapse()
192+ syn.login()
193+
194+ team = Team.from_name(name="My Uniquely Named Team")
195+ ```
98196 """
99197 from synapseclient .models .team import Team
100198
@@ -114,6 +212,21 @@ def members(
114212
115213 Returns:
116214 List[TeamMember]: A List of TeamMember objects.
215+
216+ Example: List the members of a team
217+
218+ List the current members of a team.
219+ ```python
220+ from synapseclient import Synapse
221+ from synapseclient.models import Team
222+
223+ syn = Synapse()
224+ syn.login()
225+
226+ team = Team.from_id(id=123456)
227+ for member in team.members():
228+ print(f"{member.member.user_name} (admin: {member.is_admin})")
229+ ```
117230 """
118231 from synapseclient .models .team import TeamMember
119232
@@ -142,6 +255,20 @@ def invite(
142255
143256 Returns:
144257 The invite response or None if an invite was not sent.
258+
259+ Example: Invite a user to a team
260+
261+ Send an invitation for a user to join a team.
262+ ```python
263+ from synapseclient import Synapse
264+ from synapseclient.models import Team
265+
266+ syn = Synapse()
267+ syn.login()
268+
269+ team = Team.from_id(id=123456)
270+ team.invite(user="my_username", message="Please join my team!")
271+ ```
145272 """
146273 return {}
147274
@@ -157,9 +284,63 @@ def open_invitations(
157284
158285 Returns:
159286 List[dict]: A list of invitations.
287+
288+ Example: List the open invitations for a team
289+
290+ List all pending invitations for a team.
291+ ```python
292+ from synapseclient import Synapse
293+ from synapseclient.models import Team
294+
295+ syn = Synapse()
296+ syn.login()
297+
298+ team = Team.from_id(id=123456)
299+ open_invitations = team.open_invitations()
300+ ```
160301 """
161302 return list ({})
162303
304+ @staticmethod
305+ def delete_invitation (
306+ invitation_id : str , * , synapse_client : Optional [Synapse ] = None
307+ ) -> None :
308+ """Deletes an open invitation to a team. Note: The client must be an
309+ administrator of the Team referenced by the invitation, or the invitee,
310+ to make this request.
311+
312+ Arguments:
313+ invitation_id: The ID of the invitation to delete. This can be found
314+ on the invitations returned by
315+ [open_invitations][synapseclient.models.Team.open_invitations].
316+ synapse_client: If not passed in and caching was not disabled by
317+ `Synapse.allow_client_caching(False)` this will use the last created
318+ instance from the Synapse class constructor.
319+
320+ Returns:
321+ None
322+
323+ Example: Delete an open invitation to a team
324+
325+ Cancel a pending invitation to a team.
326+ ```python
327+ from synapseclient import Synapse
328+ from synapseclient.models import Team
329+
330+ syn = Synapse()
331+ syn.login()
332+
333+ team = Team.from_id(id=123456)
334+ open_invitations = team.open_invitations()
335+ if not open_invitations:
336+ print("No open invitations to delete.")
337+ else:
338+ # Delete the first open invitation
339+ Team.delete_invitation(invitation_id=open_invitations[0]["id"])
340+ ```
341+ """
342+ return None
343+
163344 def get_user_membership_status (
164345 self ,
165346 user_id : str ,
@@ -179,11 +360,9 @@ def get_user_membership_status(
179360 Returns:
180361 TeamMembershipStatus object
181362
182- Example:
183- Check if a user is a member of a team
184- This example shows how to check a user's membership status in a team.
363+ Example: Check if a user is a member of a team
185364
186-
365+ This example shows how to check a user's membership status in a team.
187366 ```python
188367 from synapseclient import Synapse
189368 from synapseclient.models import Team
@@ -192,7 +371,7 @@ def get_user_membership_status(
192371 syn.login()
193372
194373 # Get a team by ID
195- team = Team.from_id(123456)
374+ team = Team.from_id(id= 123456)
196375
197376 # Check membership status for a specific user
198377 user_id = "3350396" # Replace with actual user ID
0 commit comments