Notification通知
更新时间:2023-04-23
通知功能可以在音视频转码任务状态转换时主动向开发者服务器推送消息。
创建通知
如果需要创建通知可以参考如下代码:
Go
1name := "test"
2endpoint := "http://www.baidu.com"
3err := MEDIA_CLIENT.CreateNotification(name, endpoint)
4if err != nil {
5 fmt.Printf("create notification error: %+v\n", err)
6 return
7}
8fmt.Println("create notification success")
查询指定通知
如果需要查询已创建的通知,可以参考如下代码:
Go
1name := "test"
2response, err := MEDIA_CLIENT.GetNotification(test)
3if err != nil {
4 fmt.Printf("get notification error: %+v\n", err)
5 return
6}
7fmt.Printf("get notification success : %+v\n", response)
查询当前用户通知
如果需要查询出本用户所创建的全部通知,可以参考如下代码:
Go
1response, err := MEDIA_CLIENT.ListNotification()
2if err != nil {
3 fmt.Printf("list user`s notification error: %+v\n", err)
4 return
5}
6for _, notification := range response.Notifications {
7 fmt.Printf("list notification success : %+v\n", notification)
8}
删除通知
如果需要删除某个通知,可以参考如下代码:
Go
1name := "test"
2err := MEDIA_CLIENT.DeleteNotification(name)
3if err != nil {
4 fmt.Printf("delete notification error: %+v\n", err)
5 return
6}
7fmt.Println("delete notification success")