Search in sources :

Example 6 with SimplePostRequestExecutor

use of me.chanjar.weixin.common.util.http.SimplePostRequestExecutor 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());
}
Also used : JsonObject(com.google.gson.JsonObject) SimplePostRequestExecutor(me.chanjar.weixin.common.util.http.SimplePostRequestExecutor)

Example 7 with SimplePostRequestExecutor

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

the class WxMpServiceImpl method massGroupMessageSend.

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

Example 8 with SimplePostRequestExecutor

use of me.chanjar.weixin.common.util.http.SimplePostRequestExecutor 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());
}
Also used : JsonObject(com.google.gson.JsonObject) SimplePostRequestExecutor(me.chanjar.weixin.common.util.http.SimplePostRequestExecutor)

Example 9 with SimplePostRequestExecutor

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

the class WxMpServiceImpl method semanticQuery.

public WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException {
    String url = "https://api.weixin.qq.com/semantic/semproxy/search";
    String responseContent = execute(new SimplePostRequestExecutor(), url, semanticQuery.toJson());
    return WxMpSemanticQueryResult.fromJson(responseContent);
}
Also used : SimplePostRequestExecutor(me.chanjar.weixin.common.util.http.SimplePostRequestExecutor)

Example 10 with SimplePostRequestExecutor

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

the class WxMpServiceImpl method menuCreate.

public void menuCreate(WxMenu menu) throws WxErrorException {
    if (menu.getMatchRule() != null) {
        String url = "https://api.weixin.qq.com/cgi-bin/menu/addconditional";
        execute(new SimplePostRequestExecutor(), url, menu.toJson());
    } else {
        String url = "https://api.weixin.qq.com/cgi-bin/menu/create";
        execute(new SimplePostRequestExecutor(), url, menu.toJson());
    }
}
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