Class SuggestionsResponse
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
SuggestionsResponse
Một đối tượng phản hồi có thể được trả về từ hàm gọi lại đề xuất. Phương thức này được dùng với các tiện ích TextInput
triển khai tính năng tự động hoàn thành.
Có sẵn cho các tiện ích bổ sung của Google Workspace và ứng dụng Google Chat.
const suggestionsResponse = CardService.newSuggestionsResponseBuilder()
.setSuggestions(
CardService.newSuggestions()
.addSuggestion('First suggestion')
.addSuggestion('Second suggestion'),
)
.build();
Phương thức
Phương thức | Kiểu 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: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eSuggestionsResponse\u003c/code\u003e objects, used with \u003ccode\u003eTextInput\u003c/code\u003e widgets for autocomplete, facilitate suggestions within Google Workspace Add-ons and Google Chat apps.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can leverage the \u003ccode\u003eSuggestionsResponseBuilder\u003c/code\u003e to construct a response containing suggestions using methods like \u003ccode\u003esetSuggestions\u003c/code\u003e and \u003ccode\u003eaddSuggestion\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eFor debugging purposes, the \u003ccode\u003eprintJson()\u003c/code\u003e method outputs the JSON structure of the \u003ccode\u003eSuggestionsResponse\u003c/code\u003e object.\u003c/p\u003e\n"]]],[],null,["# Class SuggestionsResponse\n\nSuggestionsResponse\n\nA response object that can be returned from a suggestions callback function. This is used with\n[TextInput](/apps-script/reference/card-service/text-input) widgets that implement autocomplete.\n\nAvailable for Google Workspace add-ons and Google Chat apps.\n\n```javascript\nconst suggestionsResponse = CardService.newSuggestionsResponseBuilder()\n .setSuggestions(\n CardService.newSuggestions()\n .addSuggestion('First suggestion')\n .addSuggestion('Second suggestion'),\n )\n .build();\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------|-------------|------------------------------------------------|\n| [printJson()](#printJson()) | `String` | Prints the JSON representation of this object. |\n\nDetailed documentation\n----------------------\n\n### `print``Json()`\n\nPrints the JSON representation of this object. This is for debugging only.\n\n#### Return\n\n\n`String`"]]