PlainApp
API 参考

收藏

通过 app.capabilities 判断功能支持,通过 app.access 和宿主权限判断访问授权。示例使用合成数据,调用前请替换路径、ID、输入和筛选条件。

类型定义

graphql
type Mutation {
  addFavoriteFolder(rootPath: String!, fullPath: String!): [FavoriteFolder!]!
  removeFavoriteFolder(fullPath: String!): [FavoriteFolder!]!
  setFavoriteFolderAlias(fullPath: String!, alias: String!): [FavoriteFolder!]!
}

type Query {
  favoriteFolders: [FavoriteFolder!]!
}

type FavoriteFolder {
	rootPath: String!
	fullPath: String!
	alias: String
}

操作

mutation

addFavoriteFolder

收藏文件夹以便快速访问,返回更新后的全部收藏文件夹。

graphql
# Register a favorite folder and return the whole list.
mutation addFavoriteFolder($rootPath: String!, $fullPath: String!) {
  addFavoriteFolder(rootPath: $rootPath, fullPath: $fullPath) { rootPath fullPath alias }
}
mutation

removeFavoriteFolder

移除收藏文件夹,返回更新后的剩余文件夹。

graphql
# Remove the favorite folder identified by `fullPath` and return the
# whole list.
mutation removeFavoriteFolder($fullPath: String!) {
  removeFavoriteFolder(fullPath: $fullPath) { rootPath fullPath alias }
}
mutation

setFavoriteFolderAlias

设置或更新收藏夹的显示别名,传空字符串清除别名。返回更新后的收藏列表;收藏不存在时返回错误。

graphql
# Set the favorite folder's display alias and return the whole list; error if the favorite does not exist.
mutation setFavoriteFolderAlias($fullPath: String!, $alias: String!) {
  setFavoriteFolderAlias(fullPath: $fullPath, alias: $alias) { rootPath fullPath alias }
}
query

favoriteFolders

列出已保存的收藏文件夹及其别名。

graphql
# List all favorite folders.
query favoriteFolders {
  favoriteFolders { rootPath fullPath alias }
}