com.foxinmy.weixin4j.mp.api
Class TagApi

java.lang.Object
  extended by com.foxinmy.weixin4j.api.BaseApi
      extended by com.foxinmy.weixin4j.mp.api.MpApi
          extended by com.foxinmy.weixin4j.mp.api.TagApi

public class TagApi
extends MpApi

标签相关API

Since:
JDK 1.6
Author:
jinyu(foxinmy@gmail.com)
See Also:
Tag

Constructor Summary
TagApi(TokenManager tokenManager)
           
 
Method Summary
 ApiResult batchBlacklist(boolean blacklist, String... openIds)
          黑名单操作
 Tag createTag(String name)
          创建标签
 ApiResult deleteTag(int tagId)
          删除标签
 List<String> getAllBalcklistOpenIds()
          获取公众号全部的黑名单列表 请慎重使用
 List<User> getAllTagFollowing(int tagId)
          获取标签下全部的粉丝列表 请慎重使用
 List<String> getAllTagFollowingOpenIds(int tagId)
          获取标签下全部的粉丝列表 请慎重使用
 Following getBalcklistOpenIds(String nextOpenId)
          获取公众号的黑名单列表
 Following getTagFollowing(int tagId, String nextOpenId)
          获取标签下粉丝列表 请慎重使用
 Following getTagFollowingOpenIds(int tagId, String nextOpenId)
          获取标签下粉丝列表
 Integer[] getUserTags(String openId)
          获取用户身上的标签列表
 List<Tag> listTags()
          获取标签
 ApiResult taggingUsers(int tagId, String... openIds)
          批量为用户打标签:标签功能目前支持公众号为用户打上最多三个标签
 ApiResult untaggingUsers(int tagId, String... openIds)
          批量为用户取消标签
 ApiResult updateTag(Tag tag)
          更新标签
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TagApi

public TagApi(TokenManager tokenManager)
Method Detail

createTag

public Tag createTag(String name)
              throws WeixinException
创建标签

Parameters:
name - 标签名(30个字符以内)
Returns:
标签对象
Throws:
WeixinException
See Also:
Tag, 创建标签

listTags

public List<Tag> listTags()
                   throws WeixinException
获取标签

Returns:
标签列表
Throws:
WeixinException
See Also:
Tag, 获取标签

updateTag

public ApiResult updateTag(Tag tag)
                    throws WeixinException
更新标签

Parameters:
tag - 标签对象
Returns:
操作结果
Throws:
WeixinException
See Also:
Tag, 更新标签

deleteTag

public ApiResult deleteTag(int tagId)
                    throws WeixinException
删除标签

Parameters:
tagId - 标签id
Returns:
操作结果
Throws:
WeixinException
See Also:
删除标签

taggingUsers

public ApiResult taggingUsers(int tagId,
                              String... openIds)
                       throws WeixinException
批量为用户打标签:标签功能目前支持公众号为用户打上最多三个标签

Parameters:
tagId - 标签ID
openIds - 用户ID
Returns:
操作结果
Throws:
WeixinException
See Also:
批量为用户打标签

untaggingUsers

public ApiResult untaggingUsers(int tagId,
                                String... openIds)
                         throws WeixinException
批量为用户取消标签

Parameters:
tagId - 标签ID
openIds - 用户ID
Returns:
操作结果
Throws:
WeixinException
See Also:
批量为用户取消标签

getTagFollowingOpenIds

public Following getTagFollowingOpenIds(int tagId,
                                        String nextOpenId)
                                 throws WeixinException
获取标签下粉丝列表

Parameters:
tagId - 标签ID
nextOpenId - 第一个拉取的OPENID,不填默认从头开始拉取
Returns:
用户openid列表
Throws:
WeixinException
See Also:
获取标签下粉丝列表

getTagFollowing

public Following getTagFollowing(int tagId,
                                 String nextOpenId)
                          throws WeixinException
获取标签下粉丝列表 请慎重使用

Parameters:
tagId - 标签ID
nextOpenId - 第一个拉取的OPENID,不填默认从头开始拉取
Returns:
被打标签者信息 包含用户的详细信息
Throws:
WeixinException
See Also:
获取标签下粉丝列表

getAllTagFollowingOpenIds

public List<String> getAllTagFollowingOpenIds(int tagId)
                                       throws WeixinException
获取标签下全部的粉丝列表 请慎重使用

Parameters:
tagId - 标签ID
Returns:
用户openid列表
Throws:
WeixinException
See Also:
getTagFollowingOpenIds(int,String), 获取标签下粉丝列表

getAllTagFollowing

public List<User> getAllTagFollowing(int tagId)
                              throws WeixinException
获取标签下全部的粉丝列表 请慎重使用

Parameters:
tagId - 标签ID
Returns:
被打标签者信息 包含用户的详细信息
Throws:
WeixinException
See Also:
getTagFollowing(int,String), 获取标签下粉丝列表

getUserTags

public Integer[] getUserTags(String openId)
                      throws WeixinException
获取用户身上的标签列表

Parameters:
openId - 用户ID
Returns:
标签ID集合
Throws:
WeixinException
See Also:
获取用户身上的标签列表

getBalcklistOpenIds

public Following getBalcklistOpenIds(String nextOpenId)
                              throws WeixinException
获取公众号的黑名单列表

Parameters:
nextOpenId - 下一次拉取数据的openid 不填写则默认从头开始拉取
Returns:
拉黑用户列表 不包含用户的详细信息
Throws:
WeixinException
See Also:
获取黑名单列表, Following

getAllBalcklistOpenIds

public List<String> getAllBalcklistOpenIds()
                                    throws WeixinException
获取公众号全部的黑名单列表 请慎重使用

当公众号关注者数量超过10000时,可通过填写next_openid的值,从而多次拉取列表的方式来满足需求, 将上一次调用得到的返回中的next_openid值,作为下一次调用中的next_openid值

Returns:
用户openid集合
Throws:
WeixinException
See Also:
获取黑名单列表, #getFollowingOpenIds(String)

batchBlacklist

public ApiResult batchBlacklist(boolean blacklist,
                                String... openIds)
                         throws WeixinException
黑名单操作

Parameters:
blacklist - true=拉黑用户,false=取消拉黑用户
openIds - 用户ID列表
Returns:
操作结果
Throws:
WeixinException
See Also:
黑名单操作


Copyright © 2014–2017. All rights reserved.