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 }
}