Web Interact
1、设置道具打赏
描述
设置道具打赏
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/donate/update-good
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testUpdateChannelGood() throws Exception, NoSuchAlgorithmException {
LiveUpdateChannelGoodRequest liveUpdateChannelGoodRequest = new LiveUpdateChannelGoodRequest();
Boolean liveUpdateChannelGoodResponse;
try {
List<LiveUpdateChannelGoodRequest.ChannelGood> channelGoods =
new ArrayList<LiveUpdateChannelGoodRequest.ChannelGood>();
LiveUpdateChannelGoodRequest.ChannelGood channelGood = new LiveUpdateChannelGoodRequest.ChannelGood();
channelGood.setGoodName("佛跳墙")
.setGoodImg("//livestatic.videocc.net/uploaded/images/webapp/channel/donate/07-diamond.png")
.setGoodPrice(9999.99)
.setGoodEnabled("Y");
channelGoods.add(channelGood);
liveUpdateChannelGoodRequest.setChannelId(createChannel()).setEnabled("Y").setGoods(channelGoods);
liveUpdateChannelGoodResponse = new LiveWebInteractServiceImpl().updateChannelGood(
liveUpdateChannelGoodRequest);
Assert.assertNotNull(liveUpdateChannelGoodResponse);
if (liveUpdateChannelGoodResponse) {
//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
频道号,不传为全局设置
enabled
false
String
请求体参数,道具打赏开关,不传默认开启,值为 Y/N , Y为开启
goodName
true
String
道具名称,不能超过5个字符
goodImg
true
String
道具图片,不能超过120个字符(通过上传图片接口上传获取图片地址,或者使用默认地址;鲜花:01-flower.png;咖啡:02-coffee.png;点赞:03-good.png;掌声:04-applaud.png;666:05-666.png;小星星:06-star.png;钻石:07-diamond.png;跑车:08-car.png;火箭:09-rocket.png;前缀统一为://livestatic.videocc.net/uploaded/images/webapp/channel/donate/)
goodPrice
true
Double
道具打赏价格
goodEnabled
true
String
道具开关,值为 Y/N , Y为开启
返回对象描述
true代表设置成功,false代表设置失败
2、设置现金打赏
描述
用于设置频道或者全局现金打赏
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/donate/update-cash
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
2、带上频道号为设置频道现金打赏,不带频道号默认为全局现金打赏设置
单元测试
@Test
public void testUpdateChannelCash() throws Exception, NoSuchAlgorithmException {
LiveUpdateChannelCashRequest liveUpdateChannelCashRequest = new LiveUpdateChannelCashRequest();
Boolean liveUpdateChannelCashResponse;
try {
Double[] floats = {0.88d, 6.66d, 8.88d, 18.11d, 66.60d, 88.89d};
List<Double> cashes = Arrays.asList(floats);
liveUpdateChannelCashRequest.setChannelId(createChannel())
.setCashes(cashes)
.setCashMin(0.02d)
.setEnabled("Y");
liveUpdateChannelCashResponse = new LiveWebInteractServiceImpl().updateChannelCash(
liveUpdateChannelCashRequest);
Assert.assertNotNull(liveUpdateChannelCashResponse);
if (liveUpdateChannelCashResponse) {
//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
频道号,不传为全局设置
cashes
true
Array
请求体参数,现金打赏数额数组,数组的长度必须为6
cashMin
true
Double
请求体参数,现金打赏自定义最小金额
enabled
false
String
请求体参数,现金打赏开关,不传默认开启,值为 Y/N , Y为开启
返回对象描述
true表示设置成功,false表示设置失败
3、查询打赏设置
描述
查询打赏设置
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/donate/get
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testGetChannelDonate() throws Exception, NoSuchAlgorithmException {
LiveChannelDonateRequest liveChannelDonateRequest = new LiveChannelDonateRequest();
LiveChannelDonateResponse liveChannelDonateResponse;
try {
liveChannelDonateRequest.setChannelId(createChannel());
liveChannelDonateResponse = new LiveWebInteractServiceImpl().getChannelDonate(liveChannelDonateRequest);
Assert.assertNotNull(liveChannelDonateResponse);
if (liveChannelDonateResponse != null) {
//to do something ......
log.debug("测试查询打赏设置成功,{}", JSON.toJSONString(liveChannelDonateResponse));
}
} 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、请求正确,返回LiveChannelDonateResponse对象,B端依据此对象处理业务逻辑;
2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]
3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]
请求入参描述
channelId
false
String
频道号,不传为获取全局设置
返回对象描述
globalSettingEnabled
String
是否应用全局设置,获取全局设置时,该值为null
donateCashEnabled
String
现金打赏开关
donateGoodEnabled
String
道具打赏开关
donateTips
String
打赏提示
cashes
Array
请求体参数,现金打赏数额数组,数组的长度必须为6
cashMin
Double
请求体参数,现金打赏自定义最小金额
goodName
String
道具名称,不能超过5个字符
goodImg
String
道具图片,不能超过120个字符(通过上传图片接口上传获取图片地址,或者使用默认地址;鲜花:01-flower.png;咖啡:02-coffee.png;点赞:03-good.png;掌声:04-applaud.png;666:05-666.png;小星星:06-star.png;钻石:07-diamond.png;跑车:08-car.png;火箭:09-rocket.png;前缀统一为://livestatic.videocc.net/uploaded/images/webapp/channel/donate/)
goodPrice
Double
道具打赏价格
goodEnabled
String
道具开关,值为 Y/N , Y为开启
4、设置频道微信分享信息
描述
用于修改频道的微信分享相关设置
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/weixin-share/update
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testUpdateChannelWxShare() throws Exception, NoSuchAlgorithmException {
LiveUpdateChannelWxShareRequest liveUpdateChannelWxShareRequest = new LiveUpdateChannelWxShareRequest();
Boolean liveUpdateChannelWxShareResponse;
try {
liveUpdateChannelWxShareRequest.setChannelId(createChannel())
.setWxShareTitle("Mysql 知识精讲")
.setWxShareDesc("带你走进Mysql的奇妙世界");
liveUpdateChannelWxShareResponse = new LiveWebInteractServiceImpl().updateChannelWxShare(
liveUpdateChannelWxShareRequest);
Assert.assertTrue(liveUpdateChannelWxShareResponse);
if (liveUpdateChannelWxShareResponse) {
//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
true
String
频道号
wxShareTitle
false
String
微信分享的标题(30字符内)【对应api文档的weixinShareTitle字段】
wxShareDesc
false
String
微信分享的描述(120字符内)【对应api文档的weixinShareDesc字段】
返回对象描述
true为设置成功,false为设置失败
5、查询频道微信分享信息
描述
获取频道的微信分享设置信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/weixin-share/get
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testGetChannelWxShare() throws Exception, NoSuchAlgorithmException {
LiveGetChannelWxShareRequest liveGetChannelWxShareRequest = new LiveGetChannelWxShareRequest();
LiveGetChannelWxShareResponse liveGetChannelWxShareResponse;
try {
liveGetChannelWxShareRequest.setChannelId(createChannel());
liveGetChannelWxShareResponse = new LiveWebInteractServiceImpl().getChannelWxShare(
liveGetChannelWxShareRequest);
Assert.assertNotNull(liveGetChannelWxShareResponse);
if (liveGetChannelWxShareResponse != null) {
//to do something ......
log.debug("测试查询频道微信分享信息成功,{}", JSON.toJSONString(liveGetChannelWxShareResponse));
}
} 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、请求正确,返回LiveGetChannelWxShareResponse对象,B端依据此对象处理业务逻辑;
2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]
3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]
请求入参描述
channelId
true
String
频道号
返回对象描述
channelId
String
频道号
channelName
String
频道名称
coverImg
String
微信分享图标,即频道的直播图标
wxShareTitle
String
微信分享的标题【对应api文档的weixinShareTitle字段】
wxShareDesc
String
微信分享的描述【对应api文档的weixinShareDesc字段】
6、查询频道打赏设置
描述
查询频道打赏设置,包括现金打赏、礼物打赏,礼物打赏又分为现金支付和积分支付
接口地址(仅做说明使用):https://api.polyv.net/live/v4/user/donate/get
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testGetChannelDonateV2() throws IOException, NoSuchAlgorithmException {
LiveGetChannelDonateRequest liveGetChannelDonateRequest = new LiveGetChannelDonateRequest();
LiveGetChannelDonateResponse liveGetChannelDonateResponse;
try {
String channelId = super.createChannel();
liveGetChannelDonateRequest.setChannelId(channelId);
liveGetChannelDonateResponse = new LiveWebInteractServiceImpl().getChannelDonateV2(
liveGetChannelDonateRequest);
Assert.assertNotNull(liveGetChannelDonateResponse);
if (liveGetChannelDonateResponse != null) {
//to do something ......
log.debug("测试查询频道打赏设置成功{}", JSON.toJSONString(liveGetChannelDonateResponse));
}
} 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、请求正确,返回LiveGetChannelDonateResponse对象,B端依据此对象处理业务逻辑;
2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]
3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]
请求入参描述
channelId
true
String
频道号
返回对象描述
donateCashEnabled
String
现金红包打赏开关,Y:开启,N:关闭
donateGiftEnabled
String
礼物打赏开关,Y:开启,N:关闭
cashes
Array
固定打赏金额,数组长度在1-6,最小值0.01,最大值9999.99【对应api文档的cashs字段】
cashMin
Float
自定义打赏金额-最低金额,最小值0.01,最大值9999.99
payWay
String
支付方式,CASH:现金支付,POINT:积分支付
cashUnit
String
现金单位
pointUnit
String
积分单位
name
String
礼物名称
img
String
礼物图片地址
price
Float
礼物价格
enabled
String
开关,Y:开启,N:关闭
name
String
礼物名称
img
String
礼物图片地址
price
Float
礼物价格
enabled
String
开关,Y:开启,N:关闭
7、修改频道礼物打赏设置
描述
修改频道礼物打赏设置,礼物打赏又分为现金支付和积分支付
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/donate/gift/update
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testUpdateChannelDonateV2() throws IOException, NoSuchAlgorithmException {
LiveUpdateChannelDonateRequest liveUpdateChannelDonateRequest = new LiveUpdateChannelDonateRequest();
Boolean liveUpdateChannelDonateResponse;
try {
LiveUpdateChannelDonateRequest.ChannelGiftDonate giftDonate =
new LiveUpdateChannelDonateRequest.ChannelGiftDonate();
List<LiveUpdateChannelDonateRequest.ChannelGift> giftList = new ArrayList<>();
LiveUpdateChannelDonateRequest.ChannelGift gift1 = new LiveUpdateChannelDonateRequest.ChannelGift();
gift1.setImg("//liveimages.videocc.net/uploaded/images/2021/11/g41in083xo.png")
.setName("现金礼物1")
.setPrice(Float.valueOf("66.66"))
.setEnabled(LiveConstant.Flag.YES.getFlag());
giftList.add(gift1);
List<LiveUpdateChannelDonateRequest.ChannelGift> pointList = new ArrayList<>();
LiveUpdateChannelDonateRequest.ChannelGift gift2 = new LiveUpdateChannelDonateRequest.ChannelGift();
gift2.setImg("//s1.videocc.net/default-img/donate/666.png")
.setName("积分礼物1")
.setPrice(Float.valueOf("88.88"))
.setEnabled(LiveConstant.Flag.YES.getFlag());
pointList.add(gift2);
giftDonate.setPayWay(LiveConstant.PayWay.CASH.getValue())
.setCashPays(giftList)
.setPointPays(pointList)
.setPointUnit("polyv积分");
liveUpdateChannelDonateRequest.setGiftDonate(giftDonate);
liveUpdateChannelDonateRequest.setDonateGiftEnabled(LiveConstant.Flag.YES.getFlag());
liveUpdateChannelDonateRequest.setChannelId(super.createChannel());
liveUpdateChannelDonateResponse = new LiveWebInteractServiceImpl().updateChannelDonateV2(
liveUpdateChannelDonateRequest);
Assert.assertTrue(liveUpdateChannelDonateResponse);
if (liveUpdateChannelDonateResponse) {
//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
true
String
频道号
donateGiftEnabled
false
String
礼物打赏开关,Y:开启,N:关闭
payWay
false
String
支付方式,CASH:现金支付,POINT:积分支付
cashUnit
false
String
现金单位
pointUnit
false
String
积分单位
name
false
String
礼物名称
img
false
String
礼物图片地址
price
false
Float
礼物价格
enabled
false
String
开关,Y:开启,N:关闭
name
false
String
礼物名称
img
false
String
礼物图片地址
price
false
Float
礼物价格
enabled
false
String
开关,Y:开启,N:关闭
返回对象描述
修改频道礼物打赏设置返回实体
8、查询频道卡片推送
描述
查询频道卡片推送,对应新版后台的 营销-卡片
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/card-push/list
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testGetChannelCardPush() throws IOException, NoSuchAlgorithmException {
LiveGetChannelCardPushRequest liveGetChannelCardPushRequest = new LiveGetChannelCardPushRequest();
List<LiveGetChannelCardPushResponse> liveGetChannelCardPushResponse;
try {
String channelId = super.createChannel();
liveGetChannelCardPushRequest.setChannelId(channelId);
liveGetChannelCardPushResponse = new LiveWebInteractServiceImpl().getChannelCardPush(
liveGetChannelCardPushRequest);
Assert.assertNotNull(liveGetChannelCardPushResponse);
if (liveGetChannelCardPushResponse != null) {
//to do something ......
log.debug("测试查询频道卡片推送成功{}", JSON.toJSONString(liveGetChannelCardPushResponse));
}
} 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、请求正确,返回LiveGetChannelCardPushResponse对象,B端依据此对象处理业务逻辑;
2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]
3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]
请求入参描述
channelId
true
String
频道ID
返回对象描述
返回对象是List<LiveGetChannelCardPushResponse>,LiveGetChannelCardPushResponse具体元素内容如下:
id
Long
卡片推送主键ID
channelId
String
频道ID
title
String
卡片标题,最多16个字符
imageType
String
卡片样式类型,giftbox:礼物领取样式,redpack:红包样式
duration
Integer
卡片倒计时时长,取值:0,5,10,20,30,单位:秒,0为不显示倒计时时长
link
String
卡片跳转链接地址,带http://等协议头
pushEndTime
Date
推送结束时间
createdTime
Date
创建时间
lastModified
Date
修改时间
pushStatus
String
推送状态Y.推送中、N.未推送、L.上次推送
pushTime
Date
推送时间
enterEnabled
String
卡片入口Y.开启、N.关闭
showCondition
String
弹出方式,PUSH.推送后立即弹出、WATCH.观看后弹出
conditionValue
Integer
观看时长
conditionUnit
String
观看时长单位SECONDS.秒、MINUTES.分钟
countdownMsg
String
倒计时文案,showCondition为WATCH时生效,最多8个字符
9、创建频道卡片推送
描述
创建频道卡片推送,对应新版后台的 营销-卡片
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/card-push/create
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testCreateChannelCardPush() throws IOException, NoSuchAlgorithmException {
LiveCreateChannelCardPushRequest liveCreateChannelCardPushRequest = new LiveCreateChannelCardPushRequest();
LiveCreateChannelCardPushResponse liveCreateChannelCardPushResponse;
try {
String channelId = super.createChannel();
liveCreateChannelCardPushRequest.setChannelId(channelId)
.setTitle("测试SDK卡片推送")
.setLink("http://polyv.net")
.setImageType(LiveConstant.ImageType.GIFT_BOX.getValue())
.setDuration(LiveConstant.CardPushDuration.DURATION_TEN.getValue())
.setShowCondition(LiveConstant.ShowCondition.WATCH.getValue())
.setConditionValue(10)
.setConditionUnit(LiveConstant.ConditionUnit.SECONDS.getValue())
.setCountdownMsg("倒计时")
.setEnterEnabled(LiveConstant.Flag.YES.getFlag());
liveCreateChannelCardPushResponse = new LiveWebInteractServiceImpl().createChannelCardPush(
liveCreateChannelCardPushRequest);
Assert.assertNotNull(liveCreateChannelCardPushResponse);
if (liveCreateChannelCardPushResponse != null) {
//to do something ......
log.debug("测试创建频道卡片推送成功{}", JSON.toJSONString(liveCreateChannelCardPushResponse));
//TODO 此处创建完成后删除了卡片推送,正式使用需删除该语句
super.deleteChannelPushCard(channelId, liveCreateChannelCardPushResponse.getId());
}
} 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、请求正确,返回LiveCreateChannelCardPushResponse对象,B端依据此对象处理业务逻辑;
2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]
3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]
请求入参描述
channelId
true
String
频道号
imageType
true
String
卡片样式类型,giftbox:礼物领取样式,redpack:红包样式
title
true
String
卡片标题,最多16个字符
link
true
String
卡片跳转链接地址,需要带http:等协议头
duration
true
Integer
卡片倒计时时长,取值:0,5,10,20,30,单位:秒,0为不显示倒计时时长
showCondition
true
String
弹出方式,PUSH:推送后立即弹出、WATCH:观看后弹出
conditionValue
false
Integer
观看后弹出的观看时长,showCondition为WATCH时生效
conditionUnit
false
String
观看后弹出的观看时长单位SECONDS.秒、MINUTES.分钟,showCondition为WATCH时,该值生效且必填
countdownMsg
false
String
倒计时文案,showCondition为WATCH时生效,最多8个字符
enterEnabled
true
String
卡片入口开关Y.开启、N.关闭
返回对象描述
id
Long
卡片推送主键ID
channelId
String
频道ID
title
String
卡片标题,最多16个字符
imageType
String
卡片样式类型,giftbox:礼物领取样式,redpack:红包样式
duration
Integer
卡片倒计时时长,取值:0,5,10,20,30,单位:秒,0为不显示倒计时时长
link
String
卡片跳转链接地址,带http:等协议头
pushEndTime
Date
推送结束时间
createdTime
Date
创建时间
lastModified
Date
修改时间
pushStatus
String
推送状态Y.推送中、N.未推送、L.上次推送
pushTime
Date
推送时间
enterEnabled
String
卡片入口Y.开启、N.关闭
showCondition
String
弹出方式,PUSH.推送后立即弹出、WATCH.观看后弹出
conditionValue
Integer
观看时长
conditionUnit
String
观看时长单位SECONDS.秒、MINUTES.分钟
countdownMsg
String
倒计时文案,showCondition为WATCH时生效,最多8个字符
10、修改频道卡片推送
描述
修改频道卡片推送,对应新版后台的 营销-卡片
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/card-push/update
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testUpdateChannelCardPush() throws IOException, NoSuchAlgorithmException {
LiveUpdateChannelCardPushRequest liveUpdateChannelCardPushRequest = new LiveUpdateChannelCardPushRequest();
Boolean liveUpdateChannelCardPushResponse;
try {
String channelId = super.createChannel();
liveUpdateChannelCardPushRequest.setChannelId(channelId)
.setCardPushId(super.getChannelCardPushId(channelId))
.setTitle("测试SDK修改卡片推送")
.setLink("https://polyv.net");
liveUpdateChannelCardPushResponse = new LiveWebInteractServiceImpl().updateChannelCardPush(
liveUpdateChannelCardPushRequest);
Assert.assertTrue(liveUpdateChannelCardPushResponse);
if (liveUpdateChannelCardPushResponse) {
//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
true
String
频道号
cardPushId
true
Long
卡片推送主键ID
imageType
false
String
卡片样式类型,giftbox:礼物领取样式,redpack:红包样式
title
false
String
卡片标题,最多16个字符
link
false
String
卡片跳转链接地址,需要带http:等协议头
duration
false
Integer
卡片倒计时时长,取值:0,5,10,20,30,单位:秒,0为不显示倒计时时长
showCondition
false
String
弹出方式,PUSH:推送后立即弹出、WATCH:观看后弹出
conditionValue
false
Integer
观看后弹出的观看时长,showCondition为WATCH时生效
conditionUnit
false
String
观看后弹出的观看时长单位SECONDS.秒、MINUTES.分钟,showCondition为WATCH时,该值生效且必填
countdownMsg
false
String
倒计时文案,showCondition为WATCH时生效,最多8个字符
enterEnabled
false
String
卡片入口开关Y.开启、N.关闭
返回对象描述
修改频道卡片推送返回实体
11、删除卡片推送
描述
删除卡片推送,对应新版后台的 营销-卡片
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/card-push/delete
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testDeleteChannelCardPush() throws IOException, NoSuchAlgorithmException {
LiveDeleteChannelCardPushRequest liveDeleteChannelCardPushRequest = new LiveDeleteChannelCardPushRequest();
Boolean liveDeleteChannelCardPushResponse;
try {
String channelId = super.createChannel();
liveDeleteChannelCardPushRequest.setChannelId(channelId)
.setCardPushId(super.getChannelCardPushId(channelId));
liveDeleteChannelCardPushResponse = new LiveWebInteractServiceImpl().deleteChannelCardPush(
liveDeleteChannelCardPushRequest);
Assert.assertTrue(liveDeleteChannelCardPushResponse);
if (liveDeleteChannelCardPushResponse) {
//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
true
String
频道号
cardPushId
true
Long
卡片推送主键ID
返回对象描述
删除卡片推送返回实体
12、推送频道卡片
描述
推送频道卡片,对应新版后台的 营销-卡片
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/card-push/push
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testPushChannelCardPush() throws IOException, NoSuchAlgorithmException {
LivePushChannelCardPushRequest livePushChannelCardPushRequest = new LivePushChannelCardPushRequest();
Boolean livePushChannelCardPushResponse;
try {
String channelId = super.createChannel();
Long cardPushId = super.getChannelCardPushId(channelId);
livePushChannelCardPushRequest.setChannelId(channelId).setCardPushId(cardPushId);
livePushChannelCardPushResponse = new LiveWebInteractServiceImpl().pushChannelCardPush(
livePushChannelCardPushRequest);
Assert.assertTrue(livePushChannelCardPushResponse);
if (livePushChannelCardPushResponse) {
//to do something ......
log.debug("测试推送频道卡片成功");
//TODO 此处创建完成后删除了卡片推送,正式使用需删除该语句
super.deleteChannelPushCard(channelId, cardPushId);
}
} 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
true
String
频道号
cardPushId
true
Long
卡片推送主键ID
返回对象描述
推送频道卡片返回实体
13、取消推送卡片
描述
取消推送卡片,对应新版后台的 营销-卡片
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/card-push/cancel-push
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testCancelPushChannelCardPush() throws IOException, NoSuchAlgorithmException {
LiveCancelPushChannelCardPushRequest liveCancelPushChannelCardPushRequest =
new LiveCancelPushChannelCardPushRequest();
Boolean liveCancelPushChannelCardPushResponse;
try {
String channelId = super.createChannel();
liveCancelPushChannelCardPushRequest.setChannelId(channelId)
.setCardPushId(super.getChannelPushingCardId(channelId));
liveCancelPushChannelCardPushResponse = new LiveWebInteractServiceImpl().cancelPushChannelCardPush(
liveCancelPushChannelCardPushRequest);
Assert.assertTrue(liveCancelPushChannelCardPushResponse);
if (liveCancelPushChannelCardPushResponse) {
//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
true
String
频道号
cardPushId
true
Long
卡片推送主键ID
返回对象描述
取消推送卡片返回实体
14、查询频道微信分享信息
描述
查询频道微信分享信息
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/share/get
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testGetChannelShare() throws IOException, NoSuchAlgorithmException {
LiveGetChannelShareRequest liveGetChannelShareRequest = new LiveGetChannelShareRequest();
LiveGetChannelShareResponse liveGetChannelShareResponse;
try {
String channelId = super.createChannel();
liveGetChannelShareRequest.setChannelId(channelId);
liveGetChannelShareResponse = new LiveWebInteractServiceImpl().getChannelShare(liveGetChannelShareRequest);
Assert.assertNotNull(liveGetChannelShareResponse);
if (liveGetChannelShareResponse != null) {
//to do something ......
log.debug("测试查询频道微信分享信息成功{}", JSON.toJSONString(liveGetChannelShareResponse));
}
} 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、请求正确,返回LiveGetChannelShareResponse对象,B端依据此对象处理业务逻辑;
2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]
3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]
请求入参描述
channelId
true
String
频道号
返回对象描述
shareBtnEnable
String
是否开启分享,Y:开启,N:关闭
titleType
String
标题类型follow直播标题、custom自定义
weixinShareTitle
String
分享标题,最大长度50,标题类型为custom时,该字段生效
weixinShareDesc
String
分享简介,最大长度120,标题类型为custom时,该字段生效
weixinShareCustomUrl
String
微信自定义分享地址,最大长度512
webShareCustomUrl
String
网页观看自定义分享地址,最大长度512
15、修改频道微信分享信息
描述
修改频道微信分享信息,对应新版后台的 营销-分享设置
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/share/update
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testUpdateChannelShare() throws IOException, NoSuchAlgorithmException {
LiveUpdateChannelShareRequest liveUpdateChannelShareRequest = new LiveUpdateChannelShareRequest();
Boolean liveUpdateChannelShareResponse;
try {
String channelId = super.createChannel();
liveUpdateChannelShareRequest.setChannelId(channelId)
.setShareBtnEnable(LiveConstant.Flag.YES.getFlag())
.setTitleType(LiveConstant.TitleType.FOLLOW.getValue());
liveUpdateChannelShareResponse = new LiveWebInteractServiceImpl().updateChannelShare(
liveUpdateChannelShareRequest);
Assert.assertTrue(liveUpdateChannelShareResponse);
if (liveUpdateChannelShareResponse) {
//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
true
String
频道号
shareBtnEnable
true
String
是否开启分享,Y:开启,N:关闭
titleType
true
String
标题类型follow直播标题、custom自定义
weixinShareTitle
false
String
分享标题,最大长度50,标题类型为custom时,该字段必填
weixinShareDesc
false
String
分享简介,最大长度120,标题类型为custom时,该字段必填
weixinShareCustomUrl
false
String
微信自定义分享地址,最大长度512,链接必须带协议,如:https://,链接需要进行encode
webShareCustomUrl
false
String
网页观看自定义分享地址,最大长度512,链接必须带协议,如:https://,链接需要进行encode
返回对象描述
修改频道微信分享信息返回实体
Last updated
Was this helpful?