Skip to content

folder.py

Folder (Node)

Folder object to interact with Celonis Studio API.

Source code in celonis_api/studio/folder.py
class Folder(Node):
    """Folder object to interact with Celonis Studio API."""

    @property
    def package_nodes_url(self) -> str:
        """
        !!! api "API"
            - `/package-manager/api/nodes/by-root-id/{root_node_id}`
        """
        return f"{self.celonis.url}/package-manager/api/nodes/by-root-id/{self.data['rootNodeId']}"

    @property
    def nodes(self) -> 'CelonisCollection[Node]':
        """Get all Nodes located in the Folder.

        Returns:
            A Collection of Nodes located in the Folder.
        """
        from pycelonis.celonis_api.studio.node_factory import NodeFactory

        response = self.celonis.api_request(self.package_nodes_url)
        return CelonisCollection(
            [
                NodeFactory.create_node_from_data(self.parent, self.celonis, data)
                for data in response
                if data["parentNodeKey"] == self.data["key"]  # Only return nodes in folder
            ]
        )

    @property
    def knowledge_models(self) -> 'CelonisCollection[KnowledgeModel]':
        """Get all Knowledge Models located in Folder.

        Returns:
            A Collection of Knowledge Models located in Folder
        """
        return CelonisCollection([n for n in self.nodes if isinstance(n, KnowledgeModel)])

    @property
    def analyses(self) -> 'CelonisCollection[Analysis]':
        """Get all Analyses located in Folder.

        Returns:
            A Collection of Analysis located in Folder.
        """
        return CelonisCollection([n for n in self.nodes if isinstance(n, Analysis)])

    @property
    def views(self) -> 'CelonisCollection[View]':
        """Get all Views located in Folder.

        Returns:
            A Collection of Views located in Folder.
        """
        return CelonisCollection([n for n in self.nodes if isinstance(n, View)])

    @property
    def skills(self) -> 'CelonisCollection[Skill]':
        """Get all Skills located in Folder.

        Returns:
            A Collection of Skills located in Folder.
        """
        return CelonisCollection([n for n in self.nodes if isinstance(n, Skill)])

    @property
    def folders(self) -> 'CelonisCollection[Folder]':
        """Get all Folders located in Folder.

        Returns:
            A Collection of Folders located in Folder.
        """
        return CelonisCollection([n for n in self.nodes if isinstance(n, Folder)])

analyses: CelonisCollection[Analysis] property readonly

Get all Analyses located in Folder.

Returns:

Type Description
CelonisCollection[Analysis]

A Collection of Analysis located in Folder.

folders: CelonisCollection[Folder] property readonly

Get all Folders located in Folder.

Returns:

Type Description
CelonisCollection[Folder]

A Collection of Folders located in Folder.

knowledge_models: CelonisCollection[KnowledgeModel] property readonly

Get all Knowledge Models located in Folder.

Returns:

Type Description
CelonisCollection[KnowledgeModel]

A Collection of Knowledge Models located in Folder

nodes: CelonisCollection[Node] property readonly

Get all Nodes located in the Folder.

Returns:

Type Description
CelonisCollection[Node]

A Collection of Nodes located in the Folder.

package_nodes_url: str property readonly

API

  • /package-manager/api/nodes/by-root-id/{root_node_id}

skills: CelonisCollection[Skill] property readonly

Get all Skills located in Folder.

Returns:

Type Description
CelonisCollection[Skill]

A Collection of Skills located in Folder.

views: CelonisCollection[View] property readonly

Get all Views located in Folder.

Returns:

Type Description
CelonisCollection[View]

A Collection of Views located in Folder.