Class ActionResponse
Thao tácPhản hồi
Đối tượng phản hồi có thể được trả về từ một hàm gọi lại (ví dụ: trình xử lý phản hồi biểu mẫu) để thực hiện một hoặc nhiều thao tác trên ứng dụng. Một số tổ hợp hành động không được hỗ trợ.
// 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();
Phương thức
Phương thức | Loại dữ liệu trả về | Mô tả ngắn |
printJson() | String | In nội dung đại diện JSON của đối tượng này. |
Tài liệu chi tiết
printJson()
In nội dung đại diện JSON của đối tượng này. Lựa chọn này chỉ dùng để gỡ lỗi.
Cầu thủ trả bóng
String
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2024-12-22 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2024-12-22 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"]]