Search in sources :

Example 16 with SimplePostRequestExecutor

use of me.chanjar.weixin.common.util.http.SimplePostRequestExecutor in project weixin-java-tools by chanjarster.

the class WxMpServiceImpl method qrCodeCreateLastTicket.

public WxMpQrCodeTicket qrCodeCreateLastTicket(int scene_id) throws WxErrorException {
    String url = "https://api.weixin.qq.com/cgi-bin/qrcode/create";
    JsonObject json = new JsonObject();
    json.addProperty("action_name", "QR_LIMIT_SCENE");
    JsonObject actionInfo = new JsonObject();
    JsonObject scene = new JsonObject();
    scene.addProperty("scene_id", scene_id);
    actionInfo.add("scene", scene);
    json.add("action_info", actionInfo);
    String responseContent = execute(new SimplePostRequestExecutor(), url, json.toString());
    return WxMpQrCodeTicket.fromJson(responseContent);
}
Also used : JsonObject(com.google.gson.JsonObject) SimplePostRequestExecutor(me.chanjar.weixin.common.util.http.SimplePostRequestExecutor)

Example 17 with SimplePostRequestExecutor

use of me.chanjar.weixin.common.util.http.SimplePostRequestExecutor in project weixin-java-tools by chanjarster.

the class WxMpServiceImpl method groupCreate.

public WxMpGroup groupCreate(String name) throws WxErrorException {
    String url = "https://api.weixin.qq.com/cgi-bin/groups/create";
    JsonObject json = new JsonObject();
    JsonObject groupJson = new JsonObject();
    json.add("group", groupJson);
    groupJson.addProperty("name", name);
    String responseContent = execute(new SimplePostRequestExecutor(), url, json.toString());
    return WxMpGroup.fromJson(responseContent);
}
Also used : JsonObject(com.google.gson.JsonObject) SimplePostRequestExecutor(me.chanjar.weixin.common.util.http.SimplePostRequestExecutor)

Example 18 with SimplePostRequestExecutor

use of me.chanjar.weixin.common.util.http.SimplePostRequestExecutor in project weixin-java-tools by chanjarster.

the class WxMpServiceImpl method massOpenIdsMessageSend.

public WxMpMassSendResult massOpenIdsMessageSend(WxMpMassOpenIdsMessage message) throws WxErrorException {
    String url = "https://api.weixin.qq.com/cgi-bin/message/mass/send";
    String responseContent = execute(new SimplePostRequestExecutor(), url, message.toJson());
    return WxMpMassSendResult.fromJson(responseContent);
}
Also used : SimplePostRequestExecutor(me.chanjar.weixin.common.util.http.SimplePostRequestExecutor)

Aggregations

SimplePostRequestExecutor (me.chanjar.weixin.common.util.http.SimplePostRequestExecutor)18 JsonObject (com.google.gson.JsonObject)9 JsonElement (com.google.gson.JsonElement)4 JsonReader (com.google.gson.stream.JsonReader)4 StringReader (java.io.StringReader)4 WxErrorException (me.chanjar.weixin.common.exception.WxErrorException)1