Back to project page Music-Share-Android.
The source code is released under:
GNU General Public License
If you think the Android project Music-Share-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.weibo.sdk.android.api; /* w ww .j ava 2 s . c om*/ import com.weibo.sdk.android.Oauth2AccessToken; import com.weibo.sdk.android.WeiboParameters; import com.weibo.sdk.android.net.RequestListener; /** * ??????????????????<a href="http://open.weibo.com/wiki/API%E6%96%87%E6%A1%A3_V2#.E8.AF.84.E8.AE.BA">??????</a> * @author xiaowei6@staff.sina.com.cn * */ public class CommentsAPI extends WeiboAPI { public CommentsAPI(Oauth2AccessToken accessToken) { super(accessToken); } private static final String SERVER_URL_PRIX = API_SERVER + "/comments"; /** * ????????ID???????????????? * @param id ??????????ID? * @param since_id ????????????ID?since_id?????????since_id???????????0? * @param max_id ????????????ID??????max_id???????0? * @param count ?????????????????50 * @param page ????????????1? * @param filter_by_author ???????0?????1????????2????????0? * @param listener */ public void show(long id, long since_id, long max_id, int count, int page, AUTHOR_FILTER filter_by_author,RequestListener listener) { WeiboParameters params = new WeiboParameters(); params.add("id", id); params.add("since_id", since_id); params.add("max_id", max_id); params.add("count", count); params.add("page", page); params.add("filter_by_author", filter_by_author.ordinal()); request( SERVER_URL_PRIX + "/show.json", params, HTTPMETHOD_GET,listener); } /** * ????????????????????? * @param since_id ????????????ID?since_id?????????since_id???????????0? * @param max_id ????????????ID??????max_id???????0? * @param count ?????????????????50? * @param page ????????????1? * @param filter_by_source ??????????0?????1??????????????2??????????????0? * @param listener */ public void byME(long since_id, long max_id, int count, int page, SRC_FILTER filter_by_source,RequestListener listener) { WeiboParameters params = new WeiboParameters(); params.add("since_id", since_id); params.add("max_id", max_id); params.add("count", count); params.add("page", page); params.add("filter_by_source", filter_by_source.ordinal()); request(SERVER_URL_PRIX + "/by_me.json", params, HTTPMETHOD_GET,listener); } /** * ???????????????????? * * @param since_id ????????????ID?since_id?????????since_id???????????0? * @param max_id ????????????ID??????max_id???????0? * @param count ?????????????????50? * @param page ????????????1? * @param filter_by_author ???????0?????1????????2????????0? * @param filter_by_source ??????????0?????1??????????????2??????????????0? * @param listener */ public void toME(long since_id, long max_id, int count, int page, AUTHOR_FILTER filter_by_author, SRC_FILTER filter_by_source,RequestListener listener) { WeiboParameters params = new WeiboParameters(); params.add("since_id", since_id); params.add("max_id", max_id); params.add("count", count); params.add("page", page); params.add("filter_by_author", filter_by_author.ordinal()); params.add("filter_by_source", filter_by_source.ordinal()); request(SERVER_URL_PRIX + "/to_me.json", params, HTTPMETHOD_GET,listener); } /** * ???????????????????????????? * * @param since_id ????????????ID?since_id?????????since_id???????????0? * @param max_id ????????????ID??????max_id???????0? * @param count ?????????????????50? * @param page ????????????1? * @param trim_user ????user?????false?????user????true?user?????user_id????false? * @param listener */ public void timeline(long since_id, long max_id, int count, int page, boolean trim_user,RequestListener listener) { WeiboParameters params = new WeiboParameters(); params.add("since_id", since_id); params.add("max_id", max_id); params.add("count", count); params.add("page", page); if (trim_user) { params.add("trim_user", 1); } else { params.add("trim_user", 0); } request(SERVER_URL_PRIX + "/timeline.json", params, HTTPMETHOD_GET,listener); } /** * ?????????????????????????@???? * ????????????ID?since_id?????????since_id???????????0? * @param since_id ????????????ID??????max_id???????0? * @param max_id ????????????ID??????max_id???????0? * @param count ?????????????????50? * @param page ????????????1? * @param filter_by_author ???????0?????1????????2????????0? * @param filter_by_source ??????????0?????1??????????????2??????????????0? * @param listener */ public void mentions(long since_id, long max_id, int count, int page, AUTHOR_FILTER filter_by_author, SRC_FILTER filter_by_source,RequestListener listener) { WeiboParameters params = new WeiboParameters(); params.add("since_id", since_id); params.add("max_id", max_id); params.add("count", count); params.add("page", page); params.add("filter_by_author", filter_by_author.ordinal()); params.add("filter_by_source", filter_by_source.ordinal()); request(SERVER_URL_PRIX + "/mentions.json", params, HTTPMETHOD_GET,listener); } /** * ??????ID??????????? * * @param cids ???????????ID?????50? * @param listener */ public void showBatch( long[] cids, RequestListener listener) { WeiboParameters params = new WeiboParameters(); StringBuilder strb = new StringBuilder(); for (long cid : cids) { strb.append(String.valueOf(cid)).append(","); } strb.deleteCharAt(strb.length() - 1); params.add("cids", strb.toString()); request(SERVER_URL_PRIX + "/show_batch.json", params, HTTPMETHOD_GET,listener); } /** * ????????????? * * @param comment ???????????140???? * @param id ??????????ID? * @param comment_ori ????????????????????????? * @param listener */ public void create(String comment, long id, boolean comment_ori, RequestListener listener) { WeiboParameters params = new WeiboParameters(); params.add("comment", comment); params.add("id", id); if (comment_ori) { params.add("comment_ori", 0); } else { params.add("comment_ori", 1); } request(SERVER_URL_PRIX + "/create.json", params, HTTPMETHOD_POST, listener); } /** * ???????? * * @param cid ???????ID????????????????????? * @param listener */ public void destroy(long cid, RequestListener listener) { WeiboParameters params = new WeiboParameters(); params.add("cid", cid); request( SERVER_URL_PRIX + "/destroy.json", params, HTTPMETHOD_POST, listener); } /** * ??????ID??????? * * @param ids ????????ID?????20?? * @param listener */ public void destroyBatch( long[] ids, RequestListener listener) { WeiboParameters params = new WeiboParameters(); StringBuilder strb = new StringBuilder(); for (long cid : ids) { strb.append(String.valueOf(cid)).append(","); } strb.deleteCharAt(strb.length() - 1); params.add("ids", strb.toString()); request(SERVER_URL_PRIX + "/sdestroy_batch.json", params, HTTPMETHOD_POST, listener); } /** * ????????? * * @param cid ?????????ID? * @param id ??????????ID? * @param comment ??????????????140???? * @param without_mention ???????????????@????????true????false????????false? * @param comment_ori ??????????????????????????false??????true??????false? * @param listener */ public void reply(long cid, long id, String comment, boolean without_mention, boolean comment_ori, RequestListener listener) { WeiboParameters params = new WeiboParameters(); params.add("cid", cid); params.add("id", id); params.add("comment", comment); if (without_mention) { params.add("without_mention", 1); } else { params.add("without_mention", 0); } if (comment_ori) { params.add("comment_ori", 1); } else { params.add("comment_ori", 0); } request(SERVER_URL_PRIX + "/reply.json", params, HTTPMETHOD_POST, listener); } }