com.sina.weibo.sdk.openapi
类 CommentsAPI

java.lang.Object
  继承者 com.sina.weibo.sdk.openapi.AbsOpenAPI
      继承者 com.sina.weibo.sdk.openapi.CommentsAPI

public class CommentsAPI
extends AbsOpenAPI

此类封装了评论的接口。 详情请参考评论接口

作者:
SINA

字段摘要
static int AUTHOR_FILTER_ALL
          作者筛选类型,0:全部、1:我关注的人、2:陌生人
static int AUTHOR_FILTER_ATTENTIONS
           
static int AUTHOR_FILTER_STRANGER
           
static int SRC_FILTER_ALL
          来源筛选类型,0:全部、1:来自微博的评论、2:来自微群的评论
static int SRC_FILTER_WEIBO
           
static int SRC_FILTER_WEIQUN
           
 
从类 com.sina.weibo.sdk.openapi.AbsOpenAPI 继承的字段
API_SERVER, HTTPMETHOD_GET, HTTPMETHOD_POST, KEY_ACCESS_TOKEN, mAccessToken
 
构造方法摘要
CommentsAPI(Oauth2AccessToken accessToken)
          构造函数,使用各个 API 接口提供的服务前必须先获取 Token。
 
方法摘要
 void byME(long since_id, long max_id, int count, int page, int sourceType, com.sina.weibo.sdk.net.RequestListener listener)
          获取当前登录用户所发出的评论列表。
 java.lang.String byMESync(long since_id, long max_id, int count, int page, int sourceType)
           
 void create(java.lang.String comment, long id, boolean comment_ori, com.sina.weibo.sdk.net.RequestListener listener)
          对一条微博进行评论。
 java.lang.String createSync(java.lang.String comment, long id, boolean comment_ori)
           
 void destroy(long cid, com.sina.weibo.sdk.net.RequestListener listener)
          删除一条评论。
 void destroyBatch(long[] ids, com.sina.weibo.sdk.net.RequestListener listener)
          根据评论ID批量删除评论。
 java.lang.String destroyBatchSync(long[] ids)
           
 java.lang.String destroySync(long cid)
           
 void mentions(long since_id, long max_id, int count, int page, int authorType, int sourceType, com.sina.weibo.sdk.net.RequestListener listener)
          获取最新的提到当前登录用户的评论,即@我的评论 若指定此参数,则返回ID比since_id大的评论(即比since_id时间晚的评论),默认为0
 java.lang.String mentionsSync(long since_id, long max_id, int count, int page, int authorType, int sourceType)
           
 void reply(long cid, long id, java.lang.String comment, boolean without_mention, boolean comment_ori, com.sina.weibo.sdk.net.RequestListener listener)
          回复一条评论。
 java.lang.String replySync(long cid, long id, java.lang.String comment, boolean without_mention, boolean comment_ori)
           
 void show(long id, long since_id, long max_id, int count, int page, int authorType, com.sina.weibo.sdk.net.RequestListener listener)
          根据微博ID返回某条微博的评论列表。
 void showBatch(long[] cids, com.sina.weibo.sdk.net.RequestListener listener)
          根据评论ID批量返回评论信息。
 java.lang.String showBatchSync(long[] cids)
           
 java.lang.String showSync(long id, long since_id, long max_id, int count, int page, int authorType)
           
 void timeline(long since_id, long max_id, int count, int page, boolean trim_user, com.sina.weibo.sdk.net.RequestListener listener)
          获取当前登录用户的最新评论包括接收到的与发出的。
 java.lang.String timelineSync(long since_id, long max_id, int count, int page, boolean trim_user)
           
 void toME(long since_id, long max_id, int count, int page, int authorType, int sourceType, com.sina.weibo.sdk.net.RequestListener listener)
          获取当前登录用户所接收到的评论列表。
 java.lang.String toMESync(long since_id, long max_id, int count, int page, int authorType, int sourceType)
           
 
从类 com.sina.weibo.sdk.openapi.AbsOpenAPI 继承的方法
requestAsync, requestSync
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

AUTHOR_FILTER_ALL

public static final int AUTHOR_FILTER_ALL
作者筛选类型,0:全部、1:我关注的人、2:陌生人

另请参见:
常量字段值

AUTHOR_FILTER_ATTENTIONS

public static final int AUTHOR_FILTER_ATTENTIONS
另请参见:
常量字段值

AUTHOR_FILTER_STRANGER

public static final int AUTHOR_FILTER_STRANGER
另请参见:
常量字段值

SRC_FILTER_ALL

public static final int SRC_FILTER_ALL
来源筛选类型,0:全部、1:来自微博的评论、2:来自微群的评论

另请参见:
常量字段值

SRC_FILTER_WEIBO

public static final int SRC_FILTER_WEIBO
另请参见:
常量字段值

SRC_FILTER_WEIQUN

public static final int SRC_FILTER_WEIQUN
另请参见:
常量字段值
构造方法详细信息

CommentsAPI

public CommentsAPI(Oauth2AccessToken accessToken)
构造函数,使用各个 API 接口提供的服务前必须先获取 Token。

参数:
accesssToken - 访问令牌
方法详细信息

show

public void show(long id,
                 long since_id,
                 long max_id,
                 int count,
                 int page,
                 int authorType,
                 com.sina.weibo.sdk.net.RequestListener listener)
根据微博ID返回某条微博的评论列表。

参数:
id - 需要查询的微博ID。
since_id - 若指定此参数,则返回ID比since_id大的评论(即比since_id时间晚的评论),默认为0。
max_id - 若指定此参数,则返回ID小于或等于max_id的评论,默认为0。
count - 单页返回的记录条数,默认为50
page - 返回结果的页码,默认为1。
authorType - 作者筛选类型,0:全部、1:我关注的人、2:陌生人 ,默认为0。可为以下几种 :
  • AUTHOR_FILTER_ALL
  • AUTHOR_FILTER_ATTENTIONS
  • AUTHOR_FILTER_STRANGER
  • listener - 异步请求回调接口

    byME

    public void byME(long since_id,
                     long max_id,
                     int count,
                     int page,
                     int sourceType,
                     com.sina.weibo.sdk.net.RequestListener listener)
    获取当前登录用户所发出的评论列表。

    参数:
    since_id - 若指定此参数,则返回ID比since_id大的评论(即比since_id时间晚的评论),默认为0。
    max_id - 若指定此参数,则返回ID小于或等于max_id的评论,默认为0。
    count - 单页返回的记录条数,默认为50。
    page - 返回结果的页码,默认为1。
    sourceType - 来源筛选类型,0:全部、1:来自微博的评论、2:来自微群的评论,默认为0。
  • SRC_FILTER_ALL
  • SRC_FILTER_WEIBO
  • SRC_FILTER_WEIQUN
  • listener - 异步请求回调接口

    toME

    public void toME(long since_id,
                     long max_id,
                     int count,
                     int page,
                     int authorType,
                     int sourceType,
                     com.sina.weibo.sdk.net.RequestListener listener)
    获取当前登录用户所接收到的评论列表。

    参数:
    since_id - 若指定此参数,则返回ID比since_id大的评论(即比since_id时间晚的评论),默认为0。
    max_id - 若指定此参数,则返回ID小于或等于max_id的评论,默认为0。
    count - 单页返回的记录条数,默认为50。
    page - 返回结果的页码,默认为1。
    authorType - 作者筛选类型,0:全部、1:我关注的人、2:陌生人 ,默认为0。可为以下几种 :
  • AUTHOR_FILTER_ALL
  • AUTHOR_FILTER_ATTENTIONS
  • AUTHOR_FILTER_STRANGER
  • sourceType - 来源筛选类型,0:全部、1:来自微博的评论、2:来自微群的评论,默认为0。
  • SRC_FILTER_ALL
  • SRC_FILTER_WEIBO
  • SRC_FILTER_WEIQUN
  • listener - 异步请求回调接口

    timeline

    public void timeline(long since_id,
                         long max_id,
                         int count,
                         int page,
                         boolean trim_user,
                         com.sina.weibo.sdk.net.RequestListener listener)
    获取当前登录用户的最新评论包括接收到的与发出的。

    参数:
    since_id - 若指定此参数,则返回ID比since_id大的评论(即比since_id时间晚的评论),默认为0。
    max_id - 若指定此参数,则返回ID小于或等于max_id的评论,默认为0。
    count - 单页返回的记录条数,默认为50。
    page - 返回结果的页码,默认为1。
    trim_user - 返回值中user字段开关,false:返回完整user字段、true:user字段仅返回user_id,默认为false。
    listener - 异步请求回调接口

    mentions

    public void mentions(long since_id,
                         long max_id,
                         int count,
                         int page,
                         int authorType,
                         int sourceType,
                         com.sina.weibo.sdk.net.RequestListener listener)
    获取最新的提到当前登录用户的评论,即@我的评论 若指定此参数,则返回ID比since_id大的评论(即比since_id时间晚的评论),默认为0

    参数:
    since_id - 若指定此参数,则返回ID小于或等于max_id的评论,默认为0
    max_id - 若指定此参数,则返回ID小于或等于max_id的评论,默认为0
    count - 单页返回的记录条数,默认为50
    page - 返回结果的页码,默认为1
    authorType - 作者筛选类型,0:全部,1:我关注的人, 2:陌生人,默认为0
  • AUTHOR_FILTER_ALL
  • AUTHOR_FILTER_ATTENTIONS
  • AUTHOR_FILTER_STRANGER
  • sourceType - 来源筛选类型,0:全部,1:来自微博的评论,2:来自微群的评论,默认为0
  • SRC_FILTER_ALL
  • SRC_FILTER_WEIBO
  • SRC_FILTER_WEIQUN
  • listener - 异步请求回调接口

    showBatch

    public void showBatch(long[] cids,
                          com.sina.weibo.sdk.net.RequestListener listener)
    根据评论ID批量返回评论信息。

    参数:
    cids - 需要查询的批量评论ID数组,最大50
    listener - 异步请求回调接口

    create

    public void create(java.lang.String comment,
                       long id,
                       boolean comment_ori,
                       com.sina.weibo.sdk.net.RequestListener listener)
    对一条微博进行评论。

    参数:
    comment - 评论内容,内容不超过140个汉字。
    id - 需要评论的微博ID。
    comment_ori - 当评论转发微博时,是否评论给原微博
    listener - 异步请求回调接口

    destroy

    public void destroy(long cid,
                        com.sina.weibo.sdk.net.RequestListener listener)
    删除一条评论。

    参数:
    cid - 要删除的评论ID,只能删除登录用户自己发布的评论。
    listener - 异步请求回调接口

    destroyBatch

    public void destroyBatch(long[] ids,
                             com.sina.weibo.sdk.net.RequestListener listener)
    根据评论ID批量删除评论。

    参数:
    ids - 需要删除的评论ID数组,最多20个。
    listener - 异步请求回调接口

    reply

    public void reply(long cid,
                      long id,
                      java.lang.String comment,
                      boolean without_mention,
                      boolean comment_ori,
                      com.sina.weibo.sdk.net.RequestListener listener)
    回复一条评论。

    参数:
    cid - 需要回复的评论ID
    id - 需要评论的微博ID
    comment - 回复评论内容,内容不超过140个汉字
    without_mention - 回复中是否自动加入“回复@用户名”,true:是、false:否,默认为false
    comment_ori - 当评论转发微博时,是否评论给原微博,false:否、true:是,默认为false
    listener - 异步请求回调接口

    showSync

    public java.lang.String showSync(long id,
                                     long since_id,
                                     long max_id,
                                     int count,
                                     int page,
                                     int authorType)
    另请参见:
    show(long, long, long, int, int, int, RequestListener)

    byMESync

    public java.lang.String byMESync(long since_id,
                                     long max_id,
                                     int count,
                                     int page,
                                     int sourceType)
    另请参见:
    byME(long, long, int, int, int, RequestListener)

    toMESync

    public java.lang.String toMESync(long since_id,
                                     long max_id,
                                     int count,
                                     int page,
                                     int authorType,
                                     int sourceType)
    另请参见:
    toME(long, long, int, int, int, int, RequestListener)

    timelineSync

    public java.lang.String timelineSync(long since_id,
                                         long max_id,
                                         int count,
                                         int page,
                                         boolean trim_user)
    另请参见:
    timeline(long, long, int, int, boolean, RequestListener)

    mentionsSync

    public java.lang.String mentionsSync(long since_id,
                                         long max_id,
                                         int count,
                                         int page,
                                         int authorType,
                                         int sourceType)
    另请参见:
    mentions(long, long, int, int, int, int, RequestListener)

    showBatchSync

    public java.lang.String showBatchSync(long[] cids)
    另请参见:
    showBatch(long[], RequestListener)

    createSync

    public java.lang.String createSync(java.lang.String comment,
                                       long id,
                                       boolean comment_ori)
    另请参见:
    create(String, long, boolean, RequestListener)

    destroySync

    public java.lang.String destroySync(long cid)
    另请参见:
    destroyBatch(long[], RequestListener)

    destroyBatchSync

    public java.lang.String destroyBatchSync(long[] ids)
    另请参见:
    destroyBatchSync(long[])

    replySync

    public java.lang.String replySync(long cid,
                                      long id,
                                      java.lang.String comment,
                                      boolean without_mention,
                                      boolean comment_ori)
    另请参见:
    reply(long, long, String, boolean, boolean, RequestListener)