Class ActionResponse
ДействиеОтвет Объект ответа, который может быть возвращен функцией обратного вызова (например, обработчиком ответа формы) для выполнения одного или нескольких действий над клиентом. Некоторые комбинации действий не поддерживаются.
// An action that opens a link
var actionResponse = CardService.newActionResponseBuilder()
.setOpenLink(CardService.newOpenLink()
.setUrl("https://www.google.com"))
.build();
// An action that shows a notification.
var actionResponse = 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.
var cardBuilder = CardService.newCardBuilder();
// Build card ...
var actionResponse = CardService.newActionResponseBuilder()
.setNavigation(CardService.newNavigation()
.pushCard(cardBuilder.build()))
.setStateChanged(true)
.build();
Методы
Метод | Тип возврата | Краткое описание |
---|
printJson() | String | Печатает JSON-представление этого объекта. |
Подробная документация
printJson()
Печатает JSON-представление этого объекта. Это только для отладки.
Возвращаться
String
Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons "С указанием авторства 4.0", а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. Java – это зарегистрированный товарный знак корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2025-01-15 UTC.
[null,null,["Последнее обновление: 2025-01-15 UTC."],[[["`ActionResponse` enables callback functions to trigger actions like opening links, displaying notifications, and navigating between cards within Google Workspace add-ons."],["Developers can use `ActionResponseBuilder` methods to define these actions and control client-side behavior based on user interactions."],["The `printJson()` method helps with debugging by providing the JSON representation of the `ActionResponse` object."]]],["The `ActionResponse` object enables client-side actions from callback functions. It supports actions like opening a link, displaying a notification, or showing a new card. `setOpenLink` opens a specified URL, `setNotification` displays text to the user, and `setNavigation` pushes a new card. `setStateChanged` indicates changes in original data. `printJson()` provides a JSON representation of the object for debugging. Certain action combinations may be unsupported.\n"]]