Polyv Help Center

Help Center

groupService

Updated: 2023-07-11 15:16:47

1. Delete a Single Group Record

Description

删除研讨会分组记录
接口地址(仅做说明使用):https://api.polyv.net/live/v4/seminar/group/plan/delete

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testDeleteGroupPlan() throws IOException, NoSuchAlgorithmException {
        SeminarDeleteGroupPlanRequest seminarDeleteGroupPlanRequest = new SeminarDeleteGroupPlanRequest();
        Boolean seminarDeleteGroupPlanResponse;
        try {
            String channelId = super.getChannelId();
            seminarDeleteGroupPlanRequest.setChannelId(channelId);
            seminarDeleteGroupPlanRequest.setViewerId("viewerId1");
            seminarDeleteGroupPlanResponse = new GroupPlanServiceImpl().deleteGroupPlan(seminarDeleteGroupPlanRequest);
            Assert.assertNotNull(seminarDeleteGroupPlanResponse);
            if (seminarDeleteGroupPlanResponse != null) {
                //to do something ......
                log.debug("测试删除单个分组记录成功 {}", JSON.toJSONString(seminarDeleteGroupPlanResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Notes

  1. If the request is correct, a Boolean object is returned. The B-end processes business logic based on this object.
  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed. Failed fields: [pic cannot be empty / msg cannot be empty]].
  3. If the server encounters an exception, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned from Polyv request. Request ID: 66e7ad29fd04425a84c2b2b562d2025b. Error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
channelId true String Channel ID
viewerId true String The participant ID of the group record to be deleted, max length 64 characters

Return Object Description

true indicates successful deletion, false indicates failure.




2. Clear Group Records

Description

清空研讨会分组记录
接口地址(仅做说明使用):https://api.polyv.net/live/v4/seminar/group/plan/delete-all

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testDeleteAllGroupPlan() throws IOException, NoSuchAlgorithmException {
        SeminarDeleteAllGroupPlanRequest seminarDeleteAllGroupPlanRequest = new SeminarDeleteAllGroupPlanRequest();
        Boolean seminarDeleteAllGroupPlanResponse;
        try {
            String channelId = super.getChannelId();
            seminarDeleteAllGroupPlanRequest.setChannelId(channelId);
            seminarDeleteAllGroupPlanResponse = new GroupPlanServiceImpl().deleteAllGroupPlan(
                    seminarDeleteAllGroupPlanRequest);
            Assert.assertNotNull(seminarDeleteAllGroupPlanResponse);
            if (seminarDeleteAllGroupPlanResponse != null) {
                //to do something ......
                log.debug("测试清空分组记录成功 {}", JSON.toJSONString(seminarDeleteAllGroupPlanResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Notes

  1. If the request is correct, a Boolean object is returned. The B-end processes business logic based on this object.
  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed. Failed fields: [pic cannot be empty / msg cannot be empty]].
  3. If the server encounters an exception, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned from Polyv request. Request ID: 66e7ad29fd04425a84c2b2b562d2025b. Error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
channelId true String Channel ID

Return Object Description

true indicates successful clearing, false indicates failure.




3. Query Group Records

Description

查询分组记录
接口地址(仅做说明使用):https://api.polyv.net/live/v4/seminar/group/plan/get

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testGetGroupPlan() throws IOException, NoSuchAlgorithmException {
        SeminarGetGroupPlanRequest seminarGetGroupPlanRequest = new SeminarGetGroupPlanRequest();
        SeminarGetGroupPlanResponse seminarGetGroupPlanResponse;
        try {
            String channelId = super.getChannelId();
            seminarGetGroupPlanRequest.setChannelId(channelId);
            seminarGetGroupPlanResponse = new GroupPlanServiceImpl().getGroupPlan(seminarGetGroupPlanRequest);
            Assert.assertNotNull(seminarGetGroupPlanResponse);
            if (seminarGetGroupPlanResponse != null) {
                //to do something ......
                log.debug("测试查询分组记录成功 {}", JSON.toJSONString(seminarGetGroupPlanResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Notes

  1. If the request is correct, a SeminarGetGroupPlanResponse object is returned. The B-end processes business logic based on this object.
  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed. Failed fields: [pic cannot be empty / msg cannot be empty]].
  3. If the server encounters an exception, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned from Polyv request. Request ID: 66e7ad29fd04425a84c2b2b562d2025b. Error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
channelId true String Channel ID
currentPage false Integer Page number, defaults to 1 [Corresponds to the pageNumber field in the API documentation]
pageSize false Integer Number of records per page, defaults to 20

Return Object Description

Parameter Name Type Description
contents Array Query result list [See GroupPlan Parameter Description for details]
pageSize Integer Number of records per page, defaults to 20
currentPage Integer Current page [Corresponds to the pageNumber field in the API documentation]
totalItems Integer Total number of records
totalPage Integer Total number of pages [Corresponds to the totalPages field in the API documentation]
GroupPlan Parameter Description
Parameter Name Type Description
channelId String Channel ID
userId String Account ID
viewerId String Participant ID
nickname String Participant nickname (for identification only, does not change the participant's display name)
groupNo Integer Group number
groupName String Group name
groupRole String Role within the group: leader or member






4. Batch Add Group Records

Description

批量新增分组记录
接口地址(仅做说明使用):https://api.polyv.net/live/v4/seminar/group/plan/save-batch

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testSaveBatchGroupPlan() throws IOException, NoSuchAlgorithmException {
        SeminarSaveBatchGroupPlanRequest seminarSaveBatchGroupPlanRequest = new SeminarSaveBatchGroupPlanRequest();
        Boolean seminarSaveBatchGroupPlanResponse;
        try {
            String channelId = super.getChannelId();
            SeminarSaveBatchGroupPlanRequest.GroupPlan groupPlan = new SeminarSaveBatchGroupPlanRequest.GroupPlan();
            groupPlan.setViewerId("viewerId1");
            groupPlan.setNickname("viewerId1_nick");
            groupPlan.setGroupNo(1);
            groupPlan.setGroupRole("leader");
            List<SeminarSaveBatchGroupPlanRequest.GroupPlan> body = new ArrayList<>();
            body.add(groupPlan);
            seminarSaveBatchGroupPlanRequest.setList(body);
            seminarSaveBatchGroupPlanRequest.setChannelId(channelId);
            seminarSaveBatchGroupPlanResponse = new GroupPlanServiceImpl().saveBatchGroupPlan(
                    seminarSaveBatchGroupPlanRequest);
            Assert.assertNotNull(seminarSaveBatchGroupPlanResponse);
            if (seminarSaveBatchGroupPlanResponse != null) {
                //to do something ......
                log.debug("测试批量新增分组记录成功 {}", JSON.toJSONString(seminarSaveBatchGroupPlanResponse));
                //TODO 此处创建完成后删除了分组,正式使用需删除该语句
                super.deleteGroupPlan(channelId, "viewerId1");
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Notes

  1. If the request is correct, a Boolean object is returned. The B-end processes business logic based on this object.
  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed. Failed fields: [pic cannot be empty / msg cannot be empty]].
  3. If the server encounters an exception, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned from Polyv request. Request ID: 66e7ad29fd04425a84c2b2b562d2025b. Error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
channelId true String Channel ID
list true Array Batch insert records [See GroupPlan Parameter Description for details]
GroupPlan Parameter Description
Parameter Name Required Type Description
viewerId true String Participant ID, max length 64 characters (must be unique)
nickname true String Participant nickname, max length 64 characters (for identification only, does not change the participant's display name)
groupNo true Integer Group number, between 1 and 50
groupRole true String Role within the group. A group cannot have more than one leader. leader or member

Return Object Description

true indicates successful addition, false indicates failure.




5. Update a Single Group Record

Description

更新单个分组记录
接口地址(仅做说明使用):https://api.polyv.net/live/v4/seminar/group/plan/update

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testUpdateGroupPlan() throws IOException, NoSuchAlgorithmException {
        SeminarUpdateGroupPlanRequest seminarUpdateGroupPlanRequest = new SeminarUpdateGroupPlanRequest();
        Boolean seminarUpdateGroupPlanResponse;
        try {
            String channelId = super.getChannelId();
            seminarUpdateGroupPlanRequest.setChannelId(channelId);
            seminarUpdateGroupPlanRequest.setOldViewerId("viewerId1");
            seminarUpdateGroupPlanRequest.setViewerId("newViewerId");
            seminarUpdateGroupPlanRequest.setNickname("nickname");
            seminarUpdateGroupPlanRequest.setGroupNo(1);
            seminarUpdateGroupPlanRequest.setGroupRole("member");
            seminarUpdateGroupPlanResponse = new GroupPlanServiceImpl().updateGroupPlan(seminarUpdateGroupPlanRequest);
            Assert.assertNotNull(seminarUpdateGroupPlanResponse);
            if (seminarUpdateGroupPlanResponse != null) {
                //to do something ......
                log.debug("测试更新单个分组记录成功 {}", JSON.toJSONString(seminarUpdateGroupPlanResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Notes

  1. If the request is correct, a Boolean object is returned. The B-end processes business logic based on this object.
  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed. Failed fields: [pic cannot be empty / msg cannot be empty]].
  3. If the server encounters an exception, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Error returned from Polyv request. Request ID: 66e7ad29fd04425a84c2b2b562d2025b. Error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
channelId true String Channel ID
oldViewerId true String The original participant ID of the group record to be updated, max length 64 characters
viewerId false String New participant ID, max length 64 characters
nickname false String New participant nickname, max length 64 characters (for identification only, does not change the participant's display name)
groupNo false Integer New group number, between 1 and 50
groupRole false String New role within the group: leader or member

Return Object Description

true indicates successful update, false indicates failure.

联系客服,在线咨询