列出备注
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
以下示例展示了如何列出记事:
Java
/** Lists notes using different filtering and pagination options. */
private void listNotes() throws IOException {
// Lists 3 notes that were created after a specified timestamp and that are not trashed. Results
// are ordered by most recently modified first.
ListNotesResponse response =
keepService
.notes()
.list()
.setFilter("create_time > \"2021-01-01T00:00:00Z\"")
.setFilter("-trashed")
.setPageSize(3)
.execute();
System.out.println("List notes response: " + response);
// Lists notes using a pagination token.
ListNotesResponse firstPageResponse = keepService.notes().list().setPageSize(1).execute();
String nextPageToken = firstPageResponse.getNextPageToken();
for (int i = 0; i < 5; i++) {
// Uses the page token that was returned by the previous page's next page token.
ListNotesResponse pagedResponse =
keepService.notes().list().setPageSize(1).setPageToken(nextPageToken).execute();
System.out.println("Listing note:" + pagedResponse);
nextPageToken = pagedResponse.getNextPageToken();
}
}
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-11。
[null,null,["最后更新时间 (UTC):2025-03-11。"],[],[],null,["# List notes\n\nThe following sample shows how to list notes: \n\n### REST\n\nCall [notes.list()](/workspace/keep/api/reference/rest/v1/notes/list).\n\n### Java\n\n /** Lists notes using different filtering and pagination options. */\n private void listNotes() throws IOException {\n // Lists 3 notes that were created after a specified timestamp and that are not trashed. Results\n // are ordered by most recently modified first.\n ListNotesResponse response =\n keepService\n .notes()\n .list()\n .setFilter(\"create_time \u003e \\\"2021-01-01T00:00:00Z\\\"\")\n .setFilter(\"-trashed\")\n .setPageSize(3)\n .execute();\n\n System.out.println(\"List notes response: \" + response);\n\n // Lists notes using a pagination token.\n ListNotesResponse firstPageResponse = keepService.notes().list().setPageSize(1).execute();\n String nextPageToken = firstPageResponse.getNextPageToken();\n\n for (int i = 0; i \u003c 5; i++) {\n // Uses the page token that was returned by the previous page's next page token.\n ListNotesResponse pagedResponse =\n keepService.notes().list().setPageSize(1).setPageToken(nextPageToken).execute();\n System.out.println(\"Listing note:\" + pagedResponse);\n nextPageToken = pagedResponse.getNextPageToken();\n }\n }"]]