完善会议API

This commit is contained in:
heavyrain2012
2021-07-25 12:08:47 +08:00
parent c3859a9fae
commit b187151683
5 changed files with 40 additions and 11 deletions
@@ -11,6 +11,7 @@ public class IMExceptionEvent {
int ROBOT_API_Exception = 7; int ROBOT_API_Exception = 7;
int SHORT_LINK_Exception = 8; int SHORT_LINK_Exception = 8;
int EVENT_CALLBACK_Exception = 9; int EVENT_CALLBACK_Exception = 9;
int CONFERENCE_Exception = 10;
int HEART_BEAT = 100; int HEART_BEAT = 100;
} }
@@ -0,0 +1,14 @@
package cn.wildfirechat.pojos;
public class PojoConferenceRoomId {
public String roomId;
public boolean advance;
public PojoConferenceRoomId() {
}
public PojoConferenceRoomId(String roomId, boolean advance) {
this.roomId = roomId;
this.advance = advance;
}
}
@@ -11,9 +11,10 @@ public class ConferenceAdmin {
return AdminHttpUtils.httpJsonPost(path, null, PojoConferenceInfoList.class); return AdminHttpUtils.httpJsonPost(path, null, PojoConferenceInfoList.class);
} }
public static IMResult<PojoConferenceParticipantList> listParticipants(String roomId) throws Exception { public static IMResult<PojoConferenceParticipantList> listParticipants(String roomId, boolean advance) throws Exception {
String path = APIPath.Conference_List_Participant; String path = APIPath.Conference_List_Participant;
return AdminHttpUtils.httpJsonPost(path, roomId, PojoConferenceParticipantList.class); PojoConferenceRoomId data = new PojoConferenceRoomId(roomId, advance);
return AdminHttpUtils.httpJsonPost(path, data, PojoConferenceParticipantList.class);
} }
public static IMResult<Void> createRoom(String roomId, String description, String pin, int maxPublisher, boolean advance, int bitrate, boolean recording) throws Exception { public static IMResult<Void> createRoom(String roomId, String description, String pin, int maxPublisher, boolean advance, int bitrate, boolean recording) throws Exception {
@@ -29,8 +30,9 @@ public class ConferenceAdmin {
return AdminHttpUtils.httpJsonPost(path, create, Void.class); return AdminHttpUtils.httpJsonPost(path, create, Void.class);
} }
public static IMResult<Void> destroy(String roomId) throws Exception { public static IMResult<Void> destroy(String roomId, boolean advance) throws Exception {
String path = APIPath.Conference_Destroy; String path = APIPath.Conference_Destroy;
return AdminHttpUtils.httpJsonPost(path, roomId, Void.class); PojoConferenceRoomId conferenceRoomId = new PojoConferenceRoomId(roomId, advance);
return AdminHttpUtils.httpJsonPost(path, conferenceRoomId, Void.class);
} }
} }
@@ -44,6 +44,7 @@ public class GeneralAdmin {
return out; return out;
} }
public static IMResult<UserSettingPojo> getUserSetting(String userId, int scope, String key) throws Exception { public static IMResult<UserSettingPojo> getUserSetting(String userId, int scope, String key) throws Exception {
String path = APIPath.User_Get_Setting; String path = APIPath.User_Get_Setting;
UserSettingPojo pojo = new UserSettingPojo(); UserSettingPojo pojo = new UserSettingPojo();
@@ -1302,6 +1302,8 @@ public class Main {
System.exit(-1); System.exit(-1);
} }
Thread.sleep(100);
IMResult<InputOutputSensitiveWords> swResult = SensitiveAdmin.getSensitives(); IMResult<InputOutputSensitiveWords> swResult = SensitiveAdmin.getSensitives();
if (swResult != null && swResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && swResult.getResult().getWords().containsAll(words)) { if (swResult != null && swResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && swResult.getResult().getWords().containsAll(words)) {
System.out.println("Sensitive word added"); System.out.println("Sensitive word added");
@@ -1318,6 +1320,7 @@ public class Main {
System.exit(-1); System.exit(-1);
} }
Thread.sleep(100);
swResult = SensitiveAdmin.getSensitives(); swResult = SensitiveAdmin.getSensitives();
if (swResult != null && swResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && !swResult.getResult().getWords().containsAll(words)) { if (swResult != null && swResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && !swResult.getResult().getWords().containsAll(words)) {
System.out.println("Sensitive word removed"); System.out.println("Sensitive word removed");
@@ -1384,7 +1387,7 @@ public class Main {
} }
for (PojoConferenceInfo conferenceInfo:listResult.getResult().conferenceInfoList) { for (PojoConferenceInfo conferenceInfo:listResult.getResult().conferenceInfoList) {
IMResult<Void> destroyResult = ConferenceAdmin.destroy(conferenceInfo.roomId); IMResult<Void> destroyResult = ConferenceAdmin.destroy(conferenceInfo.roomId, conferenceInfo.advance);
if(destroyResult == null || destroyResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { if(destroyResult == null || destroyResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("destroy room failure"); System.out.println("destroy room failure");
System.exit(-1); System.exit(-1);
@@ -1401,9 +1404,17 @@ public class Main {
System.out.println("conference list " + listResult.getResult().conferenceInfoList); System.out.println("conference list " + listResult.getResult().conferenceInfoList);
} }
IMResult<Void> createResult = ConferenceAdmin.createRoom("helloroomid", "hello room description", "123456", 20, false, 0, false); IMResult<Void> createResult = ConferenceAdmin.createRoom("helloroomid", "hello room description", "123456", 9, false, 0, false);
if(createResult == null || createResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { if(createResult == null || createResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("create conference list failure"); System.out.println("create conference failure");
System.exit(-1);
} else {
System.out.println("create conference");
}
createResult = ConferenceAdmin.createRoom("helloroomid2", "hello room description advanced", "123456", 20, true, 0, false);
if(createResult == null || createResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("create conference failure");
System.exit(-1); System.exit(-1);
} else { } else {
System.out.println("create conference"); System.out.println("create conference");
@@ -1418,12 +1429,12 @@ public class Main {
} }
for (PojoConferenceInfo conferenceInfo:listResult.getResult().conferenceInfoList) { for (PojoConferenceInfo conferenceInfo:listResult.getResult().conferenceInfoList) {
IMResult<PojoConferenceParticipantList> listParticipantsResult = ConferenceAdmin.listParticipants(conferenceInfo.roomId); IMResult<PojoConferenceParticipantList> listParticipantsResult = ConferenceAdmin.listParticipants(conferenceInfo.roomId, conferenceInfo.advance);
if(listParticipantsResult == null || listParticipantsResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { if(listParticipantsResult == null || listParticipantsResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("destroy room failure"); System.out.println("list participants failure");
System.exit(-1); System.exit(-1);
} else { } else {
System.out.println("destroy room success"); System.out.println("list participants success");
} }
} }
} }