Class ActionResponse

操作响应

可从回调函数(例如表单响应处理脚本)返回的响应对象,用于在客户端执行一项或多项操作。某些操作组合不受支持。

// An action that opens a link
const actionResponse =
    CardService.newActionResponseBuilder()
        .setOpenLink(CardService.newOpenLink().setUrl('https://www.google.com'))
        .build();

// An action that shows a notification.
const notificationActionResponse = CardService.newActionResponseBuilder()
                           .setNotification(
                               CardService.newNotification().setText(
                                   'Some info to display to user'),
                               )
                           .build();

// An action that shows an additional card. It also sets a flag to indicate that
// the original state data has changed.

const cardBuilder = CardService.newCardBuilder();
// Build card ...
const navigationActionResponse = CardService.newActionResponseBuilder()
                           .setNavigation(CardService.newNavigation().pushCard(
                               cardBuilder.build()))
                           .setStateChanged(true)
                           .build();

方法

方法返回类型简介
printJson()String输出此对象的 JSON 表示法。

详细文档

printJson()

输出此对象的 JSON 表示法。这仅用于调试。

返回

String