projectal.entities.department

 1from projectal.entity import Entity
 2from projectal import api
 3from projectal.linkers import *
 4
 5
 6class Department(
 7    Entity, StaffLinker, DepartmentLinker, CompanyLinker, NoteLinker, TagLinker
 8):
 9    """
10    Implementation of the [Department](https://projectal.com/docs/latest/#tag/Department) API.
11    """
12
13    _path = "department"
14    _name = "department"
15    _links = [StaffLinker, DepartmentLinker, NoteLinker, TagLinker]
16    _links_reverse = [CompanyLinker]
17
18    @staticmethod
19    def tree(
20        holder=None,
21        level=None,
22        active_staff=True,
23        inactive_staff=True,
24        generic_staff=False,
25    ):
26        """
27        Return department list in tree format
28
29        `holder`: Project, Company, or Staff. If None, the full department chart
30        is returned (default: `None`)
31
32        `level`: If `True`, only returns the top level of the
33        hierarchy (default: `False`)
34
35        `active_staff`: If `True`, includes the list of staff in each
36        department who are considered 'active' (i.e, today is within
37        their start and end dates) (default: `True`)
38
39        'inactive_staff`: If `True`, includes the list of staff in each
40        department who are considered 'inactive' (i.e, today is outside
41        their start and end dates) (default: `True`)
42
43        `generic_staff`: Include generic staff in results
44        """
45        url = "/api/department/tree?"
46        params = []
47        params.append("uuId={}".format(holder["uuId"])) if holder else None
48        params.append("level=true") if level else None
49        params.append("activeStaff={}".format("true" if active_staff else "false"))
50        params.append("inactiveStaff={}".format("true" if inactive_staff else "false"))
51        params.append("genericStaff={}".format("true" if generic_staff else "false"))
52        url += "&".join(params)
53
54        return api.get(url)
 7class Department(
 8    Entity, StaffLinker, DepartmentLinker, CompanyLinker, NoteLinker, TagLinker
 9):
10    """
11    Implementation of the [Department](https://projectal.com/docs/latest/#tag/Department) API.
12    """
13
14    _path = "department"
15    _name = "department"
16    _links = [StaffLinker, DepartmentLinker, NoteLinker, TagLinker]
17    _links_reverse = [CompanyLinker]
18
19    @staticmethod
20    def tree(
21        holder=None,
22        level=None,
23        active_staff=True,
24        inactive_staff=True,
25        generic_staff=False,
26    ):
27        """
28        Return department list in tree format
29
30        `holder`: Project, Company, or Staff. If None, the full department chart
31        is returned (default: `None`)
32
33        `level`: If `True`, only returns the top level of the
34        hierarchy (default: `False`)
35
36        `active_staff`: If `True`, includes the list of staff in each
37        department who are considered 'active' (i.e, today is within
38        their start and end dates) (default: `True`)
39
40        'inactive_staff`: If `True`, includes the list of staff in each
41        department who are considered 'inactive' (i.e, today is outside
42        their start and end dates) (default: `True`)
43
44        `generic_staff`: Include generic staff in results
45        """
46        url = "/api/department/tree?"
47        params = []
48        params.append("uuId={}".format(holder["uuId"])) if holder else None
49        params.append("level=true") if level else None
50        params.append("activeStaff={}".format("true" if active_staff else "false"))
51        params.append("inactiveStaff={}".format("true" if inactive_staff else "false"))
52        params.append("genericStaff={}".format("true" if generic_staff else "false"))
53        url += "&".join(params)
54
55        return api.get(url)

Implementation of the Department API.

@staticmethod
def tree( holder=None, level=None, active_staff=True, inactive_staff=True, generic_staff=False):
19    @staticmethod
20    def tree(
21        holder=None,
22        level=None,
23        active_staff=True,
24        inactive_staff=True,
25        generic_staff=False,
26    ):
27        """
28        Return department list in tree format
29
30        `holder`: Project, Company, or Staff. If None, the full department chart
31        is returned (default: `None`)
32
33        `level`: If `True`, only returns the top level of the
34        hierarchy (default: `False`)
35
36        `active_staff`: If `True`, includes the list of staff in each
37        department who are considered 'active' (i.e, today is within
38        their start and end dates) (default: `True`)
39
40        'inactive_staff`: If `True`, includes the list of staff in each
41        department who are considered 'inactive' (i.e, today is outside
42        their start and end dates) (default: `True`)
43
44        `generic_staff`: Include generic staff in results
45        """
46        url = "/api/department/tree?"
47        params = []
48        params.append("uuId={}".format(holder["uuId"])) if holder else None
49        params.append("level=true") if level else None
50        params.append("activeStaff={}".format("true" if active_staff else "false"))
51        params.append("inactiveStaff={}".format("true" if inactive_staff else "false"))
52        params.append("genericStaff={}".format("true" if generic_staff else "false"))
53        url += "&".join(params)
54
55        return api.get(url)

Return department list in tree format

holder: Project, Company, or Staff. If None, the full department chart is returned (default: None)

level: If True, only returns the top level of the hierarchy (default: False)

active_staff: If True, includes the list of staff in each department who are considered 'active' (i.e, today is within their start and end dates) (default: True)

'inactive_staff: IfTrue, includes the list of staff in each department who are considered 'inactive' (i.e, today is outside their start and end dates) (default:True`)

generic_staff: Include generic staff in results