Class SuggestionsResponse
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
建议响应
可从建议回调函数返回的响应对象。此属性与实现自动补全功能的 TextInput
微件搭配使用。
适用于 Google Workspace 插件和 Google Chat 应用。
const suggestionsResponse = CardService.newSuggestionsResponseBuilder()
.setSuggestions(
CardService.newSuggestions()
.addSuggestion('First suggestion')
.addSuggestion('Second suggestion'),
)
.build();
详细文档
printJson()
输出此对象的 JSON 表示法。这仅用于调试。
返回
String
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\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`"]]