Class TemplateApi


  • public class TemplateApi
    extends com.foxinmy.weixin4j.api.BaseApi
    模板消息管理。
    Since:
    1.8
    See Also:
    模板消息管理
    • Constructor Detail

      • TemplateApi

        public TemplateApi​(com.foxinmy.weixin4j.token.TokenManager tokenManager)
      • TemplateApi

        public TemplateApi​(com.foxinmy.weixin4j.token.TokenManager tokenManager,
                           Properties properties)
    • Method Detail

      • getTemplatesInLibrary

        public com.foxinmy.weixin4j.model.paging.Pagedata<Template> getTemplatesInLibrary​(com.foxinmy.weixin4j.model.paging.Pageable pageable)
                                                                                   throws com.foxinmy.weixin4j.exception.WeixinException
        获取小程序模板库标题列表
        Parameters:
        pageable - the pagination information.
        Returns:
        templates in library.
        Throws:
        com.foxinmy.weixin4j.exception.WeixinException - indicates getting access token failed or getting templates failed.
        See Also:
        获取小程序模板库标题列表
      • getTemplateInLibrary

        public Template getTemplateInLibrary​(String id)
                                      throws com.foxinmy.weixin4j.exception.WeixinException
        获取模板库某个模板标题下关键词库
        Parameters:
        id - 模板标题id,可通过接口获取,也可登录小程序后台查看获取
        Returns:
        the template in library with specified ID.
        Throws:
        com.foxinmy.weixin4j.exception.WeixinException - indicates getting access token failed or getting template failed.
        See Also:
        获取模板库某个模板标题下关键词库
      • addTemplate

        public String addTemplate​(String id,
                                  int[] keywordIds)
                           throws com.foxinmy.weixin4j.exception.WeixinException
        组合模板并添加至帐号下的个人模板库
        Parameters:
        id - 模板标题id,可通过接口获取,也可登录小程序后台查看获取
        keywordIds - 开发者自行组合好的模板关键词列表,关键词顺序可以自由搭配(例如[3,5,4]或[4,5,3]),最多支持10个关键词组合
        Returns:
        the added template ID.
        Throws:
        com.foxinmy.weixin4j.exception.WeixinException - indicates getting access token failed or adding template failed.
        See Also:
        组合模板并添加至帐号下的个人模板库
      • getTemplates

        public List<Template> getTemplates​(com.foxinmy.weixin4j.model.paging.Pageable pageable)
                                    throws com.foxinmy.weixin4j.exception.WeixinException
        获取帐号下已存在的模板列表
        Parameters:
        pageable - the pagination information.
        Returns:
        the templates.
        Throws:
        com.foxinmy.weixin4j.exception.WeixinException - indicates getting access token failed or getting template failed.
        See Also:
        获取帐号下已存在的模板列表
      • deleteTemplate

        public void deleteTemplate​(String id)
                            throws com.foxinmy.weixin4j.exception.WeixinException
        删除帐号下的某个模板
        Parameters:
        id - 要删除的模板id
        Throws:
        com.foxinmy.weixin4j.exception.WeixinException - indicates getting access token failed or deleting template failed.
        See Also:
        删除帐号下的某个模板
      • weixinBundle

        protected ResourceBundle weixinBundle()
        Specified by:
        weixinBundle in class com.foxinmy.weixin4j.api.BaseApi
      • getRequestUri

        protected String getRequestUri​(String key)
        Overrides:
        getRequestUri in class com.foxinmy.weixin4j.api.BaseApi