projectal.entities.company API documentation

# projectal.entities.company

View Source

    from projectal.entity import Entity
    from projectal.linkers import *
    from projectal import api

    class Company(Entity, StaffLinker, CompanyLinker, DepartmentLinker, LocationLinker,
                  ProjectLinker, ContactLinker):
        """
        Implementation of the [Company](https://projectal.com/docs/latest/#tag/Company) API.
        """
        _path = 'company'
        _name = 'COMPANY'

        @classmethod
        def tree(cls, uuId=None, level=False, include_department=False):
            """
            Return company list in organisation chart format.

            `uuId`: Of a company. If no company is requested, the full
            organizational chart is returned (default: `None`)

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

            `include_department`: If `True`, lists all departments within
            each company and their sub-companies (default: `False`).

            """
            url = '/api/company/tree?'
            params = []
            params.append('uuId={}'.format(uuId)) if uuId else None
            params.append('level=true') if level else None
            params.append('includeDepartment=true') if include_department else None
            url += '&'.join(params)

            return api.get(url)

        @classmethod
        def get_primary_company(cls):
            """Return the Primary company"""
            payload = {
                "name": "Find primary company uuId",
                "type": "msql", "start": 0, "limit": 1,
                "select": [
                    ["COMPANY.uuId"]
                ],
                "filter": [["COMPANY.type", 'eq', 'Primary']]
            }
            response = api.query(payload)
            uuId = response[0][0]
            return cls.get(uuId)

class Company(projectal.entity.Entity, projectal.linkers.StaffLinker, projectal.linkers.CompanyLinker, projectal.linkers.DepartmentLinker, projectal.linkers.LocationLinker, projectal.linkers.ProjectLinker, projectal.linkers.ContactLinker):
View Source

    class Company(Entity, StaffLinker, CompanyLinker, DepartmentLinker, LocationLinker,
                  ProjectLinker, ContactLinker):
        """
        Implementation of the [Company](https://projectal.com/docs/latest/#tag/Company) API.
        """
        _path = 'company'
        _name = 'COMPANY'

        @classmethod
        def tree(cls, uuId=None, level=False, include_department=False):
            """
            Return company list in organisation chart format.

            `uuId`: Of a company. If no company is requested, the full
            organizational chart is returned (default: `None`)

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

            `include_department`: If `True`, lists all departments within
            each company and their sub-companies (default: `False`).

            """
            url = '/api/company/tree?'
            params = []
            params.append('uuId={}'.format(uuId)) if uuId else None
            params.append('level=true') if level else None
            params.append('includeDepartment=true') if include_department else None
            url += '&'.join(params)

            return api.get(url)

        @classmethod
        def get_primary_company(cls):
            """Return the Primary company"""
            payload = {
                "name": "Find primary company uuId",
                "type": "msql", "start": 0, "limit": 1,
                "select": [
                    ["COMPANY.uuId"]
                ],
                "filter": [["COMPANY.type", 'eq', 'Primary']]
            }
            response = api.query(payload)
            uuId = response[0][0]
            return cls.get(uuId)

Implementation of the Company API.

@classmethod
def tree(cls, uuId=None, level=False, include_department=False):
View Source

        @classmethod
        def tree(cls, uuId=None, level=False, include_department=False):
            """
            Return company list in organisation chart format.

            `uuId`: Of a company. If no company is requested, the full
            organizational chart is returned (default: `None`)

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

            `include_department`: If `True`, lists all departments within
            each company and their sub-companies (default: `False`).

            """
            url = '/api/company/tree?'
            params = []
            params.append('uuId={}'.format(uuId)) if uuId else None
            params.append('level=true') if level else None
            params.append('includeDepartment=true') if include_department else None
            url += '&'.join(params)

            return api.get(url)

Return company list in organisation chart format.

`uuId`: Of a company. If no company is requested, the full organizational chart is returned (default: `None`)

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

`include_department`: If `True`, lists all departments within each company and their sub-companies (default: `False`).

@classmethod
def get_primary_company(cls):
View Source

        @classmethod
        def get_primary_company(cls):
            """Return the Primary company"""
            payload = {
                "name": "Find primary company uuId",
                "type": "msql", "start": 0, "limit": 1,
                "select": [
                    ["COMPANY.uuId"]
                ],
                "filter": [["COMPANY.type", 'eq', 'Primary']]
            }
            response = api.query(payload)
            uuId = response[0][0]
            return cls.get(uuId)

Return the Primary company

##### Inherited Members

projectal.entity.Entity
  Entity
  get
  update
  delete
  create
  save
  clone
  history
  list
  match
  match_startswith
  match_endswith
  search
  query
  profile_get
  profile_set
  changes
  set_readonly
projectal.linkers.StaffLinker
  link_staff
  relink_staff
  unlink_staff
projectal.linkers.CompanyLinker
  link_company
  unlink_company
projectal.linkers.DepartmentLinker
  link_department
  unlink_department
projectal.linkers.LocationLinker
  link_location
  unlink_location
projectal.linkers.ProjectLinker
  link_project
  unlink_project
projectal.linkers.ContactLinker
  link_contact
  unlink_contact
builtins.dict
  setdefault
  pop
  popitem
  keys
  items
  values
  fromkeys
  clear
  copy