@Test public void testList() { MaterialPagination qyMaterialPagination = Materials.defaultMaterials().list(84, MediaType.image, 0, 10); Assert.assertNotNull(qyMaterialPagination); for (MaterialPagination.Material item : qyMaterialPagination.getItems()) { File file = Materials.defaultMaterials().download(84, item.getMediaId()); Assert.assertTrue(file.exists()); } qyMaterialPagination = Materials.defaultMaterials().list(84, MediaType.image, 0, 10); Assert.assertNotNull(qyMaterialPagination); }
public MaterialPagination list(int agentId, MediaType type, int offset, int size) { String request = "{\"type\":\"%s\",\"agentid\":%s,\"offset\":%s,\"count\":%s}"; String url = WxEndpoint.get("url.material.list"); String response = wxClient.post(url, String.format(request, type.name(), agentId, offset, size)); return toMaterialSearchResult(JsonMapper.defaultMapper().fromJson(response, QyMaterialSearchResult.class)); }
Materials { public MaterialPagination list(int agentId, MediaType type, int offset, int size) { String request = "{\"type\":\"%s\",\"agentid\":%s,\"offset\":%s,\"count\":%s}"; String url = WxEndpoint.get("url.material.list"); String response = wxClient.post(url, String.format(request, type.name(), agentId, offset, size)); return toMaterialSearchResult(JsonMapper.defaultMapper().fromJson(response, QyMaterialSearchResult.class)); } }
Materials { public MaterialPagination list(int agentId, MediaType type, int offset, int size) { String request = "{\"type\":\"%s\",\"agentid\":%s,\"offset\":%s,\"count\":%s}"; String url = WxEndpoint.get("url.material.list"); String response = wxClient.post(url, String.format(request, type.name(), agentId, offset, size)); return toMaterialSearchResult(JsonMapper.defaultMapper().fromJson(response, QyMaterialSearchResult.class)); }  }
Materials { public MaterialPagination list(int agentId, MediaType type, int offset, int size) { String request = "{\"type\":\"%s\",\"agentid\":%s,\"offset\":%s,\"count\":%s}"; String url = WxEndpoint.get("url.material.list"); String response = wxClient.post(url, String.format(request, type.name(), agentId, offset, size)); return toMaterialSearchResult(JsonMapper.defaultMapper().fromJson(response, QyMaterialSearchResult.class)); }  static Materials defaultMaterials(); static Materials with(CorpSetting corpSetting); void setWxClient(WxClient wxClient); String addMpNews(int agent, MpNews mpNews); void updateMpNews(int agent, String mediaId, MpNews mpNews); MpNews getMpNews(int agent, String mediaId); void deleteMpNews(int agentId, String mediaId); String upload(int agent, MediaType type, InputStream inputStream, String fileName); File download(int agent, String mediaId); void delete(int agent, String mediaId); String addMpNewsImage(InputStream inputStream, String fileName); Counts count(int agent); MaterialPagination list(int agentId, MediaType type, int offset, int size); MpNewsPagination listMpNews(int agentId, int offset, int size); }
Materials { public MaterialPagination list(int agentId, MediaType type, int offset, int size) { String request = "{\"type\":\"%s\",\"agentid\":%s,\"offset\":%s,\"count\":%s}"; String url = WxEndpoint.get("url.material.list"); String response = wxClient.post(url, String.format(request, type.name(), agentId, offset, size)); return toMaterialSearchResult(JsonMapper.defaultMapper().fromJson(response, QyMaterialSearchResult.class)); }  static Materials defaultMaterials(); static Materials with(CorpSetting corpSetting); void setWxClient(WxClient wxClient); String addMpNews(int agent, MpNews mpNews); void updateMpNews(int agent, String mediaId, MpNews mpNews); MpNews getMpNews(int agent, String mediaId); void deleteMpNews(int agentId, String mediaId); String upload(int agent, MediaType type, InputStream inputStream, String fileName); File download(int agent, String mediaId); void delete(int agent, String mediaId); String addMpNewsImage(InputStream inputStream, String fileName); Counts count(int agent); MaterialPagination list(int agentId, MediaType type, int offset, int size); MpNewsPagination listMpNews(int agentId, int offset, int size);  }