Skip to content

Commit c385c00

Browse files
author
nazarfil
committed
add method for current worksapce
1 parent c97521f commit c385c00

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

openhexa/sdk/workspaces/current_workspace.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,3 +661,27 @@ def get_file(self, path: str) -> File:
661661
size=result.size,
662662
type=result.type,
663663
)
664+
665+
def get_webapp(self, webapp_slug: str):
666+
"""Get a webapp by its slug.
667+
668+
Parameters
669+
----------
670+
webapp_slug : str
671+
The slug identifier of the webapp
672+
673+
Returns
674+
-------
675+
The webapp object with name, url, description and other properties
676+
677+
Raises
678+
------
679+
ValueError
680+
If the webapp does not exist
681+
"""
682+
webapp = OpenHexaClient().get_webapp_by_slug(workspace_slug=self.slug, webapp_slug=webapp_slug)
683+
684+
if not webapp:
685+
raise ValueError(f"Webapp {webapp_slug} does not exist in workspace {self.slug}.")
686+
687+
return webapp

0 commit comments

Comments
 (0)