Class UniversalActionResponse
通用操作响应
创建通用操作的方法可能会返回的响应对象。
// A universal action that opens a link.
const openLinkUniversalAction =
CardService.newUniversalActionResponseBuilder()
.setOpenLink(CardService.newOpenLink().setUrl('https://www.google.com'))
.build();
const cardBuilder1 = CardService.newCardBuilder();
const cardBuilder2 = CardService.newCardBuilder();
// Finish building the cards ...
// A universal action that shows two static cards.
const cardsUniversalAction =
CardService.newUniversalActionResponseBuilder()
.displayAddOnCards([cardBuilder1.build(), cardBuilder2.build()])
.build();
详细文档
printJson()
输出此对象的 JSON 表示法。这仅用于调试。
返回
String
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-12-21。
[null,null,["最后更新时间 (UTC):2024-12-21。"],[[["`UniversalActionResponse` objects are returned from methods creating universal actions, like opening links or displaying cards."],["These objects can define actions like opening a web link using `setOpenLink()` or showing cards using `displayAddOnCards()`."],["For debugging, the `printJson()` method outputs the object's JSON representation as a string."]]],["The `UniversalActionResponse` object is used to define actions within a card-based interface. Key actions include using the `setOpenLink` method to open a URL and `displayAddOnCards` to display multiple static cards. `printJson()` is a method for debugging, that returns the JSON representation of the object as a string. These methods are used within the `UniversalActionResponseBuilder` to create the object.\n"]]