Class MenuApi


  • public class MenuApi
    extends MpApi
    菜单相关API
    Since:
    JDK 1.6
    Author:
    jinyu(foxinmy@gmail.com)
    • Constructor Detail

      • MenuApi

        public MenuApi​(com.foxinmy.weixin4j.token.TokenManager tokenManager)
    • Method Detail

      • createMenu

        public com.foxinmy.weixin4j.http.weixin.ApiResult createMenu​(List<com.foxinmy.weixin4j.model.Button> buttons)
                                                              throws com.foxinmy.weixin4j.exception.WeixinException
        自定义菜单
        Parameters:
        buttons - 菜单列表
        Returns:
        处理结果
        Throws:
        com.foxinmy.weixin4j.exception.WeixinException
        See Also:
        创建自定义菜单, Button
      • getMenu

        public List<com.foxinmy.weixin4j.model.Button> getMenu()
                                                        throws com.foxinmy.weixin4j.exception.WeixinException
        查询菜单
        Returns:
        菜单集合
        Throws:
        com.foxinmy.weixin4j.exception.WeixinException
        See Also:
        查询菜单, Button
      • getAllMenu

        public List<Menu> getAllMenu()
                              throws com.foxinmy.weixin4j.exception.WeixinException
        查询全部菜单(包含个性化菜单)
        Returns:
        菜单集合
        Throws:
        com.foxinmy.weixin4j.exception.WeixinException
        See Also:
        普通菜单, 个性化菜单, Button, Menu
      • deleteMenu

        public com.foxinmy.weixin4j.http.weixin.ApiResult deleteMenu()
                                                              throws com.foxinmy.weixin4j.exception.WeixinException
        删除菜单
        Returns:
        处理结果
        Throws:
        com.foxinmy.weixin4j.exception.WeixinException
        See Also:
        删除菜单
      • createCustomMenu

        public String createCustomMenu​(List<com.foxinmy.weixin4j.model.Button> buttons,
                                       MenuMatchRule matchRule)
                                throws com.foxinmy.weixin4j.exception.WeixinException
        创建个性化菜单
        Parameters:
        buttons - 菜单列表
        matchRule - 匹配规则 至少要有一个匹配信息是不为空
        Returns:
        菜单ID
        Throws:
        com.foxinmy.weixin4j.exception.WeixinException
        See Also:
        创建个性化菜单, Button
      • deleteCustomMenu

        public com.foxinmy.weixin4j.http.weixin.ApiResult deleteCustomMenu​(String menuId)
                                                                    throws com.foxinmy.weixin4j.exception.WeixinException
        删除个性化菜单
        Returns:
        处理结果
        Throws:
        com.foxinmy.weixin4j.exception.WeixinException
        See Also:
        删除个性化菜单
      • matchCustomMenu

        public List<com.foxinmy.weixin4j.model.Button> matchCustomMenu​(String userId)
                                                                throws com.foxinmy.weixin4j.exception.WeixinException
        测试个性化菜单匹配结果
        Parameters:
        userId - 可以是粉丝的OpenID,也可以是粉丝的微信号。
        Returns:
        匹配到的菜单配置
        Throws:
        com.foxinmy.weixin4j.exception.WeixinException
        See Also:
        测试个性化菜单, Button