API 参考
笔记
通过 app.capabilities 判断功能支持,通过 app.access 和宿主权限判断访问授权。示例使用合成数据,调用前请替换路径、ID、输入和筛选条件。
类型定义
graphql
type Mutation {
createNote(input: NoteInput!): Note!
deleteNotes(query: String!): ActionResult!
restoreNotes(query: String!): ActionResult!
saveFeedEntriesToNotes(query: String!): [ID!]!
trashNotes(query: String!): ActionResult!
updateNote(id: ID!, input: NoteInput!): Note!
}
type Query {
exportNotes(query: String!): String!
note(id: ID!): Note
noteCount(query: String!): Int!
notes(query: String!, offset: Int!, limit: Int!): [Note!]!
}
type ActionResult {
affectedCount: Int!
}
enum DataType {
DEFAULT
AUDIO
VIDEO
IMAGE
SMS
CONTACT
NOTE
FEED_ENTRY
CALL
PACKAGE
FILE
APP_FILE
DOC
}
scalar Instant
type Note {
id: ID!
title: String!
content: String!
deletedAt: Instant
createdAt: Instant!
updatedAt: Instant!
tags: [Tag!]!
}
input NoteInput {
title: String!
content: String!
}
type Tag {
id: ID!
name: String!
type: DataType!
count: Int!
}操作
mutation
createNote
根据传入的数据创建并持久化笔记。
graphql
mutation createNote($input: NoteInput!) {
createNote(input: $input) { id title content deletedAt createdAt updatedAt }
}mutation
deleteNotes
永久删除符合查询条件的回收站笔记,仅操作已移入回收站的笔记。
graphql
mutation deleteNotes($query: String!) {
deleteNotes(query: $query) { affectedCount }
}mutation
restoreNotes
恢复符合查询条件的回收站笔记。
graphql
mutation restoreNotes($query: String!) {
restoreNotes(query: $query) { affectedCount }
}mutation
saveFeedEntriesToNotes
将匹配的订阅文章保存为笔记,并返回创建的笔记 ID。
graphql
mutation saveFeedEntriesToNotes($query: String!) {
saveFeedEntriesToNotes(query: $query)
}mutation
trashNotes
将符合查询条件的笔记移入回收站。
graphql
mutation trashNotes($query: String!) {
trashNotes(query: $query) { affectedCount }
}mutation
updateNote
根据传入的数据更新已存储的笔记。
graphql
mutation updateNote($id: ID!, $input: NoteInput!) {
updateNote(id: $id, input: $input) { id title content deletedAt createdAt updatedAt }
}query
exportNotes
将符合查询条件的笔记及其标签序列化为 JSON 字符串,用于备份或传输。
graphql
query exportNotes($query: String!) {
exportNotes(query: $query)
}query
note
按 ID 获取一条笔记。
graphql
query note($id: ID!) {
note(id: $id) { id title content deletedAt createdAt updatedAt }
}query
noteCount
统计符合查询条件的笔记数。
graphql
query noteCount($query: String!) {
noteCount(query: $query)
}query
notes
搜索笔记的标题和内容;query 留空时列出全部非回收站笔记。
graphql
query notes($query: String!, $offset: Int!, $limit: Int!) {
notes(query: $query, offset: $offset, limit: $limit) { id title content deletedAt createdAt updatedAt }
}