同步会议API
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package cn.wildfirechat.sdk;
|
||||
|
||||
import cn.wildfirechat.common.APIPath;
|
||||
import cn.wildfirechat.pojos.*;
|
||||
import cn.wildfirechat.sdk.model.IMResult;
|
||||
import cn.wildfirechat.sdk.utilities.AdminHttpUtils;
|
||||
|
||||
public class ConferenceAdmin {
|
||||
public static IMResult<PojoConferenceInfoList> listConferences() throws Exception {
|
||||
String path = APIPath.Conference_List;
|
||||
return AdminHttpUtils.httpJsonPost(path, null, PojoConferenceInfoList.class);
|
||||
}
|
||||
|
||||
public static IMResult<PojoConferenceParticipantList> listParticipants(String roomId) throws Exception {
|
||||
String path = APIPath.Conference_List_Participant;
|
||||
return AdminHttpUtils.httpJsonPost(path, roomId, PojoConferenceParticipantList.class);
|
||||
}
|
||||
|
||||
public static IMResult<Void> createRoom(String roomId, String description, String pin, int maxPublisher, boolean advance, int bitrate, boolean recording) throws Exception {
|
||||
String path = APIPath.Conference_Create;
|
||||
PojoConferenceCreate create = new PojoConferenceCreate();
|
||||
create.roomId = roomId;
|
||||
create.description = description;
|
||||
create.pin = pin;
|
||||
create.max_publishers = maxPublisher;
|
||||
create.advance = advance;
|
||||
create.bitrate = bitrate;
|
||||
create.recording = recording;
|
||||
return AdminHttpUtils.httpJsonPost(path, create, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<Void> destroy(String roomId) throws Exception {
|
||||
String path = APIPath.Conference_Destroy;
|
||||
return AdminHttpUtils.httpJsonPost(path, roomId, Void.class);
|
||||
}
|
||||
}
|
||||
@@ -43,9 +43,9 @@ public class Main {
|
||||
testSensitiveApi();
|
||||
if (commercialServer) {
|
||||
testDevice();
|
||||
testConference();
|
||||
}
|
||||
|
||||
|
||||
System.out.println("Congratulation, all admin test case passed!!!!!!!");
|
||||
}
|
||||
|
||||
@@ -133,7 +133,6 @@ public class Main {
|
||||
System.out.println("get user info by userId failure");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
InputOutputUserInfo updateUserInfo = new InputOutputUserInfo();
|
||||
updateUserInfo.setUserId(System.currentTimeMillis()+"");
|
||||
updateUserInfo.setDisplayName("updatedUserName");
|
||||
@@ -1184,6 +1183,8 @@ public class Main {
|
||||
ChannelServiceApi channelServiceApi = new ChannelServiceApi("http://localhost", resultCreateChannel.getResult().getTargetId(), secret);
|
||||
|
||||
|
||||
|
||||
if (commercialServer) {
|
||||
//3. 测试channel api功能
|
||||
IMResult<Void> resultVoid = channelServiceApi.subscribe("userId2");
|
||||
if (resultVoid != null && resultVoid.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
@@ -1200,6 +1201,7 @@ public class Main {
|
||||
System.out.println("subscribe failure");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
IMResult<OutputStringList> resultStringList = channelServiceApi.getSubscriberList();
|
||||
if (resultStringList != null && resultStringList.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && resultStringList.getResult().getList().contains("userId2") && resultStringList.getResult().getList().contains("userId3")) {
|
||||
System.out.println("get subscriber done");
|
||||
@@ -1231,7 +1233,7 @@ public class Main {
|
||||
System.out.println("get user info failure");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
MessagePayload payload = new MessagePayload();
|
||||
@@ -1352,4 +1354,61 @@ public class Main {
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
会议相关接口,仅音视频高级版服务支持
|
||||
*/
|
||||
public static void testConference() throws Exception {
|
||||
IMResult<PojoConferenceInfoList> listResult = ConferenceAdmin.listConferences();
|
||||
if(listResult == null || listResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("get conference list failure");
|
||||
System.exit(-1);
|
||||
} else {
|
||||
System.out.println("conference list " + listResult.getResult().conferenceInfoList);
|
||||
}
|
||||
|
||||
for (PojoConferenceInfo conferenceInfo:listResult.getResult().conferenceInfoList) {
|
||||
IMResult<Void> destroyResult = ConferenceAdmin.destroy(conferenceInfo.roomId);
|
||||
if(destroyResult == null || destroyResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("destroy room failure");
|
||||
System.exit(-1);
|
||||
} else {
|
||||
System.out.println("destroy room success");
|
||||
}
|
||||
}
|
||||
|
||||
listResult = ConferenceAdmin.listConferences();
|
||||
if(listResult == null || listResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("get conference list failure");
|
||||
System.exit(-1);
|
||||
} else {
|
||||
System.out.println("conference list " + listResult.getResult().conferenceInfoList);
|
||||
}
|
||||
|
||||
IMResult<Void> createResult = ConferenceAdmin.createRoom("helloroomid", "hello room description", "123456", 20, false, 0, false);
|
||||
if(createResult == null || createResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("create conference list failure");
|
||||
System.exit(-1);
|
||||
} else {
|
||||
System.out.println("create conference");
|
||||
}
|
||||
|
||||
listResult = ConferenceAdmin.listConferences();
|
||||
if(listResult == null || listResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("get conference list failure");
|
||||
System.exit(-1);
|
||||
} else {
|
||||
System.out.println("conference list " + listResult.getResult().conferenceInfoList);
|
||||
}
|
||||
|
||||
for (PojoConferenceInfo conferenceInfo:listResult.getResult().conferenceInfoList) {
|
||||
IMResult<PojoConferenceParticipantList> listParticipantsResult = ConferenceAdmin.listParticipants(conferenceInfo.roomId);
|
||||
if(listParticipantsResult == null || listParticipantsResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("destroy room failure");
|
||||
System.exit(-1);
|
||||
} else {
|
||||
System.out.println("destroy room success");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user