Class ActionResponse

ActionResponse

Đối tượng phản hồi có thể được trả về từ một hàm callback (ví dụ: trình xử lý câu trả lời biểu mẫu) để thực hiện một hoặc nhiều hành động 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ứcKiểu dữ liệu trả vềMô tả ngắn
printJson()StringIn bản trình bày JSON của đối tượng này.

Tài liệu chi tiết

printJson()

In bản trình bày JSON của đối tượng này. Chỉ dùng cho mục đích gỡ lỗi.

Trả về

String