Skip to content

Teams

synapseclient.team

Functions that interact with Synapse Teams

Classes

UserProfile

Bases: DictObject

Deprecated with replacement. This class will be removed in 5.0.0. Use from synapseclient.models import UserProfile instead.

Information about a Synapse user. In practice the constructor is not called directly by the client.

Migration to new method

 

# Old approach (DEPRECATED)
# from synapseclient.team import UserProfile

# New approach (RECOMMENDED)
from synapseclient import Synapse
from synapseclient.models import UserProfile

syn = Synapse()
syn.login()

# Get your own profile
my_profile = UserProfile().get()
print(f"My profile: {my_profile.username}")

# Get another user's profile by username
profile_by_username = UserProfile.from_username(username='synapse-service-dpe-team')
print(f"Profile by username: {profile_by_username.username}")

# Get another user's profile by ID
profile_by_id = UserProfile.from_id(user_id=3485485)
print(f"Profile by id: {profile_by_id.username}")
ATTRIBUTE DESCRIPTION
ownerId

A foreign key to the ID of the 'principal' object for the user.

uri

The Uniform Resource Identifier (URI) for this entity.

etag

Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates.

firstName

This person's given name (forename)

lastName

This person's family name (surname)

emails

The list of user email addresses registered to this user.

userName

A name chosen by the user that uniquely identifies them.

summary

A summary description about this person

position

This person's current position title

location

This person's location

industry

The industry/discipline that this person is associated with

company

This person's current affiliation

profilePicureFileHandleId

The File Handle ID of the user's profile picture.

url

A link to more information about this person

notificationSettings

Source code in synapseclient/team.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
@deprecated(
    version="4.9.0",
    reason="To be removed in 5.0.0. "
    "Moved to the `from synapseclient.models import UserProfile` class. "
    "Check the docstring for the replacement function example.",
)
class UserProfile(DictObject):
    """
    **Deprecated with replacement.** This class will be removed in 5.0.0.
    Use `from synapseclient.models import UserProfile` instead.

    Information about a Synapse user.  In practice the constructor is not called directly by the client.

    Example: Migration to new method
         

        ```python
        # Old approach (DEPRECATED)
        # from synapseclient.team import UserProfile

        # New approach (RECOMMENDED)
        from synapseclient import Synapse
        from synapseclient.models import UserProfile

        syn = Synapse()
        syn.login()

        # Get your own profile
        my_profile = UserProfile().get()
        print(f"My profile: {my_profile.username}")

        # Get another user's profile by username
        profile_by_username = UserProfile.from_username(username='synapse-service-dpe-team')
        print(f"Profile by username: {profile_by_username.username}")

        # Get another user's profile by ID
        profile_by_id = UserProfile.from_id(user_id=3485485)
        print(f"Profile by id: {profile_by_id.username}")
        ```

    Attributes:
        ownerId: A foreign key to the ID of the 'principal' object for the user.
        uri: The Uniform Resource Identifier (URI) for this entity.
        etag: Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates.
        Since the E-Tag changes every time an entity is updated it is
        used to detect when a client's current representation
        of an entity is out-of-date.
        firstName: This person's given name (forename)
        lastName: This person's family name (surname)
        emails: The list of user email addresses registered to this user.
        userName: A name chosen by the user that uniquely identifies them.
        summary: A summary description about this person
        position: This person's current position title
        location: This person's location
        industry: The industry/discipline that this person is associated with
        company: This person's current affiliation
        profilePicureFileHandleId: The File Handle ID of the user's profile picture.
        url: A link to more information about this person
        notificationSettings: An object of type [org.sagebionetworks.repo.model.message.Settings](https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/message/Settings.html)
        containing the user's preferences regarding when email notifications should be sent
    """

    def __init__(self, **kwargs):
        super(UserProfile, self).__init__(kwargs)

UserGroupHeader

Bases: DictObject

Deprecated with replacement. This class will be removed in 5.0.0. Use from synapseclient.models import UserGroupHeader instead.

Select metadata about a Synapse principal. In practice the constructor is not called directly by the client.

Migration to new method
# Old approach (DEPRECATED)
# from synapseclient.team import UserGroupHeader

# New approach (RECOMMENDED)
from synapseclient.models import UserGroupHeader
ATTRIBUTE DESCRIPTION
firstName

First Name

lastName

Last Name

userName

A name chosen by the user that uniquely identifies them.

email

User's current email address

isIndividual

True if this is a user, false if it is a group

Source code in synapseclient/team.py
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
@deprecated(
    version="4.9.0",
    reason="To be removed in 5.0.0. "
    "Moved to the `from synapseclient.models import UserGroupHeader` class. "
    "Check the docstring for the replacement function example.",
)
class UserGroupHeader(DictObject):
    """
    **Deprecated with replacement.** This class will be removed in 5.0.0.
    Use `from synapseclient.models import UserGroupHeader` instead.

    Select metadata about a Synapse principal.
    In practice the constructor is not called directly by the client.

    Example: Migration to new method
        ```python
        # Old approach (DEPRECATED)
        # from synapseclient.team import UserGroupHeader

        # New approach (RECOMMENDED)
        from synapseclient.models import UserGroupHeader
        ```

    Attributes:
        ownerId A foreign key to the ID of the 'principal' object for the user.
        firstName: First Name
        lastName: Last Name
        userName: A name chosen by the user that uniquely identifies them.
        email: User's current email address
        isIndividual: True if this is a user, false if it is a group
    """

    def __init__(self, **kwargs):
        super(UserGroupHeader, self).__init__(kwargs)

Team

Bases: DictObject

Deprecated with replacement. This class will be removed in 5.0.0. Use from synapseclient.models import Team instead.

Represents a Synapse Team. User definable fields are:

Migration to new method

 

# Old approach (DEPRECATED)
# from synapseclient.team import Team

# New approach (RECOMMENDED)
from synapseclient import Synapse
from synapseclient.models import Team

syn = Synapse()
syn.login()

# Create a new team
new_team = Team(name="My Team", description="A sample team")
created_team = new_team.create()
print(f"Created team: {created_team.name}")

# Get a team by ID
team_by_id = Team.from_id(id=12345)
print(f"Team by ID: {team_by_id.name}")

# Get a team by name
team_by_name = Team.from_name(name="My Team")
print(f"Team by name: {team_by_name.name}")

# Get team members
members = team_by_id.members()
print(f"Team has {len(members)} members")
ATTRIBUTE DESCRIPTION
icon

The fileHandleId for icon image of the Team

description

A short description of this Team.

name

The name of the Team.

canPublicJoin

true for teams which members can join without an invitation or approval

Source code in synapseclient/team.py
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
@deprecated(
    version="4.9.0",
    reason="To be removed in 5.0.0. "
    "Moved to the `from synapseclient.models import Team` class. "
    "Check the docstring for the replacement function example.",
)
class Team(DictObject):
    """
    **Deprecated with replacement.** This class will be removed in 5.0.0.
    Use `from synapseclient.models import Team` instead.

    Represents a [Synapse Team](https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/Team.html).
    User definable fields are:

    Example: Migration to new method
         

        ```python
        # Old approach (DEPRECATED)
        # from synapseclient.team import Team

        # New approach (RECOMMENDED)
        from synapseclient import Synapse
        from synapseclient.models import Team

        syn = Synapse()
        syn.login()

        # Create a new team
        new_team = Team(name="My Team", description="A sample team")
        created_team = new_team.create()
        print(f"Created team: {created_team.name}")

        # Get a team by ID
        team_by_id = Team.from_id(id=12345)
        print(f"Team by ID: {team_by_id.name}")

        # Get a team by name
        team_by_name = Team.from_name(name="My Team")
        print(f"Team by name: {team_by_name.name}")

        # Get team members
        members = team_by_id.members()
        print(f"Team has {len(members)} members")
        ```

    Attributes:
        icon: The fileHandleId for icon image of the Team
        description: A short description of this Team.
        name: The name of the Team.
        canPublicJoin: true for teams which members can join without an invitation or approval
    """

    def __init__(self, **kwargs):
        super(Team, self).__init__(kwargs)

    @classmethod
    def getURI(cls, id):
        return "/team/%s" % id

    def postURI(self):
        return "/team"

    def putURI(self):
        return "/team"

    def deleteURI(self):
        return "/team/%s" % self.id

    def getACLURI(self):
        return "/team/%s/acl" % self.id

    def putACLURI(self):
        return "/team/acl"

TeamMember

Bases: DictObject

Deprecated with replacement. This class will be removed in 5.0.0. Use from synapseclient.models import TeamMember instead.

Contains information about a user's membership in a Team. In practice the constructor is not called directly by the client.

Migration to new method
# Old approach (DEPRECATED)
# from synapseclient.team import TeamMember

# New approach (RECOMMENDED)
from synapseclient import Synapse
from synapseclient.models import Team, TeamMember

syn = Synapse()
syn.login()

# Get team members using the new Team model
team = Team.from_id(id=12345)
members = team.members()
for member in members:
    print(f"Member: {member.member.user_name}")
ATTRIBUTE DESCRIPTION
teamId

The ID of the team

member

An object of type org.sagebionetworks.repo.model.UserGroupHeader describing the member

isAdmin

Whether the given member is an administrator of the team

Source code in synapseclient/team.py
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
@deprecated(
    version="4.9.0",
    reason="To be removed in 5.0.0. "
    "Moved to the `from synapseclient.models import TeamMember` class. "
    "Check the docstring for the replacement function example.",
)
class TeamMember(DictObject):
    """
    **Deprecated with replacement.** This class will be removed in 5.0.0.
    Use `from synapseclient.models import TeamMember` instead.

    Contains information about a user's membership in a Team.
    In practice the constructor is not called directly by the client.

    Example: Migration to new method
        ```python
        # Old approach (DEPRECATED)
        # from synapseclient.team import TeamMember

        # New approach (RECOMMENDED)
        from synapseclient import Synapse
        from synapseclient.models import Team, TeamMember

        syn = Synapse()
        syn.login()

        # Get team members using the new Team model
        team = Team.from_id(id=12345)
        members = team.members()
        for member in members:
            print(f"Member: {member.member.user_name}")
        ```

    Attributes:
        teamId: The ID of the team
        member: An object of type [org.sagebionetworks.repo.model.UserGroupHeader](https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/UserGroupHeader.html)
                describing the member
        isAdmin: Whether the given member is an administrator of the team

    """

    def __init__(self, **kwargs):
        if "member" in kwargs:
            kwargs["member"] = UserGroupHeader(**kwargs["member"])
        super(TeamMember, self).__init__(kwargs)