本文整理汇总了Java中org.hamster.weixinmp.model.WxRespCode类的典型用法代码示例。如果您正苦于以下问题:Java WxRespCode类的具体用法?Java WxRespCode怎么用?Java WxRespCode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WxRespCode类属于org.hamster.weixinmp.model包,在下文中一共展示了WxRespCode类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: menuCreate
import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
public WxRespCode menuCreate(String accessToken, List<WxMenuBtnEntity> entities)
throws WxException {
Map<String, String> params = getAccessTokenParams(accessToken);
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.registerTypeAdapter(WxUserEntity.class,
new WxMenuBtnSerializer());
Gson gson = gsonBuilder.create();
WxMenuCreateJson wrapper = new WxMenuCreateJson(entities);
wrapper.setButton(entities);
try {
return sendRequest(config.getMenuCreateUrl(), HttpMethod.POST, params,
new StringEntity(gson.toJson(wrapper)),
WxRespCode.class);
} catch (UnsupportedEncodingException e) {
throw new WxException(e);
}
}
示例2: menuCreate
import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
public WxRespCode menuCreate(String accessToken, List<WxMenuBtnEntity> entities)
throws WxException {
Map<String, String> params = getAccessTokenParams(accessToken);
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.registerTypeAdapter(WxUserEntity.class,
new WxMenuBtnSerializer());
Gson gson = gsonBuilder.create();
WxMenuCreateJson wrapper = new WxMenuCreateJson();
wrapper.setButton(entities);
try {
return sendRequest(config.getMenuCreateUrl(), HttpMethod.POST, params,
new StringEntity(gson.toJson(wrapper)),
WxRespCode.class);
} catch (UnsupportedEncodingException e) {
throw new WxException(e);
}
}
示例3: toWxErrorJson
import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
public static final WxRespCode toWxErrorJson(String errorResult) {
if (errorResult != null && (errorResult.startsWith("{\"errcode")
|| errorResult.startsWith("{\"errmsg"))) {
return new Gson().fromJson(errorResult, WxRespCode.class);
}
return null;
}
示例4: WxException
import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
/**
*
*/
public WxException(WxRespCode errorJson) {
super(errorJson.getErrmsg());
this.error = errorJson;
}
示例5: menuDelete
import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
public WxRespCode menuDelete(String accessToken) throws WxException {
Map<String, String> params = getAccessTokenParams(accessToken);
return sendRequest(config.getMenuDeleteUrl(), HttpMethod.GET, params, null,
WxRespCode.class);
}
示例6: getError
import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
public WxRespCode getError() {
return error;
}
示例7: setError
import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
public void setError(WxRespCode error) {
this.error = error;
}
示例8: remoteGroupsUpdate
import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
/**
* http请求方式: POST(请使用https协议)<br>
* https://api.weixin.qq.com/cgi-bin/groups/update?access_token=ACCESS_TOKEN<br>
* POST数据格式:json<br>
* POST数据例子:{"group":{"id":108,"name":"test2_modify2"}}<br>
*
* {"errcode": 0, "errmsg": "ok"}<br>
*
* @param id
* @param name
* @return
* @throws WxException
*/
public WxRespCode remoteGroupsUpdate(String accessToken, Long id,
String name) throws WxException {
Map<String, Object> requestJson = new HashMap<String, Object>();
Map<String, Object> l1Json = new HashMap<String, Object>();
l1Json.put("id", id);
l1Json.put("name", name);
requestJson.put("group", l1Json);
return sendRequest(config.getGroupsUpdateUrl(), HttpMethod.POST,
getAccessTokenParams(accessToken), toJsonStringEntity(requestJson),
WxRespCode.class);
}
示例9: remoteGroupsMembersUpdate
import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
/**
* http请求方式: POST(请使用https协议)<br>
* https://api.weixin.qq.com/cgi-bin/groups/members/update?access_token=
* ACCESS_TOKEN<br>
* POST数据格式:json<br>
* POST数据例子:{"openid":"oDF3iYx0ro3_7jD4HFRDfrjdCM58","to_groupid":108}<br>
* {"errcode": 0, "errmsg": "ok"}<br>
*
* @param openid
* @param to_groupid
* @return
* @throws WxException
*/
public WxRespCode remoteGroupsMembersUpdate(String accessToken,
String openid, Long to_groupid) throws WxException {
Map<String, Object> requestJson = new HashMap<String, Object>();
requestJson.put("openid", openid);
requestJson.put("to_groupid", to_groupid);
return sendRequest(config.getGroupsMembersUpdateUrl(), HttpMethod.POST,
getAccessTokenParams(accessToken), toJsonStringEntity(requestJson),
WxRespCode.class);
}