use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.
the class OAuthDao method getOAuthUserInfo.
public UserBean getOAuthUserInfo() throws WeiboException {
String uidJson = getOAuthUserUIDJsonData();
String uid = "";
try {
JSONObject jsonObject = new JSONObject(uidJson);
uid = jsonObject.optString("uid");
} catch (JSONException e) {
AppLogger.e(e.getMessage());
}
Map<String, String> map = new HashMap<String, String>();
map.put("uid", uid);
map.put("access_token", access_token);
String url = URLHelper.USER_SHOW;
String result = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
Gson gson = new Gson();
UserBean user = new UserBean();
try {
user = gson.fromJson(result, UserBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(result);
}
return user;
}
use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.
the class FriendshipsDao method executeTask.
private UserBean executeTask(String url) throws WeiboException {
if (TextUtils.isEmpty(uid) && TextUtils.isEmpty(screen_name)) {
AppLogger.e("uid or screen name can't be empty");
return null;
}
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
if (!TextUtils.isEmpty(uid)) {
map.put("uid", uid);
} else {
map.put("screen_name", screen_name);
}
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
try {
UserBean value = new Gson().fromJson(jsonData, UserBean.class);
if (value != null) {
return value;
}
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
return null;
}
use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.
the class EditMyProfileDao method update.
public UserBean update() throws WeiboException {
String apiUrl = URLHelper.MYPROFILE_EDIT;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("screen_name", screen_name);
map.put("url", url);
map.put("description", description);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, apiUrl, map);
Gson gson = new Gson();
UserBean value = null;
try {
value = gson.fromJson(jsonData, UserBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
if (this.avatar != null) {
UploadAvatarDao uploadAvatarDao = new UploadAvatarDao(access_token, avatar);
uploadAvatarDao.upload();
}
return value;
}
use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.
the class RemarkDao method updateRemark.
public UserBean updateRemark() throws WeiboException {
String url = URLHelper.REMARK_UPDATE;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("uid", uid);
map.put("remark", remark);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
Gson gson = new Gson();
UserBean value = null;
try {
value = gson.fromJson(jsonData, UserBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
return value;
}
use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.
the class ShowUserDao method getUserInfo.
public UserBean getUserInfo() throws WeiboException {
String url = (!TextUtils.isEmpty(domain) ? URLHelper.USER_DOMAIN_SHOW : URLHelper.USER_SHOW);
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("uid", uid);
map.put("screen_name", screen_name);
map.put("domain", domain);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
Gson gson = new Gson();
UserBean value = null;
try {
value = gson.fromJson(jsonData, UserBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
return value;
}
Aggregations