Polyv Help Center

Help Center

whitelistService

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

1. Batch Add Whitelist

Description

批量新增白名单
接口地址(仅做说明使用):https://api.polyv.net/meet/v1/channel/auth-whitelist/save-batch

Call Constraints

  1. API calls are rate-limited. See details. For common call exceptions, see details.

Unit Test

    @Test
    public void testWhitelistSaveBatch() throws IOException, NoSuchAlgorithmException {
        SeminarWhitelistSaveBatchRequest seminarWhitelistSaveBatchRequest = new SeminarWhitelistSaveBatchRequest();
        Boolean seminarWhitelistSaveBatchResponse;
        try {
            String channelId = super.getSeminarChannelId();
            seminarWhitelistSaveBatchRequest.setChannelId(channelId);
            List<SeminarWhitelistSaveBatchRequest.WhitelistInfo> whitelistInfos = new ArrayList<>();
            SeminarWhitelistSaveBatchRequest.WhitelistInfo whitelistInfo =
                    new SeminarWhitelistSaveBatchRequest.WhitelistInfo();
            whitelistInfo.setCode("code1").setName("name1").setGroupNo(1).setGroupRole("leader");
            whitelistInfos.add(whitelistInfo);
            seminarWhitelistSaveBatchRequest.setList(whitelistInfos);
            seminarWhitelistSaveBatchResponse = new SeminarWhitelistServiceImpl().whitelistSaveBatch(
                    seminarWhitelistSaveBatchRequest);
            Assert.assertNotNull(seminarWhitelistSaveBatchResponse);
            if (seminarWhitelistSaveBatchResponse != null) {
                //to do something ......
                log.debug("测试批量新增白名单成功 {}", JSON.toJSONString(seminarWhitelistSaveBatchResponse));
                //TODO 此处创建完成后删除了白名单,正式使用需删除该语句
                super.deleteWhitelist(channelId, "code1");
            }
        } 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 Description

  1. If the request is correct, a Boolean object is returned, and the B-side 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., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID
list true Array Batch insert records See WhitelistInfo parameter description
WhitelistInfo Parameter Description
Parameter Required Type Description
code true String Member code, max length 64 characters (must be unique)
name true String Participant nickname, max length 64 characters
groupNo false Integer Group number, between 1 and 50 (must be passed together with groupRole or omitted together)
groupRole false String Role within the group. A group cannot have more than one leader. (Must be passed together with groupNo or omitted together) leader: Group leader, member: Group member

Return Object Description

true indicates successful addition, false indicates failed addition.




2. Delete a Single Whitelist Entry

Description

删除单个白名单
接口地址(仅做说明使用):https://api.polyv.net/meet/v1/channel/auth-whitelist/delete

Call Constraints

  1. API calls are rate-limited. See details. For common call exceptions, see details.

Unit Test

    @Test
    public void testDeleteWhitelist() throws IOException, NoSuchAlgorithmException {
        SeminarDeleteWhitelistRequest seminarDeleteWhitelistRequest = new SeminarDeleteWhitelistRequest();
        Boolean seminarDeleteWhitelistResponse;
        try {
            String channelId = super.getSeminarChannelId();
            seminarDeleteWhitelistRequest.setChannelId(channelId);
            seminarDeleteWhitelistRequest.setCode("code1");
            seminarDeleteWhitelistResponse = new SeminarWhitelistServiceImpl().deleteWhitelist(
                    seminarDeleteWhitelistRequest);
            Assert.assertNotNull(seminarDeleteWhitelistResponse);
            if (seminarDeleteWhitelistResponse != null) {
                //to do something ......
                log.debug("测试删除单个白名单成功 {}", JSON.toJSONString(seminarDeleteWhitelistResponse));
            }
        } 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 Description

  1. If the request is correct, a Boolean object is returned, and the B-side 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., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID
code true String Whitelist entry to delete, max length 64 characters

Return Object Description

true indicates successful deletion, false indicates failed deletion.




3. Clear Whitelist

Description

清空白名单
接口地址(仅做说明使用):https://api.polyv.net/meet/v1/channel/auth-whitelist/delete-all

Call Constraints

  1. API calls are rate-limited. See details. For common call exceptions, see details.

Unit Test

    @Test
    public void testDeleteAllWhitelist() throws IOException, NoSuchAlgorithmException {
        SeminarDeleteAllWhitelistRequest seminarDeleteAllWhitelistRequest = new SeminarDeleteAllWhitelistRequest();
        Boolean seminarDeleteAllWhitelistResponse;
        try {
            String channelId = super.getSeminarChannelId();
            seminarDeleteAllWhitelistRequest.setChannelId(channelId);
            seminarDeleteAllWhitelistResponse = new SeminarWhitelistServiceImpl().deleteAllWhitelist(
                    seminarDeleteAllWhitelistRequest);
            Assert.assertNotNull(seminarDeleteAllWhitelistResponse);
            if (seminarDeleteAllWhitelistResponse != null) {
                //to do something ......
                log.debug("测试清空白名单成功 {}", JSON.toJSONString(seminarDeleteAllWhitelistResponse));
            }
        } 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 Description

  1. If the request is correct, a Boolean object is returned, and the B-side 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., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID

Return Object Description

true indicates successful clearing, false indicates failed clearing.




4. Paginated Query Whitelist

Description

分页查询白名单
接口地址(仅做说明使用):https://api.polyv.net/meet/v1/channel/auth-whitelist/get

Call Constraints

  1. API calls are rate-limited. See details. For common call exceptions, see details.

Unit Test

    @Test
    public void testGetWhitelist() throws IOException, NoSuchAlgorithmException {
        SeminarGetWhitelistRequest seminarGetWhitelistRequest = new SeminarGetWhitelistRequest();
        SeminarGetWhitelistResponse seminarGetWhitelistResponse;
        try {
            String channelId = super.getSeminarChannelId();
            seminarGetWhitelistRequest.setChannelId(channelId);
            seminarGetWhitelistResponse = new SeminarWhitelistServiceImpl().getWhitelist(seminarGetWhitelistRequest);
            Assert.assertNotNull(seminarGetWhitelistResponse);
            if (seminarGetWhitelistResponse != null) {
                //to do something ......
                log.debug("测试分页查询白名单成功 {}", JSON.toJSONString(seminarGetWhitelistResponse));
            }
        } 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 Description

  1. If the request is correct, a SeminarGetWhitelistResponse object is returned, and the B-side 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., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter 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 Type Description
contents Array Query result list See WhitelistInfo parameter description
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]
WhitelistInfo Parameter Description
Parameter Type Description
channelId String Channel ID
userId String Account ID
code String Member code
name String Participant nickname
groupNo Integer Group number
groupName String Group name
groupRole String Role within the group. leader: Group leader, member: Group member






5. Update Whitelist Entry

Description

更新白名单
接口地址(仅做说明使用):https://api.polyv.net/meet/v1/channel/auth-whitelist/update

Call Constraints

  1. API calls are rate-limited. See details. For common call exceptions, see details.

Unit Test

    @Test
    public void testUpdateWhitelist() throws IOException, NoSuchAlgorithmException {
        SeminarUpdateWhitelistRequest seminarUpdateWhitelistRequest = new SeminarUpdateWhitelistRequest();
        Boolean seminarUpdateWhitelistResponse;
        try {
            String channelId = super.getSeminarChannelId();
            seminarUpdateWhitelistRequest.setChannelId(channelId);
            seminarUpdateWhitelistRequest.setOldCode("code2")
                    .setCode("code2")
                    .setName("newName")
                    .setGroupNo(2)
                    .setGroupRole("member");
            seminarUpdateWhitelistResponse = new SeminarWhitelistServiceImpl().updateWhitelist(
                    seminarUpdateWhitelistRequest);
            Assert.assertNotNull(seminarUpdateWhitelistResponse);
            if (seminarUpdateWhitelistResponse != null) {
                //to do something ......
                log.debug("测试更新白名单成功 {}", JSON.toJSONString(seminarUpdateWhitelistResponse));
            }
        } 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 Description

  1. If the request is correct, a Boolean object is returned, and the B-side 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., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID
oldCode true String Original whitelist record to update, max length 64 characters
code true String New whitelist record, max length 64 characters
name false String New nickname, max length 64 characters (omit to keep unchanged)
groupNo false Integer New group number, between 1 and 50 (omit to keep unchanged)
groupRole false String New role within the group (omit to keep unchanged) leader: Group leader, member: Group member

Return Object Description

true indicates successful update, false indicates failed update.

联系客服,在线咨询