wechatpy.work.client.api.menu 源代码
# -*- coding: utf-8 -*-
from wechatpy.client.api.base import BaseWeChatAPI
[文档]class WeChatMenu(BaseWeChatAPI):
"""
自定义菜单
"""
[文档] def create(self, agent_id: int, menu_data: dict) -> dict:
"""
创建菜单
详情请参考:
https://developer.work.weixin.qq.com/document/path/90231
:param agent_id: 应用id
"""
return self._post("menu/create", params={"agentid": agent_id}, data=menu_data)
[文档] def get(self, agent_id: int) -> dict:
"""
获取菜单
详情请参考:
https://developer.work.weixin.qq.com/document/path/90232
:param agent_id: 应用id
"""
return self._get("menu/get", params={"agentid": agent_id})
[文档] def delete(self, agent_id: int) -> dict:
"""
删除菜单
详情请参考:
https://developer.work.weixin.qq.com/document/path/90233
:param agent_id: 应用id
"""
return self._get("menu/delete", params={"agentid": agent_id})
def update(self, agent_id: int, menu_data: dict) -> dict:
self.delete(agent_id)
return self.create(agent_id, menu_data)