我可以使用ConnectyCube SDK分配聊天管理员吗?

时间:2018-08-28 16:11:34

标签: android ios chat connectycube

我正在尝试使用ConnectyCube Android和iOS SDK来构建我的应用程序,并且需要能够为聊天分配管理员。 对于Android,我尝试了以下代码:

    ArrayList<Integer> occupantIds = new ArrayList<Integer>();
occupantIds.add(34);
occupantIds.add(35);
occupantIds.add(36);

ConnectycubeChatDialog dialog = new ConnectycubeChatDialog();
dialog.setType(ConnectycubeDialogType.GROUP);
dialog.setOccupantsIds(occupantIdsList);
dialog.setName("Hawaii party");

//or just use DialogUtils
//ConnectycubeChatDialog dialog = DialogUtils.buildDialog("Hawaii party", ConnectycubeDialogType.GROUP, occupantIds);

ConnectycubeRestChatService.createChatDialog(dialog).performAsync(new EntityCallback<ConnectycubeChatDialog>() {
    @Override
    public void onSuccess(ConnectycubeChatDialog createdDialog, Bundle params) {

    }

    @Override
    public void onError(ResponseException exception) {

    }
});

但是我看不到如何指示管理员。可能吗? 谢谢。

1 个答案:

答案 0 :(得分:0)

添加管理员:

DialogRequestBuilder updateBuilder = new DialogRequestBuilder();
updateBuilder.addAdminsIds(17616, 17617);
ConnectycubeRestChatService.updateChatDialog(groupDialog, updateBuilder).performAsync(new EntityCallback<ConnectycubeChatDialog>() {
    @Override
    public void onSuccess(ConnectycubeChatDialog result, Bundle params) {

    }

    @Override
    public void onError(ResponseException responseException) {

    }
});

删除管理员:

DialogRequestBuilder updateBuilder = new DialogRequestBuilder();
updateBuilder.removeAdminsIds(17616, 17617);
ConnectycubeRestChatService.updateChatDialog(groupDialog, updateBuilder).performAsync(new EntityCallback<ConnectycubeChatDialog>() {
    @Override
    public void onSuccess(ConnectycubeChatDialog result, Bundle params) {

    }

    @Override
    public void onError(ResponseException responseException) {

    }
});

更多信息在这里 https://developers.connectycube.com/android/messaging?id=addremove-admins