""" 字典管理 API 客户端 """ from httpx import AsyncClient class DictionaryAPI: """字典管理 API 客户端""" def __init__(self, client: AsyncClient): self.client = client async def get_dictionary_list(self): """获取字典列表""" return await self.client.get('/api/dictionary') async def get_dictionary_by_id(self, dictionary_id): """根据ID获取字典""" return await self.client.get(f'/api/dictionary/{dictionary_id}') async def create_dictionary(self, dictionary_data): """创建字典""" return await self.client.post('/api/dictionary', json=dictionary_data) async def update_dictionary(self, dictionary_id, dictionary_data): """更新字典""" return await self.client.put(f'/api/dictionary/{dictionary_id}', json=dictionary_data) async def delete_dictionary(self, dictionary_id): """删除字典""" return await self.client.delete(f'/api/dictionary/{dictionary_id}')