queries.go 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. package wikijs
  2. const searchPagesQuery = `query SearchPages($query: String!, $path: String, $locale: String) {
  3. pages {
  4. search(query: $query, path: $path, locale: $locale) {
  5. results {
  6. title
  7. description
  8. path
  9. locale
  10. }
  11. suggestions
  12. totalHits
  13. }
  14. }
  15. }`
  16. const pageByIDQuery = `query GetPageById($id: Int!) {
  17. pages {
  18. single(id: $id) {
  19. id
  20. path
  21. title
  22. description
  23. tags {
  24. tag
  25. title
  26. }
  27. content
  28. createdAt
  29. updatedAt
  30. locale
  31. isPublished
  32. isPrivate
  33. }
  34. }
  35. }`
  36. const pageByPathQuery = `query GetPageByPath($path: String!, $locale: String!) {
  37. pages {
  38. singleByPath(path: $path, locale: $locale) {
  39. id
  40. path
  41. title
  42. description
  43. content
  44. createdAt
  45. updatedAt
  46. locale
  47. isPublished
  48. isPrivate
  49. tags {
  50. tag
  51. title
  52. }
  53. }
  54. }
  55. }`
  56. const listPagesQuery = `query GetAllPages($limit: Int, $locale: String, $tags: [String!]) {
  57. pages {
  58. list(limit: $limit, locale: $locale, tags: $tags) {
  59. id
  60. path
  61. locale
  62. title
  63. description
  64. createdAt
  65. updatedAt
  66. tags
  67. }
  68. }
  69. }`
  70. const listAssetFoldersQuery = `query ListAssetFolders($parentFolderId: Int!) {
  71. assets {
  72. folders(parentFolderId: $parentFolderId) {
  73. id
  74. slug
  75. name
  76. }
  77. }
  78. }`
  79. const listAssetsQuery = `query ListAssets($folderId: Int!, $kind: AssetKind!) {
  80. assets {
  81. list(folderId: $folderId, kind: $kind) {
  82. id
  83. filename
  84. ext
  85. kind
  86. mime
  87. fileSize
  88. createdAt
  89. updatedAt
  90. folder {
  91. id
  92. slug
  93. name
  94. }
  95. }
  96. }
  97. }`
  98. const createAssetFolderMutation = `mutation CreateAssetFolder(
  99. $parentFolderId: Int!
  100. $slug: String!
  101. $name: String!
  102. ) {
  103. assets {
  104. createFolder(
  105. parentFolderId: $parentFolderId
  106. slug: $slug
  107. name: $name
  108. ) {
  109. responseResult {
  110. succeeded
  111. errorCode
  112. slug
  113. message
  114. }
  115. }
  116. }
  117. }`
  118. const createPageMutation = `mutation CreatePage(
  119. $title: String!
  120. $content: String!
  121. $description: String!
  122. $editor: String!
  123. $isPublished: Boolean!
  124. $isPrivate: Boolean!
  125. $locale: String!
  126. $tags: [String]!
  127. $path: String!
  128. ) {
  129. pages {
  130. create(
  131. title: $title
  132. content: $content
  133. description: $description
  134. editor: $editor
  135. isPublished: $isPublished
  136. isPrivate: $isPrivate
  137. locale: $locale
  138. tags: $tags
  139. path: $path
  140. ) {
  141. responseResult {
  142. succeeded
  143. errorCode
  144. slug
  145. message
  146. }
  147. }
  148. }
  149. }`
  150. const updatePageMutation = `mutation UpdatePage(
  151. $id: Int!
  152. $title: String!
  153. $content: String!
  154. $description: String!
  155. $editor: String!
  156. $isPublished: Boolean!
  157. $isPrivate: Boolean!
  158. $locale: String!
  159. $tags: [String]!
  160. $path: String!
  161. ) {
  162. pages {
  163. update(
  164. id: $id
  165. title: $title
  166. content: $content
  167. description: $description
  168. editor: $editor
  169. isPublished: $isPublished
  170. isPrivate: $isPrivate
  171. locale: $locale
  172. tags: $tags
  173. path: $path
  174. ) {
  175. responseResult {
  176. succeeded
  177. errorCode
  178. slug
  179. message
  180. }
  181. }
  182. }
  183. }`