Skip to content

Teams

Teams

Bases: GenericRequestMethod

Class responsible to make calls to Kanbanize teams endpoints

Source code in kanbanize_sdk/endpoints/teams.py
 5
 6
 7
 8
 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
73
74
75
76
77
78
79
80
class Teams(GenericRequestMethod):
    """
    Class responsible to make calls to Kanbanize teams endpoints
    """
    endpoint = '/teams'

    def list(self, params: TeamsListParams | dict | None = None) -> list:
        """
        This method is responsible to list all teams in the platform.

        Parameters:
            params: It's a dataclass object that provide all possible parameters to be used to list the teams.

        Returns:
            An array of objects that represents the teams
        """

        params = params.to_dict() if isinstance(params, TeamsListParams) else params

        return self.service.get(self.endpoint, params=params)

    def insert(self, body: TeamsInsertBody | dict) -> dict:
        """
        This method is responsible to invite a team to the platform.

        Parameters:
            body: It's a dataclass object that provide the essential request body needed to invite a team to the platform.

        Returns:
            A team object with the basic information data
        """

        payload = body.to_dict() if isinstance(body, TeamsInsertBody) else body

        return self.service.post(self.endpoint, data=payload)

    def get(self, team_id: int) -> dict:
        """
        This method is responsible to get one team from the platform.

        Parameters:
            team_id: An integer parameter that represents the team identification.

        Returns:
            A searched team object
        """
        return self.service.get(self.endpoint + f'/{team_id}')

    def update(self, team_id: int, body: TeamsUpdateBody | dict) -> dict:
        """
        This method is responsible to update a team in the platform.

        Parameters:
            team_id: An integer parameter that represents the team identification.
            body: It's a dataclass object that represent the body option to be updated.

        Returns:
            The updated team object
        """

        payload = body.to_dict() if isinstance(body, TeamsUpdateBody) else body

        return self.service.patch(self.endpoint + f'/{team_id}', data=payload)

    def delete(self, team_id: int) -> None:
        """
        This method is responsible to remove a Team from the platform.

        Parameters:
            team_id: An integer parameter that represents the team identification.

        Returns:
            None

        """
        self.service.delete(self.endpoint + f'/{team_id}')

delete(team_id)

This method is responsible to remove a Team from the platform.

Parameters:

Name Type Description Default
team_id int

An integer parameter that represents the team identification.

required

Returns:

Type Description
None

None

Source code in kanbanize_sdk/endpoints/teams.py
69
70
71
72
73
74
75
76
77
78
79
80
def delete(self, team_id: int) -> None:
    """
    This method is responsible to remove a Team from the platform.

    Parameters:
        team_id: An integer parameter that represents the team identification.

    Returns:
        None

    """
    self.service.delete(self.endpoint + f'/{team_id}')

get(team_id)

This method is responsible to get one team from the platform.

Parameters:

Name Type Description Default
team_id int

An integer parameter that represents the team identification.

required

Returns:

Type Description
dict

A searched team object

Source code in kanbanize_sdk/endpoints/teams.py
41
42
43
44
45
46
47
48
49
50
51
def get(self, team_id: int) -> dict:
    """
    This method is responsible to get one team from the platform.

    Parameters:
        team_id: An integer parameter that represents the team identification.

    Returns:
        A searched team object
    """
    return self.service.get(self.endpoint + f'/{team_id}')

insert(body)

This method is responsible to invite a team to the platform.

Parameters:

Name Type Description Default
body TeamsInsertBody | dict

It's a dataclass object that provide the essential request body needed to invite a team to the platform.

required

Returns:

Type Description
dict

A team object with the basic information data

Source code in kanbanize_sdk/endpoints/teams.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
def insert(self, body: TeamsInsertBody | dict) -> dict:
    """
    This method is responsible to invite a team to the platform.

    Parameters:
        body: It's a dataclass object that provide the essential request body needed to invite a team to the platform.

    Returns:
        A team object with the basic information data
    """

    payload = body.to_dict() if isinstance(body, TeamsInsertBody) else body

    return self.service.post(self.endpoint, data=payload)

list(params=None)

This method is responsible to list all teams in the platform.

Parameters:

Name Type Description Default
params TeamsListParams | dict | None

It's a dataclass object that provide all possible parameters to be used to list the teams.

None

Returns:

Type Description
list

An array of objects that represents the teams

Source code in kanbanize_sdk/endpoints/teams.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
def list(self, params: TeamsListParams | dict | None = None) -> list:
    """
    This method is responsible to list all teams in the platform.

    Parameters:
        params: It's a dataclass object that provide all possible parameters to be used to list the teams.

    Returns:
        An array of objects that represents the teams
    """

    params = params.to_dict() if isinstance(params, TeamsListParams) else params

    return self.service.get(self.endpoint, params=params)

update(team_id, body)

This method is responsible to update a team in the platform.

Parameters:

Name Type Description Default
team_id int

An integer parameter that represents the team identification.

required
body TeamsUpdateBody | dict

It's a dataclass object that represent the body option to be updated.

required

Returns:

Type Description
dict

The updated team object

Source code in kanbanize_sdk/endpoints/teams.py
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
def update(self, team_id: int, body: TeamsUpdateBody | dict) -> dict:
    """
    This method is responsible to update a team in the platform.

    Parameters:
        team_id: An integer parameter that represents the team identification.
        body: It's a dataclass object that represent the body option to be updated.

    Returns:
        The updated team object
    """

    payload = body.to_dict() if isinstance(body, TeamsUpdateBody) else body

    return self.service.patch(self.endpoint + f'/{team_id}', data=payload)