authService
1. Query Seminar Participation Conditions
Description
查询研讨会参会条件
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/seminar/setting/auth/get
Call Constraints
- The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.
Unit Test
@Test
public void testGetAuthSetting() throws IOException, NoSuchAlgorithmException {
SeminarGetAuthSettingRequest seminarGetAuthSettingRequest = new SeminarGetAuthSettingRequest();
List<SeminarGetAuthSettingResponse> seminarGetAuthSettingResponse;
try {
String channelId = super.getChannelId();
seminarGetAuthSettingRequest.setChannelId(channelId);
seminarGetAuthSettingResponse = new SeminarAuthServiceImpl().getAuthSetting(seminarGetAuthSettingRequest);
Assert.assertNotNull(seminarGetAuthSettingResponse);
if (seminarGetAuthSettingResponse != null) {
//to do something ......
log.debug("测试查询研讨会参会条件成功 {}", JSON.toJSONString(seminarGetAuthSettingResponse));
}
} 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
If the request is correct, a
SeminarGetAuthSettingResponseobject is returned, and the B-end processes the business logic based on this object.If the request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]].If the server encounters an error, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g., [Error returned from Polyv request data, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
Return Object Description
The return object is a List<SeminarGetAuthSettingResponse>. The specific elements of SeminarGetAuthSettingResponse are as follows:
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| userId | String | User ID |
| rank | Integer | Used to set two participation conditions for one channel, value is 1 or 2 (1 for primary condition, 2 for secondary condition) |
| enabled | String | Whether the participation condition is enabled: N for disabled, Y for enabled |
| authType | String | Participation condition type: password for password login, direct for independent authorization |
| roleCode | String | Role: host for host, attendee for attendee |
| password | String | Password for password login |
| directKey | String | Independent authorization key |
| roleName | String | Role name |
| customKey | String | Custom authorization viewing key |
| customUri | String | Custom authorization viewing interface URL |
2. Modify Seminar Participation Conditions
Description
修改研讨会的登录条件
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/seminar/setting/auth/set
Call Constraints
The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.
The primary participation condition cannot be disabled; otherwise, a parameter error is returned.
For the same participation condition (primary/secondary), the switch and authentication type for different roles must be the same; otherwise, a parameter error is returned.
For the same participation condition (primary/secondary), the password/independent authorization key for different roles must be different; otherwise, a parameter error is returned.
When the authentication type is password login, the password cannot be empty. When the authentication type is independent authorization, the authorization key cannot be empty; otherwise, a parameter error is returned.
If the primary and secondary participation conditions are of the same type, they cannot both be enabled simultaneously; otherwise, a parameter error is returned.
Unit Test
@Test
public void testSetAuthSetting() throws IOException, NoSuchAlgorithmException {
SeminarSetAuthSettingRequest seminarSetAuthSettingRequest = new SeminarSetAuthSettingRequest();
Boolean seminarSetAuthSettingResponse;
try {
String channelId = super.getChannelId();
SeminarSetAuthSettingRequest.AuthSetting authSetting1 = new SeminarSetAuthSettingRequest.AuthSetting();
SeminarSetAuthSettingRequest.AuthSetting authSetting2 = new SeminarSetAuthSettingRequest.AuthSetting();
authSetting1.setRank(1)
.setEnabled(SeminarConstant.Flag.YES.getFlag())
.setAuthType(SeminarConstant.SeminarAuthType.PASSWORD.getCode())
.setRoleCode(SeminarConstant.RoleCode.ATTENDEE.getCode())
.setPassword(getRandomString(6));
authSetting2.setRank(1)
.setEnabled(SeminarConstant.Flag.YES.getFlag())
.setAuthType(SeminarConstant.SeminarAuthType.PASSWORD.getCode())
.setRoleCode(SeminarConstant.RoleCode.HOST.getCode())
.setPassword(getRandomString(6));
seminarSetAuthSettingRequest.setChannelId(channelId)
.setAuthSettings(Arrays.asList(authSetting1, authSetting2));
seminarSetAuthSettingResponse = new SeminarAuthServiceImpl().setAuthSetting(seminarSetAuthSettingRequest);
Assert.assertTrue(seminarSetAuthSettingResponse);
if (seminarSetAuthSettingResponse) {
//to do something ......
log.debug("测试修改研讨会参会条件成功");
}
} 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
If the request is correct, a
Booleanobject is returned, and the B-end processes the business logic based on this object.If the request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]].If the server encounters an error, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g., [Error returned from Polyv request data, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| channelId | false | String | Channel ID; if not provided, it is a global setting |
| authSettings | true | Array | Viewing condition settings [See AuthSetting Parameter Description for details] |
AuthSetting Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| rank | true | Integer | Primary viewing condition is 1, secondary viewing condition is 2 |
| enabled | true | String | Whether to enable conditional viewing: N for disabled, Y for enabled |
| roleCode | true | String | Role: host for host, attendee for attendee |
| authType | false | String | Participation condition type: password for password login, direct for independent authorization |
| password | false | String | When authType is password, the password for password login |
| directKey | false | String | When authType is direct, the setting parameter (optional), independent authorization SecretKey |
| customUri | false | String | When authType is custom, the custom authorization custom URL |
| customKey | false | String | When authType is custom, the custom authorization SecretKey |
Return Object Description
Entity returned for modifying seminar participation conditions
