-
Notifications
You must be signed in to change notification settings - Fork 489
企业号素材管理
borball edited this page Dec 28, 2016
·
5 revisions
###临时素材
//image
InputStream inputStream;
String mediaId = Medias.defaultMedias().upload(MediaType.image, inputStream, "image.png");
//voice
InputStream inputStream;
String media = Medias.defaultMedias().upload(MediaType.voice, inputStream, "test.mp3");
//video
InputStream inputStream;
String media = Medias.defaultMedias().upload(MediaType.video, inputStream, "test.mp4");
//file
InputStream inputStream;
String media = Medias.defaultMedias().upload(MediaType.file, inputStream, "groups.csv");
或者:
//image
InputStream inputStream;
String mediaId = Medias.with(corpSetting).upload(MediaType.image, inputStream, "image.png");
//voice
InputStream inputStream;
String media = Medias.with(corpSetting).upload(MediaType.voice, inputStream, "test.mp3");
//video
InputStream inputStream;
String media = Medias.with(corpSetting).upload(MediaType.video, inputStream, "test.mp4");
//file
InputStream inputStream;
String media = Medias.with(corpSetting).upload(MediaType.file, inputStream, "groups.csv");
String mediaId = "";
File file = Medias.defaultMedias().download(mediaId);
或者使用:
Medias.with(corpSetting).download(download);
###永久素材
int agentId;
InputStream inputStream;
String mediaId = Materials.defaultMaterials().upload(agentId, MediaType.image, inputStream, "image.png");
int agentId;
InputStream inputStream;
String mediaId = Materials.defaultMaterials().upload(agentId, MediaType.voice, inputStream, "test.mp3");
int agentId;
InputStream inputStream;
String mediaId = Materials.defaultMaterials().upload(agentId, MediaType.video, inputStream, "test.mp4");
int agentId;
InputStream inputStream;
String mediaId = Materials.defaultMaterials().upload(agentId, MediaType.file, inputStream, "groups.csv");
MpNews mpNews = new MpNews();
...
int agentId;
String mediaId = Materials.defaultMaterials().addMpNews(agentId, mpNews);
//普通素材
int agentId;
String mediaId;
File file = Materials.defaultMaterials().download(agentId, mediaId);
//图文素材
int agentId;
String mediaId;
MpNews mpNews = Materials.defaultMaterials().getMpNews(agentId, mediaId);
//普通素材
int agentId;
String mediaId;
Materials.defaultMaterials().delete(agentId, mediaId);
//图文素材
int agentId;
String mediaId;
Materials.defaultMaterials().delete(agentId, mediaId);
//图文素材
int agentId;
String mediaId;
MpNews mpNews;
Materials.defaultMaterials().updateMpNews(agentId, mediaId, mpNews);
//图文素材
int agentId;
Counts counts = Materials.defaultMaterials().count(agentId);
int agentId;
MaterialSearchResult result = Materials.defaultMaterials().list(agentId, MediaType.image, 0, 10);