authService
1、查詢研討會參會條件
描述
查询研讨会参会条件
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/seminar/setting/auth/get
呼叫限制
1、API 呼叫有頻率限制,詳細請查看,呼叫常見異常,詳細請查看
單元測試
@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;
}
}
單元測試說明
1、請求正確,回傳 SeminarGetAuthSettingResponse 物件,B 端依據此物件處理業務邏輯;
2、請求參數驗證不合格,拋出 PloyvSdkException,錯誤訊息見 PloyvSdkException.getMessage(),如 [ 輸入參數 [xxx.chat.LivexxxRequest] 物件驗證失敗,失敗欄位 [pic 不能為空 / msg 不能為空] ]
3、伺服器處理異常,拋出 PloyvSdkException,錯誤訊息見 PloyvSdkException.getMessage(),如 [ 保利威請求回傳資料錯誤,請求流水號:66e7ad29fd04425a84c2b2b562d2025b,錯誤原因: invalid signature. ]
請求參數說明
| 參數名 | 必填 | 類型 | 說明 |
|---|---|---|---|
| channelId | true | String | 頻道號 |
回傳物件說明
回傳物件為 List<SeminarGetAuthSettingResponse>,SeminarGetAuthSettingResponse 具體元素內容如下:
| 參數名 | 類型 | 說明 |
|---|---|---|
| channelId | String | 頻道號 |
| userId | String | 使用者 ID |
| rank | Integer | 用於實現一個頻道設定兩個參會條件,為 1 或 2(1 為主要條件,2 為次要條件) |
| enabled | String | 是否開啟參會條件 N:關閉 Y:開啟 |
| authType | String | 參會條件類型 password:密碼登入 direct:獨立授權 |
| roleCode | String | 角色 host:主持人 attendee:參會人 |
| password | String | 密碼登入的 password |
| directKey | String | 獨立授權 key |
| roleName | String | 角色名稱 |
| customKey | String | 自訂授權觀看的 key |
| customUri | String | 自訂授權觀看的介面位址 |
2、修改研討會參會條件
描述
修改研讨会的登录条件
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/seminar/setting/auth/set
呼叫限制
1、API 呼叫有頻率限制,詳細請查看,呼叫常見異常,詳細請查看
2、主要參會條件不能關閉,否則回傳參數錯誤
3、相同參會條件(主要參會條件/次要參會條件),不同角色的開關、認證類型必須相同,否則回傳參數錯誤
4、相同參會條件(主要參會條件/次要參會條件),不同角色的密碼/獨立授權 key 必須不同,否則回傳參數錯誤
5、當認證類型是密碼登入時,密碼不能為空;當認證類型是獨立授權時,授權 key 不能為空,否則回傳參數錯誤
6、主要參會條件和次要參會條件的類型為相同時,不能夠同時開啟,否則回傳參數錯誤
單元測試
@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;
}
}
}
單元測試說明
1、請求正確,回傳 Boolean 物件,B 端依據此物件處理業務邏輯;
2、請求參數驗證不合格,拋出 PloyvSdkException,錯誤訊息見 PloyvSdkException.getMessage(),如 [ 輸入參數 [xxx.chat.LivexxxRequest] 物件驗證失敗,失敗欄位 [pic 不能為空 / msg 不能為空] ]
3、伺服器處理異常,拋出 PloyvSdkException,錯誤訊息見 PloyvSdkException.getMessage(),如 [ 保利威請求回傳資料錯誤,請求流水號:66e7ad29fd04425a84c2b2b562d2025b,錯誤原因: invalid signature. ]
請求參數說明
| 參數名 | 必填 | 類型 | 說明 |
|---|---|---|---|
| channelId | false | String | 頻道號,不傳為全域設定 |
| authSettings | true | Array | 觀看條件設定 【詳見AuthSetting 參數說明】 |
AuthSetting 參數說明
| 參數名 | 必填 | 類型 | 說明 |
|---|---|---|---|
| rank | true | Integer | 主要觀看條件為 1,次要觀看條件為 2 |
| enabled | true | String | 是否開啟條件觀看 N:關閉 Y:開啟 |
| roleCode | true | String | 角色 host:主持人 attendee:參會人 |
| authType | false | String | 參會條件類型 password:密碼登入 direct:獨立授權 |
| password | false | String | 當 authType 為 password 時,密碼登入的 password |
| directKey | false | String | 當 authType 為 direct 時,設定參數,非必填,獨立授權 SecretKey |
| customUri | false | String | 當 authType 為 custom 時,為自訂授權自訂 URL |
| customKey | false | String | 當 authType 為 custom 時,為自訂授權 SecretKey |
回傳物件說明
修改研討會參會條件回傳實體
