models.Team

pykechain.models.Team

class Team(json, **kwargs)[source]

A virtual object representing a KE-chain Team.

Variables
  • name – team name

  • id – uuid of the team

Construct a team from provided json data.

edit(name: ~typing.Optional[~typing.Union[str, ~pykechain.utils.Empty]] = <pykechain.utils.Empty object>, description: ~typing.Optional[~typing.Union[str, ~pykechain.utils.Empty]] = <pykechain.utils.Empty object>, options: ~typing.Optional[~typing.Union[~typing.Dict, ~pykechain.utils.Empty]] = <pykechain.utils.Empty object>, is_hidden: ~typing.Optional[~typing.Union[bool, ~pykechain.utils.Empty]] = <pykechain.utils.Empty object>, **kwargs) None[source]

Edit the attributes of the Team.

Parameters
  • name (str) –

    1. name of the Team

  • description (str) –

    1. description of the Team

  • options (dict) –

    1. options dictionary to set attributes such as landingPage.

  • is_hidden (bool) – flag to hide the Team

Returns

None

:raises IllegalArgumentError whenever inputs are not of the correct type

delete() None[source]

Delete the team.

Members of the team remain intact.

Returns

None

members(role: Optional[Union[TeamRoles, str]] = None) List[Dict][source]

Members of the team.

You may provide the role in the team, to retrieve only the team member with that role. Normally there is a single owner, that has administration rights of the team. Normal team members do not have any rights to administer the team itself such as altering the team name, team image and team members. Administrators do have the right to administer the the team members.

Parameters

role (basestring or None) – (optional) member belonging to a role pykechain.enums.TeamRoles to return.

Raises

IllegalArgumentError – when providing incorrect roles

Returns

list of dictionaries with members (pk, username, role, email)

Example

>>> my_team = client.team(name='My own team')
>>> my_team.members()
[{"pk":1, "username"="first user", "role"="OWNER", "email":"email@address.com"}, ...]
add_members(users: Optional[List[Union[User, str]]] = None, role: Optional[Union[TeamRoles, str]] = 'MEMBER') None[source]

Members to add to a team.

Parameters
  • users (List of User or List of pk) – list of members, either User objects or usernames

  • role (basestring) – (optional) role of the users to add (default TeamRoles.MEMBER)

Raises

IllegalArgumentError – when providing incorrect user information

Example

>>> my_team = client.team(name='My own team')
>>> other_user = client.users(name='That other person')
>>> myself = client.users(name='myself')
>>> my_team.add_members([myself], role=TeamRoles.MANAGER)
>>> my_team.add_members([other_user], role=TeamRoles.MEMBER)
remove_members(users: Optional[List[Union[User, str]]] = None) None[source]

Remove members from the team.

Parameters

users (List of User or List of pk) – list of members, either User objects or usernames

Raises

IllegalArgumentError – when providing incorrect user information

Example

>>> my_team = client.team(name='My own team')
>>> other_user = client.users(name='That other person')
>>> my_team.remove_members([other_user])
scopes(status: Optional[ScopeStatus] = None, **kwargs) List[Scope][source]

Scopes associated to the team.