Search in sources :

Example 1 with WxCpTag

use of me.chanjar.weixin.cp.bean.WxCpTag in project weixin-java-tools by chanjarster.

the class WxCpServiceImpl method tagGet.

@Override
public List<WxCpTag> tagGet() throws WxErrorException {
    String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/list";
    String responseContent = get(url, null);
    JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
    return WxCpGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement.getAsJsonObject().get("taglist"), new TypeToken<List<WxCpTag>>() {
    }.getType());
}
Also used : WxCpTag(me.chanjar.weixin.cp.bean.WxCpTag) JsonElement(com.google.gson.JsonElement) TypeToken(com.google.gson.reflect.TypeToken) StringReader(java.io.StringReader) JsonReader(com.google.gson.stream.JsonReader)

Aggregations

JsonElement (com.google.gson.JsonElement)1 TypeToken (com.google.gson.reflect.TypeToken)1 JsonReader (com.google.gson.stream.JsonReader)1 StringReader (java.io.StringReader)1 WxCpTag (me.chanjar.weixin.cp.bean.WxCpTag)1