我想阅读谷歌为特定帐户返回的通知列表。看来我的旧程序不起作用,我找不到新 API 的示例。回到代码,假设mybusinessNotif
是一个类型的初始化器,MyBusinessNotificationSettings
它也处理凭据:
MyBusinessNotificationSettings.Accounts.GetNotificationSetting request =mybusinessNotif.accounts().getNotificationSetting(name+"/notificationSetting");
NotificationSetting response=request.execute();
List<String> notifTypeList=response.getNotificationTypes();
System.out.println("response="+response.toPrettyString());
if(notifTypeList!=null && !notifTypeList.isEmpty()) {
for(String st:notifTypeList) {
System.out.println("notifTypeList ==="+ st);
}
}
Google 没有响应通知,唯一的响应是帐户名称:
response={ "name" : "accounts/XXXXX/notificationSetting" }
我没有在文档中找到任何示例来查看语法是什么:[https://developers.google.com/my-business/reference/notifications/rest/v1/NotificationSetting] 写的是如果我想查看通知我需要设置pubsubTopic
字符串类型:
可选的。当此帐户管理的位置更新时将收到通知的 Google Pub/Sub 主题。如果未设置,则不会发布任何通知。帐户 mybusiness-api-pubsub@system.gserviceaccount.com 必须至少具有 Pub/Sub 主题的发布权限。
应该如何设置这个所谓的 pubsub 主题?有没有人使用过这个 API,可以帮我一把吗?