API 參考

Notes

儲存在裝置上的 Markdown 筆記。支援標籤、回收筒/還原和匯出。

型別定義

bash
type Note {
  id: ID!
  title: String!
  content: String!            # Markdown body
  createdAt: String!          # ISO 8601
  updatedAt: String!
  trashed: Boolean!           # true when in trash
  tags: [Tag!]!
}

input NoteInput {
  title: String
  content: String
}

操作

query

notes

搜尋筆記(標題 + 內容)。查詢留空可列出所有未刪除的筆記。

bash
query GetNotes($offset: Int!, $limit: Int!, $query: String!) {
  notes(offset: $offset, limit: $limit, query: $query) {
    id title content createdAt updatedAt trashed
    tags { id name }
  }
}
query

noteCount

計算符合查詢的筆記數量。

bash
query GetNoteCount($query: String!) {
  noteCount(query: $query)
}
query

note

依 ID 取得單一筆記。

bash
query GetNote($id: ID!) {
  note(id: $id) { id title content createdAt updatedAt trashed tags { id name } }
}
mutation

saveNote

建立或更新筆記。傳入空 id 以建立;傳入已有 id 以更新。

bash
mutation SaveNote($id: ID!, $input: NoteInput!) {
  saveNote(id: $id, input: $input) { id title updatedAt }
}
mutation

saveFeedEntriesToNotes

Bulk-save feed entries matching a query as notes (title = feed entry title, content = "# <title>\n\n<body>"). Returns the saved feed entry IDs.

bash
mutation SaveFeedEntriesToNotes($query: String!) {
  saveFeedEntriesToNotes(query: $query)
}
mutation

trashNotes

將符合查詢的筆記移至回收筒。

bash
mutation TrashNotes($query: String!) {
  trashNotes(query: $query)
}
mutation

restoreNotes

還原回收筒中符合查詢的筆記。

bash
mutation RestoreNotes($query: String!) {
  restoreNotes(query: $query)
}
mutation

deleteNotes

永久刪除回收筒中符合查詢的筆記。僅對已在回收筒中的筆記操作。

bash
mutation DeleteNotes($query: String!) {
  deleteNotes(query: $query)
}
mutation

exportNotes

將符合查詢的筆記(含標籤)序列化為 JSON 字串,用於備份/傳輸。

bash
mutation ExportNotes($query: String!) {
  exportNotes(query: $query)
}