com.hn.im.easemob.comm.body.ModifyChatGroupMuteBody Maven / Gradle / Ivy
package com.hn.im.easemob.comm.body;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ContainerNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.hn.im.easemob.comm.wrapper.BodyWrapper;
public class ModifyChatGroupMuteBody implements BodyWrapper {
private String[] usernames;
private Integer muteDuration;
public ModifyChatGroupMuteBody(String[] usernames, Integer muteDuration) {
this.usernames = usernames;
this.muteDuration = muteDuration;
}
public String[] getUsernames() {
return usernames;
}
public void setUsernames(String[] usernames) {
this.usernames = usernames;
}
public Integer getMuteDuration() {
return muteDuration;
}
public void setMuteDuration(Integer muteDuration) {
this.muteDuration = muteDuration;
}
public ContainerNode> getBody() {
ObjectNode body = JsonNodeFactory.instance.objectNode();
body.put("mute_duration", muteDuration);
if (usernames != null && usernames.length > 0) {
ArrayNode membersNode = body.putArray("usernames");
for (String username : usernames) {
membersNode.add(username);
}
}
return body;
}
@Override
public Boolean validate() {
return true;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy