tree.graphql 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # ===============================================
  2. # TREE
  3. # ===============================================
  4. extend type Query {
  5. """
  6. Browse the tree.
  7. Must provide either `parentId` or a combination of `parentPath` and `locale`.
  8. """
  9. tree(
  10. siteId: UUID!
  11. parentId: UUID
  12. parentPath: String
  13. locale: String
  14. types: [TreeItemType]
  15. tags: [String]
  16. limit: Int
  17. offset: Int
  18. orderBy: TreeOrderBy
  19. orderByDirection: OrderByDirection
  20. """
  21. How many levels of children to include. Defaults to 1.
  22. """
  23. depth: Int
  24. """
  25. Include all parent folders up to root
  26. """
  27. includeAncestors: Boolean
  28. """
  29. Include all folders at root level
  30. """
  31. includeRootFolders: Boolean
  32. ): [TreeItem]
  33. folderById(
  34. id: UUID!
  35. ): TreeItemFolder
  36. folderByPath(
  37. siteId: UUID!
  38. locale: String!
  39. path: String!
  40. ): TreeItemFolder
  41. }
  42. extend type Mutation {
  43. createFolder(
  44. siteId: UUID!
  45. locale: String!
  46. parentId: UUID
  47. parentPath: String
  48. pathName: String!
  49. title: String!
  50. ): DefaultResponse
  51. deleteFolder(
  52. folderId: UUID!
  53. ): DefaultResponse
  54. duplicateFolder(
  55. folderId: UUID!
  56. targetParentId: UUID
  57. targetPathName: String!
  58. targetTitle: String!
  59. ): DefaultResponse
  60. moveFolder(
  61. folderId: UUID!
  62. targetParentId: UUID
  63. ): DefaultResponse
  64. renameFolder(
  65. folderId: UUID!
  66. pathName: String!
  67. title: String!
  68. ): DefaultResponse
  69. }
  70. # -----------------------------------------------
  71. # TYPES
  72. # -----------------------------------------------
  73. enum TreeItemType {
  74. asset
  75. folder
  76. page
  77. }
  78. enum TreeOrderBy {
  79. createdAt
  80. fileName
  81. title
  82. updatedAt
  83. }
  84. interface TreeItem {
  85. id: UUID
  86. folderPath: String
  87. fileName: String
  88. title: String
  89. }
  90. type TreeItemFolder implements TreeItem {
  91. id: UUID
  92. childrenCount: Int
  93. depth: Int
  94. fileName: String
  95. folderPath: String
  96. title: String
  97. isAncestor: Boolean
  98. }
  99. type TreeItemPage implements TreeItem {
  100. id: UUID
  101. createdAt: Date
  102. depth: Int
  103. fileName: String
  104. folderPath: String
  105. editor: String
  106. pageType: String
  107. title: String
  108. description: String
  109. updatedAt: Date
  110. }
  111. type TreeItemAsset implements TreeItem {
  112. id: UUID
  113. createdAt: Date
  114. depth: Int
  115. fileName: String
  116. # In Bytes
  117. fileSize: Int
  118. fileExt: String
  119. mimeType: String
  120. folderPath: String
  121. title: String
  122. updatedAt: Date
  123. }