invitePosterService
1. Query Invitation Poster Detail Data
Description
分页查询邀请海报明细数据统计
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/invite/list
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 testGetInviteStats() throws IOException, NoSuchAlgorithmException {
LiveGetInviteStatsRequest liveGetInviteStatsRequest = new LiveGetInviteStatsRequest();
LiveGetInviteStatsResponse liveGetInviteStatsResponse;
try {
String channelId = super.getAloneNewChannelId();
liveGetInviteStatsRequest.setChannelId(channelId)
.setStartTime(super.getDate(1651219474000L))
.setEndTime(super.getDate(1651219478000L));
liveGetInviteStatsResponse = new ILiveInvitePosterServiceImpl().getInviteStats(liveGetInviteStatsRequest);
Assert.assertNotNull(liveGetInviteStatsResponse);
if (liveGetInviteStatsResponse != null) {
//to do something ......
log.debug("测试查询邀请海报明细数据成功 {}", JSON.toJSONString(liveGetInviteStatsResponse));
}
} 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
LiveGetInviteStatsResponseobject is returned, and the B-side 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 error during processing, 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 | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| startTime | false | Date | Invitation start time |
| endTime | false | Date | Invitation end time |
| currentPage | false | Integer | Page number, defaults to 1 [Corresponds to the pageNumber field in the API documentation] |
| pageSize | false | Integer | Number of data items per page, defaults to 20 |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the Polyv official website: Official website -> Login -> Live (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the Polyv official website: Official website -> Login -> Live (Development Settings) |
Return Object Description
| Parameter | Type | Description |
|---|---|---|
| contents | Array | Current page content [See InviteStats Parameter Description for details] |
| pageSize | Integer | Number of data items 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] |
InviteStats Parameter Description
| Parameter | Type | Description |
|---|---|---|
| invitee | String | Custom invitation ID (defaults to empty, requires configuration to have a value) |
| openId | String | Inviter's WeChat openId |
| viewerId | String | Inviter's ViewerID |
| nickname | String | Inviter's nickname |
| avatar | String | Inviter's avatar URL |
| createdTime | Date | Poster generation time, 13-digit millisecond timestamp |
| receiverNickname | String | Invitee's nickname |
| receiverOpenId | String | Invitee's WeChat openId |
| receiverViewerId | String | Invitee's ViewerId |
| receiverTime | Date | Invitation time, 13-digit millisecond timestamp |
| receiverAvatar | String | Invitee's avatar URL |
2. Create Inviter
Description
邀请海报-创建邀请者
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/invite/poster/create
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 testCreateInviter() throws IOException, NoSuchAlgorithmException {
LiveCreateInviterRequest liveCreateInviterRequest = new LiveCreateInviterRequest();
LiveCreateInviterResponse liveCreateInviterResponse;
try {
String channelId = super.createChannel();
liveCreateInviterRequest.setChannelId(channelId);
liveCreateInviterRequest.setOpenId("1yexRmHZoJrcw40");
liveCreateInviterRequest.setNickname("张三");
liveCreateInviterResponse = new ILiveInvitePosterServiceImpl().createInviter(liveCreateInviterRequest);
Assert.assertNotNull(liveCreateInviterResponse);
if (liveCreateInviterResponse != null) {
//to do something ......
log.debug("测试创建邀请者成功 {}", JSON.toJSONString(liveCreateInviterResponse));
}
} 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
LiveCreateInviterResponseobject is returned, and the B-side 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 error during processing, 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 | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| openId | true | String | Inviter user ID |
| nickname | true | String | Inviter's nickname |
| avatar | false | String | Inviter's avatar URL. If empty, the default avatar is used. |
| viewerId | false | String | Inviter's viewer ID |
| invitee | false | String | Custom invitation ID |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the Polyv official website: Official website -> Login -> Live (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the Polyv official website: Official website -> Login -> Live (Development Settings) |
Return Object Description
| Parameter | Type | Description |
|---|---|---|
| invitePosterId | String | Invitation poster ID |
| channelId | String | Channel ID |
| openId | String | Inviter user ID |
| invitee | String | Custom invitation ID |
