queries.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. }
  32. }
  33. }`
  34. const pageByPathQuery = `query GetPageByPath($path: String!, $locale: String!) {
  35. pages {
  36. singleByPath(path: $path, locale: $locale) {
  37. id
  38. path
  39. title
  40. description
  41. content
  42. createdAt
  43. updatedAt
  44. locale
  45. tags {
  46. tag
  47. title
  48. }
  49. }
  50. }
  51. }`
  52. const listPagesQuery = `query GetAllPages($limit: Int, $locale: String, $tags: [String!]) {
  53. pages {
  54. list(limit: $limit, locale: $locale, tags: $tags) {
  55. id
  56. path
  57. locale
  58. title
  59. description
  60. createdAt
  61. updatedAt
  62. tags
  63. }
  64. }
  65. }`
  66. const createPageMutation = `mutation CreatePage(
  67. $title: String!
  68. $content: String!
  69. $description: String!
  70. $editor: String!
  71. $isPublished: Boolean!
  72. $isPrivate: Boolean!
  73. $locale: String!
  74. $tags: [String]!
  75. $path: String!
  76. ) {
  77. pages {
  78. create(
  79. title: $title
  80. content: $content
  81. description: $description
  82. editor: $editor
  83. isPublished: $isPublished
  84. isPrivate: $isPrivate
  85. locale: $locale
  86. tags: $tags
  87. path: $path
  88. ) {
  89. responseResult {
  90. succeeded
  91. errorCode
  92. slug
  93. message
  94. }
  95. }
  96. }
  97. }`
  98. const updatePageMutation = `mutation UpdatePage(
  99. $id: Int!
  100. $title: String!
  101. $content: String!
  102. $description: String!
  103. $editor: String!
  104. $isPublished: Boolean!
  105. $isPrivate: Boolean!
  106. $locale: String!
  107. $tags: [String]!
  108. $path: String!
  109. ) {
  110. pages {
  111. update(
  112. id: $id
  113. title: $title
  114. content: $content
  115. description: $description
  116. editor: $editor
  117. isPublished: $isPublished
  118. isPrivate: $isPrivate
  119. locale: $locale
  120. tags: $tags
  121. path: $path
  122. ) {
  123. responseResult {
  124. succeeded
  125. errorCode
  126. slug
  127. message
  128. }
  129. }
  130. }
  131. }`