All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hn.im.easemob.comm.body.ModifyChatGroupMuteBody Maven / Gradle / Ivy

There is a newer version: 1.0.18
Show newest version
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