List all projects in the self-hosted instance.
(
page_num: int,
page_size: int,
fetch_all: bool,
search: Optional[str],
creator: Optional[str],
workspace: Optional[str],
save_name: str,
api: Api,
)
| 100 | ) |
| 101 | @with_custom_host |
| 102 | def list_projects( |
| 103 | page_num: int, |
| 104 | page_size: int, |
| 105 | fetch_all: bool, |
| 106 | search: Optional[str], |
| 107 | creator: Optional[str], |
| 108 | workspace: Optional[str], |
| 109 | save_name: str, |
| 110 | api: Api, |
| 111 | ): |
| 112 | """List all projects in the self-hosted instance.""" |
| 113 | sh = api.self_hosted() |
| 114 | try: |
| 115 | projects = list( |
| 116 | sh.get_projects( |
| 117 | page=page_num, |
| 118 | size=page_size, |
| 119 | all=fetch_all, |
| 120 | search=search, |
| 121 | creator=creator, |
| 122 | group=workspace, |
| 123 | ) |
| 124 | ) |
| 125 | except ValueError as e: |
| 126 | payload = format_output(ApiResponseType(ok=False, errmsg=str(e))) |
| 127 | else: |
| 128 | if sh._errors: |
| 129 | payload = format_output(ApiResponseType(ok=False, errmsg="; ".join(sh._errors))) |
| 130 | else: |
| 131 | resp = ApiResponseType(ok=True, data={"list": projects}) |
| 132 | payload = format_output(resp) |
| 133 | if save_name is not None: |
| 134 | save_output(orjson.dumps(payload, option=orjson.OPT_INDENT_2), name=save_name) |
| 135 | |
| 136 | |
| 137 | @selfhosted_cli.command("summary") |
nothing calls this directly
no test coverage detected
searching dependent graphs…