Skip to content

team

dapla-team-api Team model.

Team

Bases: BaseModel

Information about a Dapla team.

Source code in dapla_team_cli/api/models/team.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class Team(BaseModel):
    """Information about a Dapla team."""

    uniform_team_name: str = Field(alias="uniformTeamName")
    display_team_name: str = Field(alias="displayTeamName")
    repo: str
    links: Dict[str, Link] = Field(alias="_links")

    def users(self) -> Result[List[User], str]:
        """Get a list of users in this team."""
        return get_resource(DaplaTeamApiRequest(endpoint=self.links["users"].href, body=None)).map(parse_users)

    def groups(self) -> Result[List[Group], str]:
        """Get a list of auth groups in this team."""
        return get_resource(DaplaTeamApiRequest(endpoint=self.links["groups"].href, body=None)).map(parse_groups)

groups()

Get a list of auth groups in this team.

Source code in dapla_team_cli/api/models/team.py
32
33
34
def groups(self) -> Result[List[Group], str]:
    """Get a list of auth groups in this team."""
    return get_resource(DaplaTeamApiRequest(endpoint=self.links["groups"].href, body=None)).map(parse_groups)

users()

Get a list of users in this team.

Source code in dapla_team_cli/api/models/team.py
28
29
30
def users(self) -> Result[List[User], str]:
    """Get a list of users in this team."""
    return get_resource(DaplaTeamApiRequest(endpoint=self.links["users"].href, body=None)).map(parse_users)

parse_teams(teams_json)

Parse JSON into a list of Teams.

Source code in dapla_team_cli/api/models/team.py
37
38
39
40
41
def parse_teams(teams_json: Dict[str, Any]) -> List[Team]:
    """Parse JSON into a list of Teams."""
    if "_embedded" not in teams_json or "teamList" not in teams_json["_embedded"]:
        return []
    return parse_obj_as(List[Team], teams_json["_embedded"]["teamList"])