// Path: src/main/java/cn/jmessage/api/common/model/Members.java
// public class Members implements IModel {
// 
//     private JsonArray members;
// 
//     private Members(JsonArray members) {
//         this.members = members;
//     }
// 
//     public static Builder newBuilder() {
//         return new Builder();
//     }
// 
//     @Override
//     public JsonElement toJSON() {
//         return members;
//     }
// 
//     public static class Builder {
// 
//         private JsonArray members = new JsonArray();
// 
//         public Builder addMember(String... usernames) {
// 
//             if( null == usernames ) {
//                 return this;
//             }
// 
//             for (String username : usernames) {
//                 JsonPrimitive member = new JsonPrimitive(username);
//                 this.members.add(member);
//             }
//             return this;
//         }
// 
//         public Members build() {
//             return new Members(members);
//         }
//     }
// }
// 
// Path: src/main/java/cn/jmessage/api/common/model/chatroom/ChatRoomPayload.java
// public class ChatRoomPayload implements IModel {
// 
//     public static final String OWNER = "owner_username";
//     public static final String NAME = "name";
//     public static final String MEMBERS = "members_username";
//     public static final String DESC = "description";
//     public static final String FLAG = "flag";
// 
//     private static Gson gson = new Gson();
// 
//     private String owner;
//     private String name;
//     private Members members;
//     private String desc;
//     // 禁言标志，0 表示不禁言，1 表示禁言
//     private int flag = -1;
// 
//     public ChatRoomPayload(String name, String ownerName, Members members, String desc, int flag) {
//         this.name = name;
//         this.owner = ownerName;
//         this.members = members;
//         this.desc = desc;
//         this.flag = flag;
//     }
// 
//     public static Builder newBuilder() {
//         return new Builder();
//     }
// 
// 
//     @Override
//     public JsonElement toJSON() {
//         JsonObject jsonObject = new JsonObject();
//         if (null != name) {
//             jsonObject.addProperty(NAME, name);
//         }
// 
//         if (null != owner) {
//             jsonObject.addProperty(OWNER, owner);
//         }
// 
//         if ( null != members ) {
//             jsonObject.add(MEMBERS, members.toJSON());
//         }
// 
//         if ( null != desc ) {
//             jsonObject.addProperty(DESC, desc);
//         }
// 
//         if (flag != -1) {
//             jsonObject.addProperty(FLAG, flag);
//         }
// 
//         return jsonObject;
//     }
// 
//     public static class Builder {
//         private String owner;
//         private String name;
//         private Members members;
//         private String desc;
//         private int flag = -1;
// 
//         public Builder setName(String name) {
//             this.name = name;
//             return this;
//         }
// 
//         public Builder setOwnerUsername(String owner) {
//             this.owner = owner;
//             return this;
//         }
// 
//         public Builder setMembers(Members members) {
//             this.members = members;
//             return this;
//         }
// 
//         public Builder setDesc(String desc) {
//             this.desc = desc;
//             return this;
//         }
// 
//         public Builder setFlag(int flag) {
//             this.flag = flag;
//             return this;
//         }
// 
//         public ChatRoomPayload build() {
//             return new ChatRoomPayload(name, owner, members, desc, flag);
//         }
// 
//     }
// 
//     @Override
//     public String toString() {
//         return gson.toJson(toJSON());
//     }
// }


import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
import cn.jiguang.common.resp.ResponseWrapper;
import cn.jmessage.api.chatroom.*;
import cn.jmessage.api.common.model.Members;
import cn.jmessage.api.common.model.chatroom.ChatRoomPayload;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
        try {
            ResponseWrapper result = mClient.updateChatRoomInfo(10000072, "junit_user1", "new Test", "666");
            LOG.info("Got result " + result.toString());
        } catch (APIConnectionException e) {
            LOG.error("Connection error. Should retry later. ", e);
        } catch (APIRequestException e) {
            LOG.error("Error response from JPush server. Should review and fix it. ", e);
            LOG.info("HTTP Status: " + e.getStatus());
            LOG.info("Error Message: " + e.getMessage());
        }
    }

    public void testDeleteChatRoom() {
        try {
            ResponseWrapper result = mClient.deleteChatRoom(12500013);
            LOG.info("Got result " + result.toString());
        } catch (APIConnectionException e) {
            LOG.error("Connection error. Should retry later. ", e);
        } catch (APIRequestException e) {
            LOG.error("Error response from JPush server. Should review and fix it. ", e);
            LOG.info("HTTP Status: " + e.getStatus());
            LOG.info("Error Message: " + e.getMessage());
        }
    }

    public void testUpdateUserSpeakStatus() {
        try {
            ResponseWrapper result = mClient.updateUserSpeakStatus(12500011, "junit_user1", 1);
            LOG.info("Got result " + result.toString());
        } catch (APIConnectionException e) {
// Path: src/main/java/cn/jmessage/api/common/model/Members.java
// public class Members implements IModel {
// 
//     private JsonArray members;
// 
//     private Members(JsonArray members) {
//         this.members = members;
//     }
// 
//     public static Builder newBuilder() {
//         return new Builder();
//     }
// 
//     @Override
//     public JsonElement toJSON() {
//         return members;
//     }
// 
//     public static class Builder {
// 
//         private JsonArray members = new JsonArray();
// 
//         public Builder addMember(String... usernames) {
// 
//             if( null == usernames ) {
//                 return this;
//             }
// 
//             for (String username : usernames) {
//                 JsonPrimitive member = new JsonPrimitive(username);
//                 this.members.add(member);
//             }
//             return this;
//         }
// 
//         public Members build() {
//             return new Members(members);
//         }
//     }
// }
// 
// Path: src/main/java/cn/jmessage/api/common/model/chatroom/ChatRoomPayload.java
// public class ChatRoomPayload implements IModel {
// 
//     public static final String OWNER = "owner_username";
//     public static final String NAME = "name";
//     public static final String MEMBERS = "members_username";
//     public static final String DESC = "description";
//     public static final String FLAG = "flag";
// 
//     private static Gson gson = new Gson();
// 
//     private String owner;
//     private String name;
//     private Members members;
//     private String desc;
//     // 禁言标志，0 表示不禁言，1 表示禁言
//     private int flag = -1;
// 
//     public ChatRoomPayload(String name, String ownerName, Members members, String desc, int flag) {
//         this.name = name;
//         this.owner = ownerName;
//         this.members = members;
//         this.desc = desc;
//         this.flag = flag;
//     }
// 
//     public static Builder newBuilder() {
//         return new Builder();
//     }
// 
// 
//     @Override
//     public JsonElement toJSON() {
//         JsonObject jsonObject = new JsonObject();
//         if (null != name) {
//             jsonObject.addProperty(NAME, name);
//         }
// 
//         if (null != owner) {
//             jsonObject.addProperty(OWNER, owner);
//         }
// 
//         if ( null != members ) {
//             jsonObject.add(MEMBERS, members.toJSON());
//         }
// 
//         if ( null != desc ) {
//             jsonObject.addProperty(DESC, desc);
//         }
// 
//         if (flag != -1) {
//             jsonObject.addProperty(FLAG, flag);
//         }
// 
//         return jsonObject;
//     }
// 
//     public static class Builder {
//         private String owner;
//         private String name;
//         private Members members;
//         private String desc;
//         private int flag = -1;
// 
//         public Builder setName(String name) {
//             this.name = name;
//             return this;
//         }
// 
//         public Builder setOwnerUsername(String owner) {
//             this.owner = owner;
//             return this;
//         }
// 
//         public Builder setMembers(Members members) {
//             this.members = members;
//             return this;
//         }
// 
//         public Builder setDesc(String desc) {
//             this.desc = desc;
//             return this;
//         }
// 
//         public Builder setFlag(int flag) {
//             this.flag = flag;
//             return this;
//         }
// 
//         public ChatRoomPayload build() {
//             return new ChatRoomPayload(name, owner, members, desc, flag);
//         }
// 
//     }
// 
//     @Override
//     public String toString() {
//         return gson.toJson(toJSON());
//     }
// }


// Path: example/main/java/cn/jmessage/api/examples/ChatRoomExample.java
import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
import cn.jiguang.common.resp.ResponseWrapper;
import cn.jmessage.api.chatroom.*;
import cn.jmessage.api.common.model.Members;
import cn.jmessage.api.common.model.chatroom.ChatRoomPayload;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

        try {
            ResponseWrapper result = mClient.updateChatRoomInfo(10000072, "junit_user1", "new Test", "666");
            LOG.info("Got result " + result.toString());
        } catch (APIConnectionException e) {
            LOG.error("Connection error. Should retry later. ", e);
        } catch (APIRequestException e) {
            LOG.error("Error response from JPush server. Should review and fix it. ", e);
            LOG.info("HTTP Status: " + e.getStatus());
            LOG.info("Error Message: " + e.getMessage());
        }
    }

    public void testDeleteChatRoom() {
        try {
            ResponseWrapper result = mClient.deleteChatRoom(12500013);
            LOG.info("Got result " + result.toString());
        } catch (APIConnectionException e) {
            LOG.error("Connection error. Should retry later. ", e);
        } catch (APIRequestException e) {
            LOG.error("Error response from JPush server. Should review and fix it. ", e);
            LOG.info("HTTP Status: " + e.getStatus());
            LOG.info("Error Message: " + e.getMessage());
        }
    }

    public void testUpdateUserSpeakStatus() {
        try {
            ResponseWrapper result = mClient.updateUserSpeakStatus(12500011, "junit_user1", 1);
            LOG.info("Got result " + result.toString());
        } catch (APIConnectionException e) {
            LOG.error("Connection error. Should retry later. ", e);