diff options
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/hub_client.py')
| -rw-r--r-- | packages/meshbay-node/src/meshbay_node/hub_client.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/hub_client.py b/packages/meshbay-node/src/meshbay_node/hub_client.py index d8417e3..b345187 100644 --- a/packages/meshbay-node/src/meshbay_node/hub_client.py +++ b/packages/meshbay-node/src/meshbay_node/hub_client.py @@ -184,6 +184,25 @@ class HubClient: log.info("Node announced: %s (hint=%s)", node_id[:8], endpoint_hint) return node_id + # ── Group lookup ────────────────────────────────────────────────────────── + + async def list_my_groups(self) -> list[dict]: + """ + The operator's groups on the hub, hosted here or not. + + Attaching a group to a node needs its id, and nobody types a UUID — + least of all over SSH on a machine whose terminal will not paste. The + operator names the group; this is what turns the name into an id. + """ + if self._session is None: + raise RuntimeError("Not logged in") + await self.ensure_fresh_token() + + r = await self._http.get("/v1/groups/mine", + headers=self._session.auth_headers) + r.raise_for_status() + return r.json().get("groups", []) + # ── User pubkey lookup ──────────────────────────────────────────────────── async def get_user_pubkeys(self, username: str) -> dict: |