API 參考
Tags
標籤依 DataType(images、audio、video、files、contacts、SMS、calls、notes)劃分作用域。在此管理標籤和項目指派。
型別定義
bash
type Tag {
id: ID!
name: String!
count: Int! # total items carrying this tag
}
type TagRelation {
tagId: ID!
key: String! # id of the tagged item
}
# DataType scopes which content type a tag belongs to
enum DataType {
AUDIO VIDEO IMAGE SMS CONTACT NOTE FEED_ENTRY CALL DOC PACKAGE FILE
}
# Identifies a single item by its ID key, used in updateTagRelations
input TagRelationStub {
key: String!
}操作
query
tags
列出指定資料類型的所有標籤。
bash
query GetTags($type: DataType!) {
tags(type: $type) { id name count }
}query
tagRelations
查找一個資料類型內一組項目鍵(例如媒體 ID、筆記 ID)的標籤指派。
bash
query GetTagRelations($type: DataType!, $keys: [String!]!) {
tagRelations(type: $type, keys: $keys) {
tagId
key
}
}mutation
createTag
建立限定於某個資料類型的新標籤。
bash
mutation CreateTag($type: DataType!, $name: String!) {
createTag(type: $type, name: $name) { id name count }
}mutation
updateTag
重新命名現有標籤。
bash
mutation UpdateTag($id: ID!, $name: String!) {
updateTag(id: $id, name: $name) { id name }
}mutation
deleteTag
刪除標籤並從所有已標記項目中移除。
bash
mutation DeleteTag($id: ID!) {
deleteTag(id: $id)
}mutation
addToTags
將符合查詢的所有項目加入一個或多個標籤。
bash
mutation AddToTags($type: DataType!, $tagIds: [ID!]!, $query: String!) {
addToTags(type: $type, tagIds: $tagIds, query: $query)
}mutation
updateTagRelations
在一次呼叫中為單一項目新增和/或移除標籤。
bash
mutation UpdateTagRelations($type: DataType!, $item: TagRelationStub!, $addTagIds: [ID!]!, $removeTagIds: [ID!]!) {
updateTagRelations(type: $type, item: $item, addTagIds: $addTagIds, removeTagIds: $removeTagIds)
}mutation
removeFromTags
從一個或多個標籤中移除符合查詢的所有項目。
bash
mutation RemoveFromTags($type: DataType!, $tagIds: [ID!]!, $query: String!) {
removeFromTags(type: $type, tagIds: $tagIds, query: $query)
}