use of com.google.gson.JsonObject in project weixin-java-tools by chanjarster.
the class WxMpServiceImpl method userUpdateRemark.
public void userUpdateRemark(String openid, String remark) throws WxErrorException {
String url = "https://api.weixin.qq.com/cgi-bin/user/info/updateremark";
JsonObject json = new JsonObject();
json.addProperty("openid", openid);
json.addProperty("remark", remark);
execute(new SimplePostRequestExecutor(), url, json.toString());
}
use of com.google.gson.JsonObject in project weixin-java-tools by chanjarster.
the class WxMpMaterialArticleUpdateGsonAdapter method serialize.
public JsonElement serialize(WxMpMaterialArticleUpdate wxMpMaterialArticleUpdate, Type typeOfSrc, JsonSerializationContext context) {
JsonObject articleUpdateJson = new JsonObject();
articleUpdateJson.addProperty("media_id", wxMpMaterialArticleUpdate.getMediaId());
articleUpdateJson.addProperty("index", wxMpMaterialArticleUpdate.getIndex());
articleUpdateJson.add("articles", WxMpGsonBuilder.create().toJsonTree(wxMpMaterialArticleUpdate.getArticles(), WxMpMaterialNews.WxMpMaterialNewsArticle.class));
return articleUpdateJson;
}
use of com.google.gson.JsonObject in project weixin-java-tools by chanjarster.
the class WxMpServiceImpl method userUpdateGroup.
public void userUpdateGroup(String openid, long to_groupid) throws WxErrorException {
String url = "https://api.weixin.qq.com/cgi-bin/groups/members/update";
JsonObject json = new JsonObject();
json.addProperty("openid", openid);
json.addProperty("to_groupid", to_groupid);
execute(new SimplePostRequestExecutor(), url, json.toString());
}
use of com.google.gson.JsonObject in project weixin-java-tools by chanjarster.
the class WxMpServiceImpl method getUserCumulate.
@Override
public List<WxMpUserCumulate> getUserCumulate(Date beginDate, Date endDate) throws WxErrorException {
String url = "https://api.weixin.qq.com/datacube/getusercumulate";
JsonObject param = new JsonObject();
param.addProperty("begin_date", SIMPLE_DATE_FORMAT.format(beginDate));
param.addProperty("end_date", SIMPLE_DATE_FORMAT.format(endDate));
String responseContent = post(url, param.toString());
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
return WxMpGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement.getAsJsonObject().get("list"), new TypeToken<List<WxMpUserCumulate>>() {
}.getType());
}
use of com.google.gson.JsonObject in project weixin-java-tools by chanjarster.
the class WxMpServiceImpl method qrCodeCreateLastTicket.
public WxMpQrCodeTicket qrCodeCreateLastTicket(String scene_str) throws WxErrorException {
String url = "https://api.weixin.qq.com/cgi-bin/qrcode/create";
JsonObject json = new JsonObject();
json.addProperty("action_name", "QR_LIMIT_STR_SCENE");
JsonObject actionInfo = new JsonObject();
JsonObject scene = new JsonObject();
scene.addProperty("scene_str", scene_str);
actionInfo.add("scene", scene);
json.add("action_info", actionInfo);
String responseContent = execute(new SimplePostRequestExecutor(), url, json.toString());
return WxMpQrCodeTicket.fromJson(responseContent);
}
Aggregations