userService
1. Query Sub-Account List and Remaining Resources
Description
集团账号查询分账号列表及分账号剩余资源
接口地址(仅做说明使用):https://api.polyv.net/live/v4/group/user/package/list
Call Constraints
- API calls are rate-limited. Click here for details. For common call exceptions, click here.
Unit Test
@Test
public void testListPackage() throws IOException, NoSuchAlgorithmException {
GroupListPackageRequest groupListPackageRequest = new GroupListPackageRequest();
GroupListPackageResponse groupListPackageResponse;
try {
groupListPackageResponse = new UserServiceImpl().listPackage(groupListPackageRequest);
Assert.assertNotNull(groupListPackageResponse);
if (groupListPackageResponse != null) {
//to do something ......
log.debug("测试查询分账号列表及剩余资源成功 {}", JSON.toJSONString(groupListPackageResponse));
}
} 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
GroupListPackageResponseobject is returned. The B-end processes business logic based on this object.If 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 exception, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g., [Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| emails | false | String | Sub-account emails, separated by commas for multiple entries, max 100 |
| pageSize | false | Integer | Number of items per page, default 10, max 100 |
| pageNumber | false | Integer | Current page number, default 1 |
Response Object Description
| Parameter Name | Type | Description |
|---|---|---|
| contents | Array | Bill list [See Package Parameter Description] |
| pageSize | Integer | Number of items displayed per page, default 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] |
Package Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| userId | String | User ID |
| appId | String | Sub-account application ID |
| appSecret | String | Sub-account application secret |
| String | Sub-account email | |
| balance | String | Remaining balance |
| phone | String | Phone number |
| memo | String | Remarks |
| contacts | String | Contact person |
| chargeType | String | Cloud live billing type: minutes, parallelConcurrent, totalConcurrent |
| remainConcurrent | Long | Remaining cloud live resource, concurrent |
| remainMinutes | Long | Remaining cloud live resource, available live minutes |
| remainFlow | Float | Remaining cloud VOD resource, traffic (G) |
| remainSpace | Float | Remaining cloud VOD resource, space (G) |
| expireType | String | Expiration type: group (follows main account), custom |
| expireDate | Long | Account expiration time, 13-digit timestamp |
| status | String | Status: normal, expired, frozen |
| linkMicMinutes | Integer | Available link mic minutes |
| guideMinutes | Integer | Available cloud studio minutes |
| maxChannels | Integer | Number of creatable channels |
| linkMicLimit | Integer | Number of link mic participants |
| vodSecretKey | String | VOD secret key |
| vodBakSecretKey | String | VOD backup secret key |
| writeToken | String | VOD write token |
| readToken | String | VOD read token |
2. Create Group Sub-Account
Description
创建集团分帐号
接口地址(仅做说明使用):https://api.polyv.net/live/v4/group/user/create
Call Constraints
- API calls are rate-limited. Click here for details. For common call exceptions, click here.
Unit Test
@Test
public void testCreate() throws IOException, NoSuchAlgorithmException {
GroupCreateUserRequest groupCreateUserRequest = new GroupCreateUserRequest();
GroupCreateUserResponse groupCreateUserResponse;
try {
groupCreateUserRequest.setEmail("polyvtest0707@polyv.net");
groupCreateUserRequest.setPassword("polyvtest0707");
groupCreateUserRequest.setContacts("张三");
groupCreateUserRequest.setPhone("17600002222");
groupCreateUserRequest.setExpireDate(super.getDate(1688720314000L));
groupCreateUserRequest.setMaxChannels(1);
groupCreateUserRequest.setConcurrent(10);
groupCreateUserResponse = new UserServiceImpl().create(groupCreateUserRequest);
Assert.assertNotNull(groupCreateUserResponse);
if (groupCreateUserResponse != null) {
//to do something ......
log.debug("测试创建集团分帐号成功 {}", JSON.toJSONString(groupCreateUserResponse));
}
} 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
GroupCreateUserResponseobject is returned. The B-end processes business logic based on this object.If 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 exception, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g., [Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| true | String | ||
| password | true | String | Password, must contain both numbers and letters, length 8-32 characters |
| contacts | true | String | Contact person |
| phone | true | String | Phone number, a phone number cannot be bound to more than 3 emails |
| maxChannels | true | Integer | Maximum number of creatable channels |
| minutes | false | Integer | Minutes, required if the main account is billed by minutes |
| concurrent | false | Integer | Concurrent, required if the main account is billed by concurrent |
| balance | false | Float | Amount, cannot be less than 0 |
| memo | false | String | Remarks, 50 characters max |
| expireType | false | String | Expiration type: group (follows main account), custom |
| expireDate | false | Date | Account expiration date, yyyy-MM-dd, e.g., 2022-04-28 |
| remainFlow | false | Integer | VOD traffic, unit G, default 100G |
| remainSpace | false | Integer | VOD space, unit G, default 100G |
Response Object Description
| Parameter Name | Type | Description |
|---|---|---|
| appId | String | Application ID |
| appSecret | String | Application Secret |
| userId | String | User global ID |
3. Allocate Sub-Account Resources
Description
分配分帐号资源
接口地址(仅做说明使用):https://api.polyv.net/live/v4/group/user/package/update
Call Constraints
- API calls are rate-limited. Click here for details. For common call exceptions, click here.
Unit Test
@Test
public void testUpdatePackage() throws IOException, NoSuchAlgorithmException {
GroupUpdatePackageRequest groupUpdatePackageRequest = new GroupUpdatePackageRequest();
Boolean groupUpdatePackageResponse;
try {
groupUpdatePackageRequest.setEmail("polyvtest0625@polyv.net");
groupUpdatePackageRequest.setBalance(2f);
groupUpdatePackageRequest.setConcurrent(5);
groupUpdatePackageRequest.setRemainFlow(10);
groupUpdatePackageRequest.setRemainSpace(10);
groupUpdatePackageResponse = new UserServiceImpl().updatePackage(groupUpdatePackageRequest);
Assert.assertNotNull(groupUpdatePackageResponse);
if (groupUpdatePackageResponse != null) {
//to do something ......
log.debug("测试分配分帐号资源成功 {}", JSON.toJSONString(groupUpdatePackageResponse));
}
} 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. The B-end processes business logic based on this object.If 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 exception, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g., [Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| true | String | Sub-account email | |
| balance | false | Float | Amount, cannot be less than 0 |
| concurrent | false | Integer | Concurrent count |
| minutes | false | Integer | Available minutes |
| remainFlow | false | Integer | VOD traffic, unit G |
| remainSpace | false | Integer | VOD space, unit G |
| linkMicLimit | false | Integer | Link mic participant limit, max 16 |
| linkMicMinutes | false | Integer | Link mic minutes |
| guideMinutes | false | Integer | Cloud studio minutes |
| maxChannels | false | Integer | Number of creatable channels |
Response Object Description
true indicates successful allocation, false indicates failed allocation.
