Skip to content

Workspaces

Workspaces

Bases: GenericRequestMethod

Class responsible to make calls to Kanbanize Workspaces endpoints

Source code in kanbanize_sdk/endpoints/workspaces.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
class Workspaces(GenericRequestMethod):
    """
    Class responsible to make calls to Kanbanize Workspaces endpoints
    """
    endpoint = '/workspaces'

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

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

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

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

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

    def insert(self, body: WorkspacesInsertBody | dict) -> dict:
        """
        This method is responsible to add a workspace to the platform.

        Parameters:
            body: It's a dataclass object that provide the essential request body needed to add an workspace to the platform.

        Returns:
            An workspace object with the basic information data
        """

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

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

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

        Parameters:
            workspace_id: An integer parameter that represents the workspace identification.

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

    def update(self, workspace_id: int, body: WorkspacesUpdateBody | dict) -> dict:
        """
        This method is responsible to update an workspace in the platform.

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

        Returns:
            The updated workspace object
        """

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

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

get(workspace_id)

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

Parameters:

Name Type Description Default
workspace_id int

An integer parameter that represents the workspace identification.

required

Returns:

Type Description
dict

A searched workspace object

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

    Parameters:
        workspace_id: An integer parameter that represents the workspace identification.

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

insert(body)

This method is responsible to add a workspace to the platform.

Parameters:

Name Type Description Default
body WorkspacesInsertBody | dict

It's a dataclass object that provide the essential request body needed to add an workspace to the platform.

required

Returns:

Type Description
dict

An workspace object with the basic information data

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

    Parameters:
        body: It's a dataclass object that provide the essential request body needed to add an workspace to the platform.

    Returns:
        An workspace object with the basic information data
    """

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

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

list(params=None)

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

Parameters:

Name Type Description Default
params WorkspacesListParams | dict | None

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

None

Returns:

Type Description
list

An array of objects that represents the workspaces

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

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

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

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

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

update(workspace_id, body)

This method is responsible to update an workspace in the platform.

Parameters:

Name Type Description Default
workspace_id int

An integer parameter that represents the workspace identification.

required
body WorkspacesUpdateBody | dict

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

required

Returns:

Type Description
dict

The updated workspace object

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

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

    Returns:
        The updated workspace object
    """

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

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