// 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;
package cn.jmessage.api.examples;


public class ChatRoomExample {

    private static Logger LOG = LoggerFactory.getLogger(ChatRoomExample.class);
    private static final String appkey = "242780bfdd7315dc1989fe2b";
    private static final String masterSecret = "2f5ced2bef64167950e63d13";
    private ChatRoomClient mClient = new ChatRoomClient(appkey, masterSecret);

    public static void main(String[] args) {
        
    }

    public void testCreateChatRoom() {
        try {
// 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;

package cn.jmessage.api.examples;


public class ChatRoomExample {

    private static Logger LOG = LoggerFactory.getLogger(ChatRoomExample.class);
    private static final String appkey = "242780bfdd7315dc1989fe2b";
    private static final String masterSecret = "2f5ced2bef64167950e63d13";
    private ChatRoomClient mClient = new ChatRoomClient(appkey, masterSecret);

    public static void main(String[] args) {
        
    }

    public void testCreateChatRoom() {
        try {
            ChatRoomPayload payload = ChatRoomPayload.newBuilder()