from __future__ import annotations from typing import Any from yuxi.channels.adapters.bluebubbles.client import BlueBubblesClient async def rename_chat( client: BlueBubblesClient, chat_guid: str, new_name: str, ) -> dict[str, Any]: return await client.put( f"/api/v1/chat/{chat_guid}", json={"displayName": new_name}, ) async def set_group_icon( client: BlueBubblesClient, chat_guid: str, file_path: str, ) -> dict[str, Any]: import asyncio from pathlib import Path path = Path(file_path) content = await asyncio.to_thread(path.read_bytes) files = {"chatIcon": (path.name, content)} return await client.post( f"/api/v1/chat/{chat_guid}/icon", files=files, ) async def add_participant( client: BlueBubblesClient, chat_guid: str, address: str, ) -> dict[str, Any]: return await client.post( f"/api/v1/chat/{chat_guid}/participant", json={"address": address}, ) async def remove_participant( client: BlueBubblesClient, chat_guid: str, address: str, ) -> dict[str, Any]: return await client.post( f"/api/v1/chat/{chat_guid}/removeparticipant", json={"address": address}, ) async def leave_chat( client: BlueBubblesClient, chat_guid: str, ) -> dict[str, Any]: return await client.post( f"/api/v1/chat/{chat_guid}/leave", json={}, )