Skip to content

Workflows

Workflows

Bases: GenericRequestMethod

Class responsible to make calls to Kanbanize workflows endpoints

Source code in kanbanize_sdk/endpoints/workflows.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
class Workflows(GenericRequestMethod):
    """
    Class responsible to make calls to Kanbanize workflows endpoints
    """
    endpoint = '/boards'

    def list(self, board_id: int) -> list:
        """
        This method is responsible to list all workflows from a board in the platform.

        Parameters:
            board_id: An integer parameter that represents the board identification.

        Returns:
            An array of objects that represents the workflows
        """
        return self.service.get(self.endpoint + f'/{board_id}/workflows')

    def insert(self, board_id: int, body: WorkflowsInsetBody | dict) -> dict:
        """
        This method is responsible to insert a workflow to the board into the platform.

        Parameters:
            board_id: An integer parameter that represents the board identification.
            body: It's a dataclass object that provide the essential request body needed to add a board to the platform.

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

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

        return self.service.post(self.endpoint + f'/{board_id}/workflows', data=payload)

    def get(self, board_id: int, workflow_id: int) -> dict:
        """
        This method is responsible to get one workflow from the board into the platform.

        Parameters:
            board_id: An integer parameter that represents the board identification.
            workflow_id: An integer parameter that represents the workflow identification.

        Returns:
            A searched workflow object
        """
        return self.service.get(self.endpoint + f'/{board_id}/workflows/{workflow_id}')

    def update(self, board_id: int, workflow_id: int, body: WorkflowsUpdateBody | dict) -> dict:
        """
        This method is responsible to update one workflow from a board into the platform.

        Parameters:
            board_id: An integer parameter that represents the board identification.
            workflow_id: An integer parameter that represents the workflow identification.
            body: It's a dataclass object that represent the body option to be updated.

        Returns:
            The updated workflow object
        """

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

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

    def delete(self, board_id: int, workflow_id: int) -> None:
        """
        This method is responsible to remove a workflow from the board into the platform.

        Parameters:
            board_id: An integer parameter that represents the board identification.
            workflow_id: An integer parameter that represents the workflow identification.

        """
        return self.service.delete(self.endpoint + f'/{board_id}/workflows/{workflow_id}')

    def copy(self, board_id: int, workflow_id: int, body: WorkflowsCopyBody | dict) -> dict:
        """
        This method is responsible to make a copy of one workflow from the board into the platform.

        Parameters:
            board_id: An integer parameter that represents the board identification.
            workflow_id: An integer parameter that represents the workflow identification.
            body: It's a dataclass object that represent the body option to be coped.

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

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

        return self.service.post(self.endpoint + f'/{board_id}/workflows/{workflow_id}/copy', data=payload)

copy(board_id, workflow_id, body)

This method is responsible to make a copy of one workflow from the board into the platform.

Parameters:

Name Type Description Default
board_id int

An integer parameter that represents the board identification.

required
workflow_id int

An integer parameter that represents the workflow identification.

required
body WorkflowsCopyBody | dict

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

required

Returns:

Type Description
dict

A workflow object with the basic information data

Source code in kanbanize_sdk/endpoints/workflows.py
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
def copy(self, board_id: int, workflow_id: int, body: WorkflowsCopyBody | dict) -> dict:
    """
    This method is responsible to make a copy of one workflow from the board into the platform.

    Parameters:
        board_id: An integer parameter that represents the board identification.
        workflow_id: An integer parameter that represents the workflow identification.
        body: It's a dataclass object that represent the body option to be coped.

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

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

    return self.service.post(self.endpoint + f'/{board_id}/workflows/{workflow_id}/copy', data=payload)

delete(board_id, workflow_id)

This method is responsible to remove a workflow from the board into the platform.

Parameters:

Name Type Description Default
board_id int

An integer parameter that represents the board identification.

required
workflow_id int

An integer parameter that represents the workflow identification.

required
Source code in kanbanize_sdk/endpoints/workflows.py
69
70
71
72
73
74
75
76
77
78
def delete(self, board_id: int, workflow_id: int) -> None:
    """
    This method is responsible to remove a workflow from the board into the platform.

    Parameters:
        board_id: An integer parameter that represents the board identification.
        workflow_id: An integer parameter that represents the workflow identification.

    """
    return self.service.delete(self.endpoint + f'/{board_id}/workflows/{workflow_id}')

get(board_id, workflow_id)

This method is responsible to get one workflow from the board into the platform.

Parameters:

Name Type Description Default
board_id int

An integer parameter that represents the board identification.

required
workflow_id int

An integer parameter that represents the workflow identification.

required

Returns:

Type Description
dict

A searched workflow object

Source code in kanbanize_sdk/endpoints/workflows.py
39
40
41
42
43
44
45
46
47
48
49
50
def get(self, board_id: int, workflow_id: int) -> dict:
    """
    This method is responsible to get one workflow from the board into the platform.

    Parameters:
        board_id: An integer parameter that represents the board identification.
        workflow_id: An integer parameter that represents the workflow identification.

    Returns:
        A searched workflow object
    """
    return self.service.get(self.endpoint + f'/{board_id}/workflows/{workflow_id}')

insert(board_id, body)

This method is responsible to insert a workflow to the board into the platform.

Parameters:

Name Type Description Default
board_id int

An integer parameter that represents the board identification.

required
body WorkflowsInsetBody | dict

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

required

Returns:

Type Description
dict

A workflow object with the basic information data

Source code in kanbanize_sdk/endpoints/workflows.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
def insert(self, board_id: int, body: WorkflowsInsetBody | dict) -> dict:
    """
    This method is responsible to insert a workflow to the board into the platform.

    Parameters:
        board_id: An integer parameter that represents the board identification.
        body: It's a dataclass object that provide the essential request body needed to add a board to the platform.

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

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

    return self.service.post(self.endpoint + f'/{board_id}/workflows', data=payload)

list(board_id)

This method is responsible to list all workflows from a board in the platform.

Parameters:

Name Type Description Default
board_id int

An integer parameter that represents the board identification.

required

Returns:

Type Description
list

An array of objects that represents the workflows

Source code in kanbanize_sdk/endpoints/workflows.py
11
12
13
14
15
16
17
18
19
20
21
def list(self, board_id: int) -> list:
    """
    This method is responsible to list all workflows from a board in the platform.

    Parameters:
        board_id: An integer parameter that represents the board identification.

    Returns:
        An array of objects that represents the workflows
    """
    return self.service.get(self.endpoint + f'/{board_id}/workflows')

update(board_id, workflow_id, body)

This method is responsible to update one workflow from a board into the platform.

Parameters:

Name Type Description Default
board_id int

An integer parameter that represents the board identification.

required
workflow_id int

An integer parameter that represents the workflow identification.

required
body WorkflowsUpdateBody | dict

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

required

Returns:

Type Description
dict

The updated workflow object

Source code in kanbanize_sdk/endpoints/workflows.py
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
def update(self, board_id: int, workflow_id: int, body: WorkflowsUpdateBody | dict) -> dict:
    """
    This method is responsible to update one workflow from a board into the platform.

    Parameters:
        board_id: An integer parameter that represents the board identification.
        workflow_id: An integer parameter that represents the workflow identification.
        body: It's a dataclass object that represent the body option to be updated.

    Returns:
        The updated workflow object
    """

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

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