Package com.belerweb.social.bean

Examples of com.belerweb.social.bean.Error


    connect.addParameter(params, "format", "json");
    connect.addNotNullParameter(params, "name", name);
    connect.addNotNullParameter(params, "fopenid", fopenid);
    String json = connect.get("https://graph.qq.com/user/get_other_info", params);
    JSONObject jsonObject = new JSONObject(json);
    Error error = Error.parse(jsonObject);
    if (error != null) {
      return new Result<WeiboUser>(error);
    }
    return Result.parse(jsonObject.getJSONObject("data"), WeiboUser.class);
  }
View Full Code Here


    }
    connect.addNotNullParameter(params, "install", install);
    connect.addNotNullParameter(params, "sex", sex);
    String json = connect.get("https://graph.qq.com/relation/get_fanslist", params);
    JSONObject jsonObject = new JSONObject(json);
    Error error = Error.parse(jsonObject);
    if (error != null) {
      return new Result<FanList>(error);
    }
    return Result.parse(jsonObject.getJSONObject("data"), FanList.class);
  }
View Full Code Here

      connect.addParameter(params, "mode", "1");
    }
    connect.addNotNullParameter(params, "install", install);
    String json = connect.get("https://graph.qq.com/relation/get_idollist", params);
    JSONObject jsonObject = new JSONObject(json);
    Error error = Error.parse(jsonObject);
    if (error != null) {
      return new Result<IdolList>(error);
    }
    return Result.parse(jsonObject.getJSONObject("data"), IdolList.class);
  }
View Full Code Here

    connect.addParameter(params, "pagetime", pageTime);
    connect.addParameter(params, "reqnum", reqNum);
    connect.addParameter(params, "twitterid", twitterId);
    String json = connect.get("https://graph.qq.com/t/get_repost_list", params);
    JSONObject jsonObject = new JSONObject(json);
    Error error = Error.parse(jsonObject);
    if (error != null) {
      return new Result<RepostList>(error);
    }
    return Result.parse(jsonObject.getJSONObject("data"), RepostList.class);
  }
View Full Code Here

    if (compatible != null) {
      addParameter(params, "compatibleflag", compatible ? "0" : "0x20");
    }
    addParameter(params, "format", "json");
    JSONObject jsonObject = new JSONObject(post("https://graph.qq.com/t/add_t", params));
    Error error = Error.parse(jsonObject);
    if (error != null) {
      return new Result<NewT>(error);
    }
    return Result.parse(jsonObject.getJSONObject("data"), NewT.class);
  }
View Full Code Here

    request.setEntity(builder.build());
    try {
      HttpResponse response = Http.CLIENT.execute(request);
      String json = IOUtils.toString(response.getEntity().getContent());
      JSONObject jsonObject = new JSONObject(json);
      Error error = Error.parse(jsonObject);
      if (error != null) {
        return new Result<NewT>(error);
      }
      return Result.parse(jsonObject.getJSONObject("data"), NewT.class);
    } catch (ClientProtocolException e) {
View Full Code Here

    addParameter(params, "limit", limit == null ? "5" : limit);
    addParameter(params, "ver", "1");
    addParameter(params, "format", "json");
    JSONObject jsonObject =
        new JSONObject(post("https://graph.qq.com/cft_info/get_tenpay_addr", params));
    Error error = Error.parse(jsonObject);
    if (error != null) {
      return new Result<List<TenpayAddress>>(error);
    }
    List<TenpayAddress> addresses = new ArrayList<TenpayAddress>();
    Integer total = Result.parseInteger(jsonObject.get("ret_num"));
View Full Code Here

          jsonObject = new JSONObject(Http.get(url));
          if (Result.parseInteger(jsonObject.get("ret")) == 0) {
            return new Result<String>(Result.toString(jsonObject.get("text")));
          }
          if (System.currentTimeMillis() - start > 10000) {
            return new Result<String>(new Error("TIMEOUT", "验证码识别超时。"));
          }
          try {
            Thread.sleep(300);
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
        }
      }
      Error error = new Error();
      error.setErrorCode(ret.toString());
      return new Result<String>(error);
    } catch (ClientProtocolException e) {
      throw new SocialException(e);
    } catch (HttpException e) {
      throw new SocialException(e);
View Full Code Here

    addParameter(params, "language", "zh");
    addParameter(params, "latlng", lat + "," + lon);
    String json = get("https://maps.googleapis.com/maps/api/geocode/json", params);
    JSONObject jsonObject = new JSONObject(json);
    if (!"OK".equals(jsonObject.getString("status"))) {
      Error error = new Error();
      error.setErrorCode(jsonObject.getString("status"));
      error.setError(jsonObject.optString("error_message"));
      return new Result<String>(error);
    }

    JSONArray results = jsonObject.getJSONArray("results");
    if (results.length() == 0) {
View Full Code Here

  public Result<Boolean> revokeOAuth2(String accessToken) {
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    weibo.addParameter(params, "access_token", accessToken);
    String json = weibo.post("https://api.weibo.com/oauth2/revokeoauth2", params);
    JSONObject jsonObject = new JSONObject(json);
    Error error = Error.parse(jsonObject);
    if (error == null) {
      return new Result<Boolean>(Result.parseBoolean(jsonObject.get("result")));
    }

    return new Result<Boolean>(error);
View Full Code Here

TOP

Related Classes of com.belerweb.social.bean.Error

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.