예제 #1
0
 /**
  * 获取某人的话题列表
  *
  * @param uid 需要获取话题的用户的UID
  * @return list of the userTrend
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.1
  * @see http://open.weibo.com/wiki/2/trends
  * @since JDK 1.5
  */
 public List<UserTrend> getTrends(String uid) throws WeiboException {
   return UserTrend.constructTrendList(
       client.get(
           WeiboConfig.getValue("baseURL") + "trends.json",
           new PostParameter[] {new PostParameter("uid", uid)},
           access_token));
 }
예제 #2
0
 /**
  * 获取当前用户某个标签下的收藏列表的ID
  *
  * @param tid 需要查询的标签ID
  * @return
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.2
  * @see http://open.weibo.com/wiki/2/favorites/by_tags/ids
  * @since JDK 1.5
  */
 public List<FavoritesIds> getFavoritesIdsByTags(String tid) throws WeiboException {
   return FavoritesIds.constructFavoritesIds(
       client.get(
           WeiboConfig.getValue("baseURL") + "favorites/by_tags/ids.json",
           new PostParameter[] {new PostParameter("tid", tid)},
           access_token));
 }
예제 #3
0
 /**
  * 关注某话题
  *
  * @param trend_name 要关注的话题关键词。
  * @return UserTrend
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.1
  * @throws JSONException
  * @see http://open.weibo.com/wiki/2/trends/follow
  * @since JDK 1.5
  */
 public UserTrend trendsFollow(String trend_name) throws WeiboException {
   return new UserTrend(
       client.post(
           WeiboConfig.getValue("baseURL") + "trends/follow.json",
           new PostParameter[] {new PostParameter("trend_name", trend_name)},
           access_token));
 }
예제 #4
0
 /**
  * 更新一条收藏的收藏标签
  *
  * @param id 要需要更新的收藏ID
  * @param tags 需要更新的标签内容,必须做URLencode,用半角逗号分隔,最多不超过2条。
  * @return update tag of Favorites status
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.0
  * @see http://open.weibo.com/wiki/2/favorites/tags/update
  * @since JDK 1.5
  */
 public Favorites updateFavoritesTags(String id, String tags) throws WeiboException {
   return new Favorites(
       client.post(
           WeiboConfig.getValue("baseURL") + "favorites/tags/update.json",
           new PostParameter[] {new PostParameter("id", id), new PostParameter("tags", tags)},
           access_token));
 }
예제 #5
0
 public List<Trends> getTrendsHourly(Integer base_app) throws WeiboException {
   return Trends.constructTrendsList(
       client.get(
           WeiboConfig.getValue("baseURL") + "trends/hourly.json",
           new PostParameter[] {new PostParameter("base_app", base_app.toString())},
           access_token));
 }
예제 #6
0
 /**
  * 取消收藏一条微博
  *
  * @param 要取消收藏的微博ID
  * @return Favorites status
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.0
  * @see http://open.weibo.com/wiki/2/favorites/destroy
  * @since JDK 1.5
  */
 public Favorites destroyFavorites(String id) throws WeiboException {
   return new Favorites(
       client.post(
           WeiboConfig.getValue("baseURL") + "favorites/destroy.json",
           new PostParameter[] {new PostParameter("id", id)},
           access_token));
 }
예제 #7
0
 /**
  * 更新当前登录用户所有收藏下的指定标签
  *
  * @param tid 需要更新的标签ID
  * @param tag 需要更新的标签内容,必须做URLencode
  * @return update tags of Favorites status
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.0
  * @see http://open.weibo.com/wiki/2/favorites/tags/update_batch
  * @since JDK 1.5
  */
 public JSONObject updateFavoritesTagsBatch(String tid, String tag) throws WeiboException {
   return client
       .post(
           WeiboConfig.getValue("baseURL") + "favorites/tags/update_batch.json",
           new PostParameter[] {new PostParameter("tid", tid), new PostParameter("tag", tag)},
           access_token)
       .asJSONObject();
 }
예제 #8
0
 /**
  * 取消对某话题的关注
  *
  * @param trend_id 要取消关注的话题ID
  * @return jsonobject
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.1
  * @throws JSONException
  * @see http://open.weibo.com/wiki/2/trends/destroy
  * @since JDK 1.5
  */
 public JSONObject trendsDestroy(Integer trend_id) throws WeiboException {
   return client
       .post(
           WeiboConfig.getValue("baseURL") + "trends/destroy.json",
           new PostParameter[] {new PostParameter("trend_id", trend_id.toString())},
           access_token)
       .asJSONObject();
 }
예제 #9
0
 /**
  * 判断当前用户是否关注某话题
  *
  * @param trend_name 话题关键字,必须做URLencode
  * @return jsonobject
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.1
  * @throws JSONException
  * @see http://open.weibo.com/wiki/2/trends/is_follow
  * @since JDK 1.5
  */
 public JSONObject isFollow(String trend_name) throws WeiboException {
   return client
       .get(
           WeiboConfig.getValue("baseURL") + "trends/is_follow.json",
           new PostParameter[] {new PostParameter("trend_name", trend_name)},
           access_token)
       .asJSONObject();
 }
예제 #10
0
 /**
  * 删除当前登录用户所有收藏下的指定标签
  *
  * @param id 需要删除的标签ID。。
  * @return destroy tags of Favorites status
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.0
  * @see http://open.weibo.com/wiki/2/favorites/tags/destroy_batch
  * @since JDK 1.5
  */
 public Boolean destroyFavoritesTagsBatch(String ids) throws WeiboException {
   try {
     return client
         .post(
             WeiboConfig.getValue("baseURL") + "favorites/destroy_batch.json",
             new PostParameter[] {new PostParameter("ids", ids)},
             access_token)
         .asJSONObject()
         .getBoolean("result");
   } catch (JSONException e) {
     throw new WeiboException(e);
   }
 }
예제 #11
0
 /**
  * 获取当前登录用户的收藏列表ID
  *
  * @return list of the Status
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.1
  * @see http://open.weibo.com/wiki/2/favorites
  * @since JDK 1.5
  */
 public JSONObject getFavoritesIds(Paging page) throws WeiboException {
   return client
       .get(WeiboConfig.getValue("baseURL") + "favorites/ids.json", null, page, access_token)
       .asJSONObject();
 }
예제 #12
0
 /**
  * 获取当前登录用户的收藏列表ID
  *
  * @return list of the Status
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.1
  * @see http://open.weibo.com/wiki/2/favorites
  * @since JDK 1.5
  */
 public List<FavoritesIds> getFavoritesIds() throws WeiboException {
   return FavoritesIds.constructFavoritesIds(
       client.get(WeiboConfig.getValue("baseURL") + "favorites/ids.json", access_token));
 }
예제 #13
0
 /**
  * 获取当前登录用户的收藏列表
  *
  * @param map 参数列表
  * @return
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.2
  * @see http://open.weibo.com/wiki/2/favorites
  * @since JDK 1.5
  */
 public List<Favorites> getFavorites(Map<String, String> map) throws WeiboException {
   PostParameter[] parList = ArrayUtils.mapToArray(map);
   return Favorites.constructFavorites(
       client.get(WeiboConfig.getValue("baseURL") + "favorites.json", parList, access_token));
 }
예제 #14
0
 /**
  * 获取当前登录用户的收藏列表
  *
  * @param page
  * @return list of the Status
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.1
  * @see http://open.weibo.com/wiki/2/favorites
  * @since JDK 1.5
  */
 public List<Favorites> getFavorites(Paging page) throws WeiboException {
   return Favorites.constructFavorites(
       client.get(WeiboConfig.getValue("baseURL") + "favorites.json", null, page, access_token));
 }
예제 #15
0
 /**
  * 获取当前登录用户的收藏标签列表
  *
  * @param page
  * @return list of the favorite tags
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.1
  * @see http://open.weibo.com/wiki/2/favorites/tags
  * @since JDK 1.5
  */
 public List<FavoritesTag> getFavoritesTags() throws WeiboException {
   return Tag.constructTag(
       client.get(WeiboConfig.getValue("baseURL") + "favorites/tags.json", access_token));
 }
예제 #16
0
 /**
  * 获取当前登录用户的收藏列表ID
  *
  * @param map 参数列表
  * @return
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.2
  * @see http://open.weibo.com/wiki/2/favorites/ids
  * @since JDK 1.5
  */
 public JSONObject getFavoritesIds(Map<String, String> map) throws WeiboException {
   PostParameter[] parList = ArrayUtils.mapToArray(map);
   return client
       .get(WeiboConfig.getValue("baseURL") + "favorites/ids.json", parList, access_token)
       .asJSONObject();
 }
예제 #17
0
 /**
  * 返回最近一小时内的热门话题
  *
  * @param base_app 是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0
  * @return list of trends
  * @throws WeiboException when Weibo service or network is unavailable
  * @version weibo4j-V2 1.0.1
  * @throws JSONException
  * @see http://open.weibo.com/wiki/2/trends/hourly
  * @since JDK 1.5
  */
 public List<Trends> getTrendsHourly() throws WeiboException {
   return Trends.constructTrendsList(
       client.get(WeiboConfig.getValue("baseURL") + "trends/hourly.json", access_token));
 }