com.sina.weibo.sdk.net.WeiboParameters Java Examples
The following examples show how to use
com.sina.weibo.sdk.net.WeiboParameters.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlaceAPI.java From AssistantBySDK with Apache License 2.0 | 6 votes |
/** * 添加地点 * * @param title POI点的名称,不超过30个字符,必须进行URLencode * @param address POI点的地址,不超过60个字符,必须进行URLencode * @param category POI的类型分类代码,取值范围见:分类代码对应表,默认为500 * @param lat 纬度,有效范围:-90.0到+90.0,+表示北纬 * @param lon 经度,有效范围:-180.0到+180.0,+表示东经 * @param city 城市代码 * @param province 省份代码 * @param country 国家代码 * @param phone POI点的电话,不超过14个字符 * @param postCode POI点的邮编 * @param extra 其他,必须进行URLencode * @param listener 异步请求回调接口 */ public void poisCreate(String title, String address, String category, String lat, String lon, String city, String province, String country, String phone, String postCode, String extra, RequestListener listener) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("title", title); params.put("address", address); params.put("category", category); params.put("lat", lat); params.put("long", lon); params.put("city", city); params.put("province", province); params.put("country", country); params.put("phone", phone); params.put("postcode", postCode); params.put("extra", extra); requestAsync(SERVER_URL_PRIX + "/pois/create.json", params, HTTPMETHOD_POST, listener); }
Example #2
Source File: TagsAPI.java From AssistantBySDK with Apache License 2.0 | 5 votes |
/** * 为当前登录用户添加新的用户标签(无论调用该接口次数多少,每个用户最多可以创建10个标签)。 * * @param tags 要创建的一组标签,每个标签的长度不可超过7个汉字,14个半角字符 * @param listener 异步请求回调接口 */ public void create(String[] tags, RequestListener listener) { WeiboParameters params = new WeiboParameters(mAppKey); StringBuilder strb = new StringBuilder(); for (String tag : tags) { strb.append(tag).append(","); } strb.deleteCharAt(strb.length() - 1); params.put("tags", strb.toString()); requestAsync(SERVER_URL_PRIX + "/create.json", params, HTTPMETHOD_POST, listener); }
Example #3
Source File: StatusesAPI.java From AssistantBySDK with Apache License 2.0 | 5 votes |
private WeiboParameters buildTimeLineBase(long since_id, long max_id, int count, int page) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("since_id", since_id); params.put("max_id", max_id); params.put("count", count); params.put("page", page); return params; }
Example #4
Source File: StatusesAPI.java From AssistantBySDK with Apache License 2.0 | 5 votes |
private WeiboParameters buildUpdateParams(String content, String lat, String lon) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("status", content); if (!TextUtils.isEmpty(lon)) { params.put("long", lon); } if (!TextUtils.isEmpty(lat)) { params.put("lat", lat); } return params; }
Example #5
Source File: AbsOpenAPI.java From Simpler with Apache License 2.0 | 5 votes |
/** * HTTP 异步请求。 * * @param url 请求的地址 * @param params 请求的参数 * @param httpMethod 请求方法 * @param listener 请求后的回调接口 */ protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) { if (null == mAccessToken || TextUtils.isEmpty(url) || null == params || TextUtils.isEmpty(httpMethod) || null == listener) { LogUtil.e(TAG, "Argument error!"); return; } params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken()); new AsyncWeiboRunner(mContext).requestAsync(url, params, httpMethod, listener); }
Example #6
Source File: FriendshipsAPI.java From Simpler with Apache License 2.0 | 5 votes |
/** * 取消关注一个用户。 * * @param screen_name 需要取消关注的用户昵称 * @param listener 异步请求回调接口 */ @Deprecated public void destroy(String screen_name, RequestListener listener) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("screen_name", screen_name); requestAsync(SERVER_URL_PRIX + "/destroy.json", params, HTTPMETHOD_POST, listener); }
Example #7
Source File: CommentsAPI.java From Simpler with Apache License 2.0 | 5 votes |
private WeiboParameters buildCreateParams(String comment, long id, boolean comment_ori) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("comment", comment); params.put("id", id); params.put("comment_ori", comment_ori ? 1: 0); return params; }
Example #8
Source File: FavoritesAPI.java From AssistantBySDK with Apache License 2.0 | 5 votes |
/** * 更新一条收藏的收藏标签。 * * @param id 需要更新的收藏ID * @param tags 需要更新的标签内容,最多不超过2条 * @param listener 异步请求回调接口 */ public void tagsUpdate(long id, String[] tags, RequestListener listener) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("id", id); StringBuilder strb = new StringBuilder(); for (String tag : tags) { strb.append(tag).append(","); } strb.deleteCharAt(strb.length() - 1); params.put("tags", strb.toString()); requestAsync(SERVER_URL_PRIX + "/tags/update.json", params, HTTPMETHOD_POST, listener); }
Example #9
Source File: CommentsAPI.java From Simpler with Apache License 2.0 | 5 votes |
private WeiboParameters buildReplyParams(long cid, long id, String comment, boolean without_mention, boolean comment_ori) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("cid", cid); params.put("id", id); params.put("comment", comment); params.put("without_mention", without_mention ? 1: 0); params.put("comment_ori", comment_ori ? 1: 0); return params; }
Example #10
Source File: CommentsAPI.java From Simpler with Apache License 2.0 | 5 votes |
/** * @see #toME(long, long, int, int, int, int, RequestListener) */ public String toMESync(long since_id, long max_id, int count, int page, int authorType, int sourceType) { WeiboParameters params = buildTimeLineParamsBase(since_id, max_id, count, page); params.put("filter_by_author", authorType); params.put("filter_by_source", sourceType); return requestSync(sAPIList.get(READ_API_TO_ME), params, HTTPMETHOD_GET); }
Example #11
Source File: CommentsAPI.java From Simpler with Apache License 2.0 | 5 votes |
/** * @see #mentions(long, long, int, int, int, int, RequestListener) */ public String mentionsSync(long since_id, long max_id, int count, int page, int authorType, int sourceType) { WeiboParameters params = buildTimeLineParamsBase(since_id, max_id, count, page); params.put("filter_by_author", authorType); params.put("filter_by_source", sourceType); return requestSync(sAPIList.get(READ_API_MENTIONS), params, HTTPMETHOD_GET); }
Example #12
Source File: PlaceAPI.java From AssistantBySDK with Apache License 2.0 | 5 votes |
private WeiboParameters buildUserParams(long uid, int count, int page, boolean base_app) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("uid", uid); params.put("count", count); params.put("page", page); params.put("base_app", base_app ? 1 : 0); return params; }
Example #13
Source File: WeiboSdkBrowser.java From letv with Apache License 2.0 | 5 votes |
private void startShare() { LogUtil.d(TAG, "Enter startShare()............"); final ShareRequestParam req = this.mRequestParam; if (req.hasImage()) { LogUtil.d(TAG, "loadUrl hasImage............"); new AsyncWeiboRunner(this).requestAsync(ShareRequestParam.UPLOAD_PIC_URL, req.buildUploadPicParam(new WeiboParameters(req.getAppKey())), "POST", new RequestListener() { public void onWeiboException(WeiboException e) { LogUtil.d(WeiboSdkBrowser.TAG, "post onWeiboException " + e.getMessage()); req.sendSdkErrorResponse(WeiboSdkBrowser.this, e.getMessage()); WeiboSdkBrowser.this.finish(); } public void onComplete(String response) { LogUtil.d(WeiboSdkBrowser.TAG, "post onComplete : " + response); UploadPicResult result = UploadPicResult.parse(response); if (result == null || result.getCode() != 1 || TextUtils.isEmpty(result.getPicId())) { req.sendSdkErrorResponse(WeiboSdkBrowser.this, "upload pic faild"); WeiboSdkBrowser.this.finish(); return; } WeiboSdkBrowser.this.openUrl(req.buildUrl(result.getPicId())); } }); return; } openUrl(this.mUrl); }
Example #14
Source File: InviteAPI.java From Simpler with Apache License 2.0 | 5 votes |
/** * 向好友发送邀请。支持登录用户向自己的微博互粉好友发送私信邀请、礼物。 * * @param uid 被邀请人的 Uid,需要为当前用户互粉好友 * @param jsonData 邀请数据。以 {@link JSONObject} 数据填充 * @param listener 邀请接口对应的回调 */ public void sendInvite(String uid, JSONObject jsonData, RequestListener listener) { if (!TextUtils.isEmpty(uid) && jsonData != null && !TextUtils.isEmpty(jsonData.toString())) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("uid", uid); params.put("data", jsonData.toString()); requestAsync(INVITE_URL, params, HTTPMETHOD_POST, listener); } else { LogUtil.d(TAG, "Invite args error!"); } }
Example #15
Source File: AbsOpenAPI.java From AssistantBySDK with Apache License 2.0 | 5 votes |
/** * HTTP 同步请求。 * * @param url 请求的地址 * @param params 请求的参数 * @param httpMethod 请求方法 * * @return 同步请求后,服务器返回的字符串。 */ protected String requestSync(String url, WeiboParameters params, String httpMethod) { if (null == mAccessToken || TextUtils.isEmpty(url) || null == params || TextUtils.isEmpty(httpMethod)) { LogUtil.e(TAG, "Argument error!"); return ""; } params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken()); return new AsyncWeiboRunner(mContext).request(url, params, httpMethod); }
Example #16
Source File: StatusesAPI.java From Simpler with Apache License 2.0 | 5 votes |
/** * 批量获取指定微博的转发数评论数。 * * @param ids 需要获取数据的微博ID,最多不超过100个 * @param listener 异步请求回调接口 */ public void count(String[] ids, RequestListener listener) { WeiboParameters params = new WeiboParameters(mAppKey); StringBuilder strb = new StringBuilder(); for (String id : ids) { strb.append(id).append(","); } strb.deleteCharAt(strb.length() - 1); params.put("ids", strb.toString()); requestAsync(SERVER_URL_PRIX + "/count.json", params, HTTPMETHOD_GET, listener); }
Example #17
Source File: FriendshipsAPI.java From AssistantBySDK with Apache License 2.0 | 5 votes |
/** 组装FriendsID的参数 */ private WeiboParameters buildFriendIDParam(long uid, int count) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("uid", uid); params.put("count", count); return params; }
Example #18
Source File: SuggestionsAPI.java From Simpler with Apache License 2.0 | 4 votes |
private WeiboParameters builderCountPage(int count, int page) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("count", count); params.put("page", page); return params; }
Example #19
Source File: CommentsAPI.java From AssistantBySDK with Apache License 2.0 | 4 votes |
/** * @see #showBatch(long[], RequestListener) */ public String showBatchSync(long[] cids) { WeiboParameters params = buildShowOrDestoryBatchParams(cids); return requestSync(sAPIList.get(READ_API_SHOW_BATCH), params, HTTPMETHOD_GET); }
Example #20
Source File: ShareRequestParam.java From letv with Apache License 2.0 | 4 votes |
public WeiboParameters buildUploadPicParam(WeiboParameters param) { if (hasImage()) { param.put("img", new String(this.mBase64ImgData)); } return param; }
Example #21
Source File: ShortUrlAPI.java From AssistantBySDK with Apache License 2.0 | 4 votes |
public String expandSync(String[] url_short) { WeiboParameters params = buildURLRequest(url_short, "url_short"); return requestSync(SERVER_URL_PRIX + "/expand.json", params, HTTPMETHOD_GET); }
Example #22
Source File: LocationAPI.java From Simpler with Apache License 2.0 | 4 votes |
/** * @see #geo2Address(Double, Double, RequestListener) */ public String geo2AddressSync(Double longtitude, Double latitude) { WeiboParameters params = buildGeo2AddressParam(longtitude, latitude); return requestSync(sAPIList.get(READ_API_GET_TO_ADDRESS), params, HTTPMETHOD_GET); }
Example #23
Source File: CommentsAPI.java From AssistantBySDK with Apache License 2.0 | 4 votes |
/** * @see #byME(long, long, int, int, int, RequestListener) */ public String byMESync(long since_id, long max_id, int count, int page, int sourceType) { WeiboParameters params = buildTimeLineParamsBase(since_id, max_id, count, page); params.put("filter_by_source", sourceType); return requestSync(sAPIList.get(READ_API_BY_ME), params, HTTPMETHOD_GET); }
Example #24
Source File: CommentsAPI.java From AssistantBySDK with Apache License 2.0 | 4 votes |
/** * @see #create(String, long, boolean, RequestListener) */ public String createSync(String comment, long id, boolean comment_ori) { WeiboParameters params = buildCreateParams(comment, id, comment_ori); return requestSync(sAPIList.get(WRITE_API_CREATE), params, HTTPMETHOD_POST); }
Example #25
Source File: AccountAPI.java From AssistantBySDK with Apache License 2.0 | 4 votes |
/** * 获取所有的学校列表。 * NOTE:参数keyword与capital二者必选其一,且只能选其一 按首字母capital查询时,必须提供province参数 * * @param province 省份范围,省份ID * @param city 城市范围,城市ID * @param area 区域范围,区ID * @param schoolType 学校类型,可为以下几种: 1:大学,2:高中,3:中专技校,4:初中,5:小学 * <li> {@link #SCHOOL_TYPE_COLLEGE} * <li> {@link #SCHOOL_TYPE_SENIOR} * <li> {@link #SCHOOL_TYPE_TECHNICAL} * <li> {@link #SCHOOL_TYPE_JUNIOR} * <li> {@link #SCHOOL_TYPE_PRIMARY} * @param capital 学校首字母,默认为A * @param keyword 学校名称关键字 * @param count 返回的记录条数,默认为10 * @param listener 异步请求回调接口 */ public void schoolList(int province, int city, int area, int schoolType, CAPITAL capital, String keyword, int count, RequestListener listener) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("province", province); params.put("city", city); params.put("area", area); params.put("type", schoolType); if (!TextUtils.isEmpty(capital.name())) { params.put("capital", capital.name()); } else if (!TextUtils.isEmpty(keyword)) { params.put("keyword", keyword); } params.put("count", count); requestAsync(SERVER_URL_PRIX + "/profile/school_list.json", params, HTTPMETHOD_GET, listener); }
Example #26
Source File: StatusesAPI.java From Simpler with Apache License 2.0 | 4 votes |
public String uploadPicSync(Bitmap pic) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("pic", pic); return requestSync(SERVER_URL_PRIX + "/upload_pic.json", params, HTTPMETHOD_POST); }
Example #27
Source File: PlaceAPI.java From Simpler with Apache License 2.0 | 3 votes |
/** * 获取地点详情。 * * @param poiid 需要查询的POI地点ID * @param base_app 是否只获取当前应用的数据。false为否(所有数据),true为是(仅当前应用),默认为false * @param listener 异步请求回调接口 */ public void poisShow(String poiid, boolean base_app, RequestListener listener) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("poiid", poiid); params.put("base_app", base_app ? 1 : 0); requestAsync(SERVER_URL_PRIX + "/pois/show.json", params, HTTPMETHOD_GET, listener); }
Example #28
Source File: StatusesAPI.java From Simpler with Apache License 2.0 | 3 votes |
/** * 获取指定微博的转发微博列表 * * @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 authorType 作者筛选类型,0:全部、1:我关注的人、2:陌生人,默认为0。可为以下几种: * <li> {@link #AUTHOR_FILTER_ALL} * <li> {@link #AUTHOR_FILTER_ATTENTIONS} * <li> {@link #AUTHOR_FILTER_STRANGER} * @param listener 异步请求回调接口 */ public void repostTimeline(long id, long since_id, long max_id, int count, int page, int authorType, RequestListener listener) { WeiboParameters params = buildTimeLineBase(since_id, max_id, count, page); params.put("id", id); params.put("filter_by_author", authorType); requestAsync(SERVER_URL_PRIX + "/repost_timeline.json", params, HTTPMETHOD_GET, listener); }
Example #29
Source File: AttitudeAPI.java From Simpler with Apache License 2.0 | 3 votes |
/** * 发表或更新一条表态。 * * @param sid 微博ID。 * @param attid 表态ID。 * @param listener */ public void destroy(long sid, long attid, RequestListener listener) { WeiboParameters params = new WeiboParameters(mAppKey); params.put("id", sid); params.put("attid", attid); requestAsync(SERVER_URL_PRIX + "/destroy.json", params, HTTPMETHOD_POST, listener); }
Example #30
Source File: PlaceAPI.java From Simpler with Apache License 2.0 | 3 votes |
/** * 获取当前登录用户与其好友的位置动态。 * * @param since_id 若指定此参数,则返回ID比since_id大的微博(即比since_id时间晚的微博),默认为0 * @param max_id 若指定此参数,则返回ID小于或等于max_id的微博,默认为0 * @param count 单页返回的记录条数,最大为50,默认为20 * @param page 返回结果的页码,默认为1 * @param only_attentions true:仅返回关注的,false:返回好友的,默认为true * @param listener 异步请求回调接口 */ public void friendsTimeline(long since_id, long max_id, int count, int page, boolean only_attentions, RequestListener listener) { WeiboParameters params = buildTimeLineParamsBase(since_id, max_id, count, page); params.put("type", only_attentions ? 1 : 0); requestAsync(SERVER_URL_PRIX + "/friends_timeline.json", params, HTTPMETHOD_GET, listener); }