sidechat.js 2.5.5 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/dist/classes/SidechatAPIClient.d.ts +40 -3
  2. package/dist/classes/SidechatAPIClient.d.ts.map +1 -1
  3. package/dist/index.cjs +151 -12
  4. package/dist/index.mjs +151 -12
  5. package/dist/types/SidechatTypes.d.ts +69 -3
  6. package/dist/types/SidechatTypes.d.ts.map +1 -1
  7. package/docs/sidechat.js/2.5.6/SidechatAPIClient.html +3 -0
  8. package/docs/sidechat.js/2.5.6/SidechatAPIError.html +3 -0
  9. package/docs/sidechat.js/2.5.6/SidechatColorList.html +3 -0
  10. package/docs/sidechat.js/{2.4.6 → 2.5.6}/classes_SidechatAPIClient.js.html +181 -11
  11. package/docs/sidechat.js/2.5.6/classes_SidechatAPIError.js.html +16 -0
  12. package/docs/sidechat.js/2.5.6/classes_SidechatColorList.js.html +79 -0
  13. package/docs/sidechat.js/2.5.6/data/search.json +1 -0
  14. package/docs/sidechat.js/2.5.6/global.html +3 -0
  15. package/docs/sidechat.js/2.5.6/index.html +4 -0
  16. package/docs/sidechat.js/2.5.6/tutorial-Authentication.html +14 -0
  17. package/docs/sidechat.js/2.5.6/tutorial-Email Registration.html +6 -0
  18. package/docs/sidechat.js/{2.4.6 → 2.5.6}/types_SidechatTypes.js.html +23 -3
  19. package/docs/sidechat.js/2.6.0/SidechatAPIClient.html +3 -0
  20. package/docs/sidechat.js/2.6.0/SidechatAPIError.html +3 -0
  21. package/docs/sidechat.js/2.6.0/SidechatColorList.html +3 -0
  22. package/docs/sidechat.js/{2.4.7 → 2.6.0}/classes_SidechatAPIClient.js.html +268 -11
  23. package/docs/sidechat.js/2.6.0/classes_SidechatAPIError.js.html +16 -0
  24. package/docs/sidechat.js/2.6.0/classes_SidechatColorList.js.html +79 -0
  25. package/docs/sidechat.js/2.6.0/data/search.json +1 -0
  26. package/docs/sidechat.js/2.6.0/global.html +3 -0
  27. package/docs/sidechat.js/2.6.0/index.html +4 -0
  28. package/docs/sidechat.js/{2.4.6 → 2.6.0}/scripts/core.js +1 -1
  29. package/docs/sidechat.js/{2.4.6 → 2.6.0}/scripts/core.min.js +1 -1
  30. package/docs/sidechat.js/{2.4.6 → 2.6.0}/styles/clean-jsdoc-theme-base.css +3 -5
  31. package/docs/sidechat.js/2.6.0/styles/clean-jsdoc-theme-without-scrollbar.min.css +1 -0
  32. package/docs/sidechat.js/2.6.0/styles/clean-jsdoc-theme.min.css +1 -0
  33. package/docs/sidechat.js/2.6.0/tutorial-Authentication.html +14 -0
  34. package/docs/sidechat.js/2.6.0/tutorial-Email Registration.html +6 -0
  35. package/docs/sidechat.js/{2.4.7 → 2.6.0}/types_SidechatTypes.js.html +51 -7
  36. package/jsdoc.json +10 -0
  37. package/package.json +2 -2
  38. package/src/classes/SidechatAPIClient.js +120 -6
  39. package/src/types/SidechatTypes.js +31 -6
  40. package/docs/sidechat.js/1.0.0/data/search.json +0 -1
  41. package/docs/sidechat.js/1.0.0/global.html +0 -3
  42. package/docs/sidechat.js/1.0.0/index.html +0 -4
  43. package/docs/sidechat.js/1.0.0/index.js.html +0 -363
  44. package/docs/sidechat.js/1.0.0/scripts/core.js +0 -702
  45. package/docs/sidechat.js/1.0.0/scripts/core.min.js +0 -23
  46. package/docs/sidechat.js/1.0.0/styles/clean-jsdoc-theme-base.css +0 -975
  47. package/docs/sidechat.js/1.0.0/styles/clean-jsdoc-theme-dark.css +0 -407
  48. package/docs/sidechat.js/1.0.0/styles/clean-jsdoc-theme-light.css +0 -388
  49. package/docs/sidechat.js/1.0.0/styles/clean-jsdoc-theme.min.css +0 -1
  50. package/docs/sidechat.js/1.0.0/types_SidechatTypes.js.html +0 -82
  51. package/docs/sidechat.js/2.0.0-alpha.0/SidechatAPIClient.html +0 -3
  52. package/docs/sidechat.js/2.0.0-alpha.0/SidechatAPIError.html +0 -3
  53. package/docs/sidechat.js/2.0.0-alpha.0/classes_SidechatAPIClient.js.html +0 -418
  54. package/docs/sidechat.js/2.0.0-alpha.0/classes_SidechatAPIError.js.html +0 -16
  55. package/docs/sidechat.js/2.0.0-alpha.0/data/search.json +0 -1
  56. package/docs/sidechat.js/2.0.0-alpha.0/global.html +0 -3
  57. package/docs/sidechat.js/2.0.0-alpha.0/index.html +0 -4
  58. package/docs/sidechat.js/2.0.0-alpha.0/scripts/core.js +0 -702
  59. package/docs/sidechat.js/2.0.0-alpha.0/scripts/core.min.js +0 -23
  60. package/docs/sidechat.js/2.0.0-alpha.0/styles/clean-jsdoc-theme-base.css +0 -975
  61. package/docs/sidechat.js/2.0.0-alpha.0/styles/clean-jsdoc-theme-dark.css +0 -407
  62. package/docs/sidechat.js/2.0.0-alpha.0/styles/clean-jsdoc-theme-light.css +0 -388
  63. package/docs/sidechat.js/2.0.0-alpha.0/styles/clean-jsdoc-theme.min.css +0 -1
  64. package/docs/sidechat.js/2.0.0-alpha.0/tutorial-Authentication.html +0 -13
  65. package/docs/sidechat.js/2.0.0-alpha.0/tutorial-Email Registration.html +0 -6
  66. package/docs/sidechat.js/2.0.0-alpha.0/tutorial-Email Verification.html +0 -6
  67. package/docs/sidechat.js/2.0.0-alpha.0/types_SidechatTypes.js.html +0 -98
  68. package/docs/sidechat.js/2.4.0/SidechatAPIClient.html +0 -3
  69. package/docs/sidechat.js/2.4.0/SidechatAPIError.html +0 -3
  70. package/docs/sidechat.js/2.4.0/SidechatColorList.html +0 -3
  71. package/docs/sidechat.js/2.4.0/classes_SidechatAPIClient.js.html +0 -956
  72. package/docs/sidechat.js/2.4.0/classes_SidechatAPIError.js.html +0 -16
  73. package/docs/sidechat.js/2.4.0/classes_SidechatColorList.js.html +0 -79
  74. package/docs/sidechat.js/2.4.0/data/search.json +0 -1
  75. package/docs/sidechat.js/2.4.0/fonts/Inconsolata-Regular.ttf +0 -0
  76. package/docs/sidechat.js/2.4.0/fonts/OpenSans-Regular.ttf +0 -0
  77. package/docs/sidechat.js/2.4.0/fonts/WorkSans-Bold.ttf +0 -0
  78. package/docs/sidechat.js/2.4.0/global.html +0 -3
  79. package/docs/sidechat.js/2.4.0/index.html +0 -4
  80. package/docs/sidechat.js/2.4.0/scripts/core.js +0 -702
  81. package/docs/sidechat.js/2.4.0/scripts/core.min.js +0 -23
  82. package/docs/sidechat.js/2.4.0/scripts/resize.js +0 -90
  83. package/docs/sidechat.js/2.4.0/scripts/search.js +0 -265
  84. package/docs/sidechat.js/2.4.0/scripts/search.min.js +0 -6
  85. package/docs/sidechat.js/2.4.0/scripts/third-party/Apache-License-2.0.txt +0 -202
  86. package/docs/sidechat.js/2.4.0/scripts/third-party/fuse.js +0 -9
  87. package/docs/sidechat.js/2.4.0/scripts/third-party/hljs-line-num-original.js +0 -369
  88. package/docs/sidechat.js/2.4.0/scripts/third-party/hljs-line-num.js +0 -1
  89. package/docs/sidechat.js/2.4.0/scripts/third-party/hljs-original.js +0 -5171
  90. package/docs/sidechat.js/2.4.0/scripts/third-party/hljs.js +0 -1
  91. package/docs/sidechat.js/2.4.0/scripts/third-party/popper.js +0 -5
  92. package/docs/sidechat.js/2.4.0/scripts/third-party/tippy.js +0 -1
  93. package/docs/sidechat.js/2.4.0/scripts/third-party/tocbot.js +0 -672
  94. package/docs/sidechat.js/2.4.0/scripts/third-party/tocbot.min.js +0 -1
  95. package/docs/sidechat.js/2.4.0/styles/clean-jsdoc-theme-base.css +0 -975
  96. package/docs/sidechat.js/2.4.0/styles/clean-jsdoc-theme-dark.css +0 -407
  97. package/docs/sidechat.js/2.4.0/styles/clean-jsdoc-theme-light.css +0 -388
  98. package/docs/sidechat.js/2.4.0/styles/clean-jsdoc-theme.min.css +0 -1
  99. package/docs/sidechat.js/2.4.0/tutorial-Authentication.html +0 -14
  100. package/docs/sidechat.js/2.4.0/tutorial-Email Registration.html +0 -6
  101. package/docs/sidechat.js/2.4.0/types_SidechatTypes.js.html +0 -134
  102. package/docs/sidechat.js/2.4.4/SidechatAPIClient.html +0 -3
  103. package/docs/sidechat.js/2.4.4/SidechatAPIError.html +0 -3
  104. package/docs/sidechat.js/2.4.4/SidechatColorList.html +0 -3
  105. package/docs/sidechat.js/2.4.4/classes_SidechatAPIClient.js.html +0 -1100
  106. package/docs/sidechat.js/2.4.4/classes_SidechatAPIError.js.html +0 -16
  107. package/docs/sidechat.js/2.4.4/classes_SidechatColorList.js.html +0 -79
  108. package/docs/sidechat.js/2.4.4/data/search.json +0 -1
  109. package/docs/sidechat.js/2.4.4/fonts/Inconsolata-Regular.ttf +0 -0
  110. package/docs/sidechat.js/2.4.4/fonts/OpenSans-Regular.ttf +0 -0
  111. package/docs/sidechat.js/2.4.4/fonts/WorkSans-Bold.ttf +0 -0
  112. package/docs/sidechat.js/2.4.4/global.html +0 -3
  113. package/docs/sidechat.js/2.4.4/index.html +0 -4
  114. package/docs/sidechat.js/2.4.4/scripts/core.js +0 -726
  115. package/docs/sidechat.js/2.4.4/scripts/core.min.js +0 -23
  116. package/docs/sidechat.js/2.4.4/scripts/resize.js +0 -90
  117. package/docs/sidechat.js/2.4.4/scripts/search.js +0 -265
  118. package/docs/sidechat.js/2.4.4/scripts/search.min.js +0 -6
  119. package/docs/sidechat.js/2.4.4/scripts/third-party/Apache-License-2.0.txt +0 -202
  120. package/docs/sidechat.js/2.4.4/scripts/third-party/fuse.js +0 -9
  121. package/docs/sidechat.js/2.4.4/scripts/third-party/hljs-line-num-original.js +0 -369
  122. package/docs/sidechat.js/2.4.4/scripts/third-party/hljs-line-num.js +0 -1
  123. package/docs/sidechat.js/2.4.4/scripts/third-party/hljs-original.js +0 -5171
  124. package/docs/sidechat.js/2.4.4/scripts/third-party/hljs.js +0 -1
  125. package/docs/sidechat.js/2.4.4/scripts/third-party/popper.js +0 -5
  126. package/docs/sidechat.js/2.4.4/scripts/third-party/tippy.js +0 -1
  127. package/docs/sidechat.js/2.4.4/scripts/third-party/tocbot.js +0 -672
  128. package/docs/sidechat.js/2.4.4/scripts/third-party/tocbot.min.js +0 -1
  129. package/docs/sidechat.js/2.4.4/styles/clean-jsdoc-theme-base.css +0 -1161
  130. package/docs/sidechat.js/2.4.4/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -1
  131. package/docs/sidechat.js/2.4.4/styles/clean-jsdoc-theme.min.css +0 -1
  132. package/docs/sidechat.js/2.4.4/tutorial-Authentication.html +0 -14
  133. package/docs/sidechat.js/2.4.4/tutorial-Email Registration.html +0 -6
  134. package/docs/sidechat.js/2.4.4/types_SidechatTypes.js.html +0 -160
  135. package/docs/sidechat.js/2.4.6/SidechatAPIClient.html +0 -3
  136. package/docs/sidechat.js/2.4.6/SidechatAPIError.html +0 -3
  137. package/docs/sidechat.js/2.4.6/SidechatColorList.html +0 -3
  138. package/docs/sidechat.js/2.4.6/classes_SidechatAPIError.js.html +0 -16
  139. package/docs/sidechat.js/2.4.6/classes_SidechatColorList.js.html +0 -79
  140. package/docs/sidechat.js/2.4.6/data/search.json +0 -1
  141. package/docs/sidechat.js/2.4.6/fonts/Inconsolata-Regular.ttf +0 -0
  142. package/docs/sidechat.js/2.4.6/fonts/OpenSans-Regular.ttf +0 -0
  143. package/docs/sidechat.js/2.4.6/fonts/WorkSans-Bold.ttf +0 -0
  144. package/docs/sidechat.js/2.4.6/global.html +0 -3
  145. package/docs/sidechat.js/2.4.6/index.html +0 -4
  146. package/docs/sidechat.js/2.4.6/scripts/resize.js +0 -90
  147. package/docs/sidechat.js/2.4.6/scripts/search.js +0 -265
  148. package/docs/sidechat.js/2.4.6/scripts/search.min.js +0 -6
  149. package/docs/sidechat.js/2.4.6/scripts/third-party/Apache-License-2.0.txt +0 -202
  150. package/docs/sidechat.js/2.4.6/scripts/third-party/fuse.js +0 -9
  151. package/docs/sidechat.js/2.4.6/scripts/third-party/hljs-line-num-original.js +0 -369
  152. package/docs/sidechat.js/2.4.6/scripts/third-party/hljs-line-num.js +0 -1
  153. package/docs/sidechat.js/2.4.6/scripts/third-party/hljs-original.js +0 -5171
  154. package/docs/sidechat.js/2.4.6/scripts/third-party/hljs.js +0 -1
  155. package/docs/sidechat.js/2.4.6/scripts/third-party/popper.js +0 -5
  156. package/docs/sidechat.js/2.4.6/scripts/third-party/tippy.js +0 -1
  157. package/docs/sidechat.js/2.4.6/scripts/third-party/tocbot.js +0 -672
  158. package/docs/sidechat.js/2.4.6/scripts/third-party/tocbot.min.js +0 -1
  159. package/docs/sidechat.js/2.4.6/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -1
  160. package/docs/sidechat.js/2.4.6/styles/clean-jsdoc-theme.min.css +0 -1
  161. package/docs/sidechat.js/2.4.6/tutorial-Authentication.html +0 -14
  162. package/docs/sidechat.js/2.4.6/tutorial-Email Registration.html +0 -6
  163. package/docs/sidechat.js/2.4.7/SidechatAPIClient.html +0 -3
  164. package/docs/sidechat.js/2.4.7/SidechatAPIError.html +0 -3
  165. package/docs/sidechat.js/2.4.7/SidechatColorList.html +0 -3
  166. package/docs/sidechat.js/2.4.7/classes_SidechatAPIError.js.html +0 -16
  167. package/docs/sidechat.js/2.4.7/classes_SidechatColorList.js.html +0 -79
  168. package/docs/sidechat.js/2.4.7/data/search.json +0 -1
  169. package/docs/sidechat.js/2.4.7/fonts/Inconsolata-Regular.ttf +0 -0
  170. package/docs/sidechat.js/2.4.7/fonts/OpenSans-Regular.ttf +0 -0
  171. package/docs/sidechat.js/2.4.7/fonts/WorkSans-Bold.ttf +0 -0
  172. package/docs/sidechat.js/2.4.7/global.html +0 -3
  173. package/docs/sidechat.js/2.4.7/index.html +0 -4
  174. package/docs/sidechat.js/2.4.7/scripts/resize.js +0 -90
  175. package/docs/sidechat.js/2.4.7/scripts/search.js +0 -265
  176. package/docs/sidechat.js/2.4.7/scripts/search.min.js +0 -6
  177. package/docs/sidechat.js/2.4.7/scripts/third-party/Apache-License-2.0.txt +0 -202
  178. package/docs/sidechat.js/2.4.7/scripts/third-party/fuse.js +0 -9
  179. package/docs/sidechat.js/2.4.7/scripts/third-party/hljs-line-num-original.js +0 -369
  180. package/docs/sidechat.js/2.4.7/scripts/third-party/hljs-line-num.js +0 -1
  181. package/docs/sidechat.js/2.4.7/scripts/third-party/hljs-original.js +0 -5171
  182. package/docs/sidechat.js/2.4.7/scripts/third-party/hljs.js +0 -1
  183. package/docs/sidechat.js/2.4.7/scripts/third-party/popper.js +0 -5
  184. package/docs/sidechat.js/2.4.7/scripts/third-party/tippy.js +0 -1
  185. package/docs/sidechat.js/2.4.7/scripts/third-party/tocbot.js +0 -672
  186. package/docs/sidechat.js/2.4.7/scripts/third-party/tocbot.min.js +0 -1
  187. package/docs/sidechat.js/2.4.7/styles/clean-jsdoc-theme-dark.css +0 -412
  188. package/docs/sidechat.js/2.4.7/styles/clean-jsdoc-theme-light.css +0 -482
  189. package/docs/sidechat.js/2.4.7/styles/clean-jsdoc-theme-scrollbar.css +0 -30
  190. package/docs/sidechat.js/2.4.7/tutorial-Authentication.html +0 -14
  191. package/docs/sidechat.js/2.4.7/tutorial-Email Registration.html +0 -6
  192. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/fonts/Inconsolata-Regular.ttf +0 -0
  193. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/fonts/OpenSans-Regular.ttf +0 -0
  194. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/fonts/WorkSans-Bold.ttf +0 -0
  195. /package/docs/sidechat.js/{2.4.7 → 2.5.6}/scripts/core.js +0 -0
  196. /package/docs/sidechat.js/{2.4.7 → 2.5.6}/scripts/core.min.js +0 -0
  197. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/scripts/resize.js +0 -0
  198. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/scripts/search.js +0 -0
  199. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/scripts/search.min.js +0 -0
  200. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/scripts/third-party/Apache-License-2.0.txt +0 -0
  201. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/scripts/third-party/fuse.js +0 -0
  202. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/scripts/third-party/hljs-line-num-original.js +0 -0
  203. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/scripts/third-party/hljs-line-num.js +0 -0
  204. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/scripts/third-party/hljs-original.js +0 -0
  205. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/scripts/third-party/hljs.js +0 -0
  206. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/scripts/third-party/popper.js +0 -0
  207. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/scripts/third-party/tippy.js +0 -0
  208. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/scripts/third-party/tocbot.js +0 -0
  209. /package/docs/sidechat.js/{1.0.0 → 2.5.6}/scripts/third-party/tocbot.min.js +0 -0
  210. /package/docs/sidechat.js/{2.4.7 → 2.5.6}/styles/clean-jsdoc-theme-base.css +0 -0
  211. /package/docs/sidechat.js/{2.4.4 → 2.5.6}/styles/clean-jsdoc-theme-dark.css +0 -0
  212. /package/docs/sidechat.js/{2.4.4 → 2.5.6}/styles/clean-jsdoc-theme-light.css +0 -0
  213. /package/docs/sidechat.js/{2.4.4 → 2.5.6}/styles/clean-jsdoc-theme-scrollbar.css +0 -0
  214. /package/docs/sidechat.js/{2.4.7 → 2.5.6}/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -0
  215. /package/docs/sidechat.js/{2.4.7 → 2.5.6}/styles/clean-jsdoc-theme.min.css +0 -0
  216. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/fonts/Inconsolata-Regular.ttf +0 -0
  217. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/fonts/OpenSans-Regular.ttf +0 -0
  218. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/fonts/WorkSans-Bold.ttf +0 -0
  219. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/scripts/resize.js +0 -0
  220. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/scripts/search.js +0 -0
  221. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/scripts/search.min.js +0 -0
  222. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/scripts/third-party/Apache-License-2.0.txt +0 -0
  223. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/scripts/third-party/fuse.js +0 -0
  224. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/scripts/third-party/hljs-line-num-original.js +0 -0
  225. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/scripts/third-party/hljs-line-num.js +0 -0
  226. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/scripts/third-party/hljs-original.js +0 -0
  227. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/scripts/third-party/hljs.js +0 -0
  228. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/scripts/third-party/popper.js +0 -0
  229. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/scripts/third-party/tippy.js +0 -0
  230. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/scripts/third-party/tocbot.js +0 -0
  231. /package/docs/sidechat.js/{2.0.0-alpha.0 → 2.6.0}/scripts/third-party/tocbot.min.js +0 -0
  232. /package/docs/sidechat.js/{2.4.6 → 2.6.0}/styles/clean-jsdoc-theme-dark.css +0 -0
  233. /package/docs/sidechat.js/{2.4.6 → 2.6.0}/styles/clean-jsdoc-theme-light.css +0 -0
  234. /package/docs/sidechat.js/{2.4.6 → 2.6.0}/styles/clean-jsdoc-theme-scrollbar.css +0 -0
@@ -163,6 +163,14 @@ declare class SidechatAPIClient {
163
163
  * @returns {SidechatGroup[]}
164
164
  */
165
165
  getAvailableGroups: (onePage?: boolean) => SidechatGroup[];
166
+ /**
167
+ * Searches for new groups based on a query keyword
168
+ * @method
169
+ * @since 2.6.0
170
+ * @param {String} query - the string to search for. This will be encoded, so strings with spaces and special characters are okay.
171
+ * @returns {SidechatGroup[]}
172
+ */
173
+ searchAvailableGroups: (query: string) => SidechatGroup[];
166
174
  /**
167
175
  * Retrieves the entire accessible asset library. Be warned that as of the time of this documentation, it's a 1.5MB JSON download and this request is very expensive.
168
176
  * @method
@@ -254,7 +262,7 @@ declare class SidechatAPIClient {
254
262
  */
255
263
  uploadAsset: (uri: string, mimeType: string, name?: string) => string;
256
264
  /**
257
- * Sets the conversation icon of the current user
265
+ * Sets the conversation icon of a user
258
266
  * @method
259
267
  * @since 2.2.1
260
268
  * @param {String} userID - alphanumeric ID of user
@@ -263,6 +271,14 @@ declare class SidechatAPIClient {
263
271
  * @param {String} secondaryColor - hex string (including #) of secondary color
264
272
  */
265
273
  setUserIcon: (userID: string, emoji: string, primaryColor: string, secondaryColor: string) => Promise<any>;
274
+ /**
275
+ * Sets the bio text of a user
276
+ * @method
277
+ * @since 2.5.6
278
+ * @param {String} userID - alphanumeric ID of user
279
+ * @param {String} bio - text to set as bio
280
+ */
281
+ setUserBio: (userID: string, bio: string) => Promise<any>;
266
282
  /**
267
283
  * Checks if user can set their username to a string
268
284
  * @method
@@ -279,6 +295,22 @@ declare class SidechatAPIClient {
279
295
  * @param {String} username - new username to set
280
296
  */
281
297
  setUsername: (userID: string, username: string) => Promise<any>;
298
+ /**
299
+ * Fetches a public user profile
300
+ * @method
301
+ * @since 2.6.0
302
+ * @param {String} username - username of the user to fetch
303
+ * @returns {SidechatProfile}
304
+ */
305
+ getUserProfile: (username: string) => SidechatProfile;
306
+ /**
307
+ * Fetches a public user's posts
308
+ * @method
309
+ * @since 2.6.0
310
+ * @param {String} username - username of the user to fetch
311
+ * @returns {SidechatPostOrComment[]}
312
+ */
313
+ getUserPosts: (username: string) => SidechatPostOrComment[];
282
314
  /**
283
315
  * Marks an activity item as read
284
316
  * @method
@@ -293,11 +325,16 @@ declare class SidechatAPIClient {
293
325
  */
294
326
  getGroupChats: () => Promise<any>;
295
327
  /**
296
- * Joins a group chat
328
+ * Joins a group chat. To mimic the official client, use the user's display name and icon by default.
297
329
  * @method
330
+ * @param {String} groupChatID - alphanumeric ID of group chat to join
331
+ * @param {String} displayName - display name to use in chat
332
+ * @param {String} emoji - emoji to use as icon
333
+ * @param {String} primaryColor - hex string of primary color
334
+ * @param {String} secondaryColor - hex string of secondary color
298
335
  * @since 2.3.5
299
336
  */
300
- joinGroupChat: (groupChatID: any, displayName: any, emoji: any, primaryColor: any, secondaryColor: any) => Promise<any>;
337
+ joinGroupChat: (groupChatID: string, displayName: string, emoji: string, primaryColor: string, secondaryColor: string) => Promise<any>;
301
338
  /**
302
339
  * Gets a list of the user's direct messages
303
340
  * @method
@@ -1 +1 @@
1
- {"version":3,"file":"SidechatAPIClient.d.ts","sourceRoot":"","sources":["../../src/classes/SidechatAPIClient.js"],"names":[],"mappings":";AAGA;;;;GAIG;AACH;IA2BE;;;;OAIG;IACH,oBAHW,iBAAiB,oBAU3B;IAtCD;;;SAGK;IACL,WAFU,iBAAiB,CAEjB;IAEV;;;;;OAKG;IACH,oBAKE;IAEF;;;;OAIG;IACH,gBAAqC;IAgBrC;;;;OAIG;IACH,kBAFW,iBAAiB,UAI1B;IAEF;;;;;OAKG;IACH,kCAEE;IAEF;;;;;;;;;OASG;IACH,yCANW,KAAK,GAAC,MAAM,GAAC,KAAK,GAAC,QAAQ,GAAC,OAAO,GAAC,SAAS,0EAuBtD;IAEF;;;;;OAKG;IACH,mDAgBE;IAEF;;;;;;OAMG;IACH,mEAmBE;IAEF;;;;;;OAMG;IACH,8DAsBE;IAEF;;;;;;OAMG;IACH,+CAwBE;IAEF;;;;OAIG;IACH,2CAsBE;IAEF;;;;;OAKG;IACH,6CAuBE;IAEF;;;;;;OAMG;IACH,oDAGE;IAEF;;;;;OAKG;IACH,+CAqBE;IAEF;;;;;;;;OAQG;IACH,4CAJW,KAAK,GAAC,QAAQ,GAAC,KAAK,WACpB,oBAAoB,KAClB,sBAAsB,CAwBjC;IAEF;;;;;;OAMG;IACH,kCAFW,kBAAkB,kBAwB3B;IAEF;;;;;;;OAOG;IACH,uDAFa,qBAAqB,CAuBhC;IAEF;;;;;;OAMG;IACH,8BAHW,OAAO,GAAC,UAAU,KAChB,qBAAqB,EAAE,CAyBlC;IAEF;;;;;;OAMG;IACH,qCAFa,qBAAqB,EAAE,CAqElC;IAEF;;;;;;OAMG;IACH,2CAFa,aAAa,EAAE,CAqB1B;IAEF;;;;;OAKG;IACH,uBAFa,oBAAoB,EAAE,CAoBjC;IAEF;;;;;OAKG;IACH,sBAFa,mBAAmB,CAoB9B;IAEF;;;;;;OAMG;IACH,wCAFa,aAAa,CAoBxB;IAEF;;;;;;OAMG;IACH,yEAwBE;IAEF;;;;;;;;;;;;;OAaG;IACH,oIALW,mBAAmB,EAAE,gDAGnB,qBAAqB,CAwChC;IAEF;;;;;;;;;;;OAWG;IACH,wDANW,mBAAmB,EAAE,2EAInB,qBAAqB,CAqChC;IAEF;;;;;OAKG;IACH,+DAqBE;IAEF;;;;;;OAMG;IACH,kEAsBE;IAEF;;;;;OAKG;IACH,kDAqBE;IAEF;;;;;;;;OAQG;IACH,sEAyCE;IAEF;;;;;;;;OAQG;IACH,2GA2BE;IAEF;;;;;;OAMG;IACH,6CAwBE;IAEF;;;;;;OAMG;IACH,gEAqBE;IAEF;;;;;OAKG;IACH,mDAqBE;IAEF;;;;OAIG;IACH,kCAkBE;IAEF;;;;OAIG;IACH,wHAiCE;IAEF;;;;;OAKG;IACH,cAHa,oBAAoB,EAAE,CA0BjC;IAEF;;;;;;OAMG;IACH,6BAHa,oBAAoB,CAwB/B;IAEF;;;;;;;;;OASG;IACH,kEAJW,aAAa,EAAE,uCA6BxB;IAEF;;;;;;;;;OASG;IACH,6FAHW,MAAM,kBAkCf;CACH"}
1
+ {"version":3,"file":"SidechatAPIClient.d.ts","sourceRoot":"","sources":["../../src/classes/SidechatAPIClient.js"],"names":[],"mappings":";AAGA;;;;GAIG;AACH;IA2BE;;;;OAIG;IACH,oBAHW,iBAAiB,oBAU3B;IAtCD;;;SAGK;IACL,WAFU,iBAAiB,CAEjB;IAEV;;;;;OAKG;IACH,oBAKE;IAEF;;;;OAIG;IACH,gBAAqC;IAgBrC;;;;OAIG;IACH,kBAFW,iBAAiB,UAI1B;IAEF;;;;;OAKG;IACH,kCAEE;IAEF;;;;;;;;;OASG;IACH,yCANW,KAAK,GAAC,MAAM,GAAC,KAAK,GAAC,QAAQ,GAAC,OAAO,GAAC,SAAS,0EAuBtD;IAEF;;;;;OAKG;IACH,mDAgBE;IAEF;;;;;;OAMG;IACH,mEAmBE;IAEF;;;;;;OAMG;IACH,8DAsBE;IAEF;;;;;;OAMG;IACH,+CAwBE;IAEF;;;;OAIG;IACH,2CAsBE;IAEF;;;;;OAKG;IACH,6CAuBE;IAEF;;;;;;OAMG;IACH,oDAGE;IAEF;;;;;OAKG;IACH,+CAqBE;IAEF;;;;;;;;OAQG;IACH,4CAJW,KAAK,GAAC,QAAQ,GAAC,KAAK,WACpB,oBAAoB,KAClB,sBAAsB,CAwBjC;IAEF;;;;;;OAMG;IACH,kCAFW,kBAAkB,kBAwB3B;IAEF;;;;;;;OAOG;IACH,uDAFa,qBAAqB,CAuBhC;IAEF;;;;;;OAMG;IACH,8BAHW,OAAO,GAAC,UAAU,KAChB,qBAAqB,EAAE,CAyBlC;IAEF;;;;;;OAMG;IACH,qCAFa,qBAAqB,EAAE,CAqElC;IAEF;;;;;;OAMG;IACH,2CAFa,aAAa,EAAE,CAqB1B;IAEF;;;;;;OAMG;IACH,0CAFa,aAAa,EAAE,CAoB1B;IAEF;;;;;OAKG;IACH,uBAFa,oBAAoB,EAAE,CAoBjC;IAEF;;;;;OAKG;IACH,sBAFa,mBAAmB,CAoB9B;IAEF;;;;;;OAMG;IACH,wCAFa,aAAa,CAoBxB;IAEF;;;;;;OAMG;IACH,yEAwBE;IAEF;;;;;;;;;;;;;OAaG;IACH,oIALW,mBAAmB,EAAE,gDAGnB,qBAAqB,CAwChC;IAEF;;;;;;;;;;;OAWG;IACH,wDANW,mBAAmB,EAAE,2EAInB,qBAAqB,CAqChC;IAEF;;;;;OAKG;IACH,+DAqBE;IAEF;;;;;;OAMG;IACH,kEAsBE;IAEF;;;;;OAKG;IACH,kDAqBE;IAEF;;;;;;;;OAQG;IACH,sEAsCE;IAEF;;;;;;;;OAQG;IACH,2GA2BE;IAEF;;;;;;OAMG;IACH,0DAsBE;IAEF;;;;;;OAMG;IACH,6CAwBE;IAEF;;;;;;OAMG;IACH,gEAqBE;IAEF;;;;;;OAMG;IACH,sCAFa,eAAe,CAoB1B;IAEF;;;;;;OAMG;IACH,oCAFa,qBAAqB,EAAE,CAoBlC;IAEF;;;;;OAKG;IACH,mDAqBE;IAEF;;;;OAIG;IACH,kCAkBE;IAEF;;;;;;;;;OASG;IACH,uIAiCE;IAEF;;;;;OAKG;IACH,cAHa,oBAAoB,EAAE,CA0BjC;IAEF;;;;;;OAMG;IACH,6BAHa,oBAAoB,CAwB/B;IAEF;;;;;;;;;OASG;IACH,kEAJW,aAAa,EAAE,uCA6BxB;IAEF;;;;;;;;;OASG;IACH,6FAHW,MAAM,kBAkCf;CACH"}
package/dist/index.cjs CHANGED
@@ -7,7 +7,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
7
7
  * @typedef {Object} SidechatPostOrComment
8
8
  * @prop {"post"|"comment"} type - whether this object represents a post or a comment on a post
9
9
  * @prop {String} id - alphanumeric ID of post or comment
10
- * @prop {Boolean} authored_by_user - undocumented
10
+ * @prop {Boolean} authored_by_user - whether or not the post or comment was created by the current user
11
11
  * @prop {String} alias - post creator's name in-app
12
12
  * @prop {String} group_id - alphanumeric ID of group
13
13
  * @prop {SidechatGroup} group - group in which post or comment was created
@@ -21,8 +21,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
21
21
  * @prop {String[]} tags - undocumented
22
22
  * @prop {SidechatIdentity} identity - creator's identity information
23
23
  * @prop {Boolean} pinned - undocumented
24
- * @prop {Boolean} is_saved - undocumented
25
- * @prop {"following"|"not_following"} follow_status - undocumented
24
+ * @prop {Boolean} is_saved - whether or not the current user has saved the post
25
+ * @prop {"following"|"not_following"} follow_status - whether or not the current user should recieve activity notifications for the post
26
26
  * @prop {"group"} [destination] - undocumented
27
27
  * @prop {Number} [comment_count] - number of comments on post (only if type=post)
28
28
  * @prop {Boolean} [comments_disabled] - whether or not you can comment on post (only if type=post)
@@ -86,6 +86,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
86
86
  * @prop {Boolean} posted_with_username - undocumented
87
87
  */
88
88
 
89
+ /**
90
+ * A conversation icon associated with a user
91
+ * @typedef {Object} SidechatIcon
92
+ * @prop {String} emoji - unicode emoji character
93
+ * @prop {String} color - primary hex color code
94
+ * @prop {String} secondary_color - secondary hex color code
95
+ */
96
+
89
97
  /**
90
98
  * The current user's information
91
99
  * @typedef {Object} SidechatCurrentUser
@@ -99,6 +107,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
99
107
  * @prop {String} wildcardEmailDomain - domain of verified email address on account, preceeded by *. to support subdomains
100
108
  */
101
109
 
110
+ /**
111
+ * A user's public profile
112
+ * @typedef {Object} SidechatProfile
113
+ * @prop {String} id - alphanumeric ID of user
114
+ * @prop {String} name - public-facing username
115
+ * @prop {SidechatIcon} conversation_icon - icon associated with user
116
+ * @prop {Boolean} description - the user bio
117
+ * @prop {String} index_name - undocumented
118
+ * @prop {String} analytics_name - undocumented
119
+ * @prop {String} color - undocumented
120
+ * @prop {String} share_color_start - undocumented
121
+ * @prop {String} share_color_end - undocumented
122
+ * @prop {"account"} group_join_type - undocumented
123
+ * @prop {"public_to_all"} group_visibility - the profile visibility status
124
+ */
125
+
102
126
  /**
103
127
  * Representation of a group membership
104
128
  * @typedef {Object} SidechatMembership
@@ -133,7 +157,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
133
157
  * @prop {SidechatCursorString} cursor
134
158
  */
135
159
 
136
- var SidechatTypes = {};
137
160
 
138
161
  /**
139
162
  * A direct message thread
@@ -170,7 +193,7 @@ var SidechatTypes = {};
170
193
  * @prop {Boolean} allows_view_results - whether or not poll results are publicly visible
171
194
  * @prop {Number} view_results_count - number of users who have viewed poll results
172
195
  * @prop {Boolean} participated - whether or not current user has voted in poll
173
- */
196
+ */
174
197
 
175
198
  /**
176
199
  * Represents a poll choice
@@ -178,7 +201,9 @@ var SidechatTypes = {};
178
201
  * @prop {Number} count - number of votes for choice
179
202
  * @prop {String} text - user-visible text of choice
180
203
  * @prop {Boolean} selected - whether or not current user has voted for choice
181
- */
204
+ */
205
+
206
+ var SidechatTypes = {};
182
207
 
183
208
  /**
184
209
  * Throwable error caused by the Sidechat API
@@ -734,6 +759,33 @@ class SidechatAPIClient {
734
759
  }
735
760
  };
736
761
 
762
+ /**
763
+ * Searches for new groups based on a query keyword
764
+ * @method
765
+ * @since 2.6.0
766
+ * @param {String} query - the string to search for. This will be encoded, so strings with spaces and special characters are okay.
767
+ * @returns {SidechatGroup[]}
768
+ */
769
+ searchAvailableGroups = async (query) => {
770
+ if (!this.userToken) {
771
+ throw new SidechatAPIError("User is not authenticated.");
772
+ }
773
+ try {
774
+ const res = await fetch(`${this.apiRoot}/v1/groups/explore/search?term=${encodeURIComponent(query)}`, {
775
+ method: "GET",
776
+ headers: {
777
+ ...this.defaultHeaders,
778
+ Authorization: `Bearer ${this.userToken}`,
779
+ },
780
+ });
781
+ const json = await res.json();
782
+ return await json.results;
783
+ } catch (err) {
784
+ console.error(err);
785
+ throw new SidechatAPIError(`Failed to search groups.`);
786
+ }
787
+ };
788
+
737
789
  /**
738
790
  * Retrieves the entire accessible asset library. Be warned that as of the time of this documentation, it's a 1.5MB JSON download and this request is very expensive.
739
791
  * @method
@@ -1064,10 +1116,7 @@ class SidechatAPIClient {
1064
1116
  uri: uri,
1065
1117
  });
1066
1118
 
1067
- const urlReq = await this.sendRequest(
1068
- `/v1/assets/upload_url?content_type=${imageType}`,
1069
- "GET"
1070
- );
1119
+ const urlReq = await this.sendRequest(`/v1/assets/upload_url?content_type=${imageType}`);
1071
1120
  const urlJson = await urlReq.json();
1072
1121
 
1073
1122
  try {
@@ -1091,7 +1140,7 @@ class SidechatAPIClient {
1091
1140
  };
1092
1141
 
1093
1142
  /**
1094
- * Sets the conversation icon of the current user
1143
+ * Sets the conversation icon of a user
1095
1144
  * @method
1096
1145
  * @since 2.2.1
1097
1146
  * @param {String} userID - alphanumeric ID of user
@@ -1128,6 +1177,37 @@ class SidechatAPIClient {
1128
1177
  }
1129
1178
  };
1130
1179
 
1180
+ /**
1181
+ * Sets the bio text of a user
1182
+ * @method
1183
+ * @since 2.5.6
1184
+ * @param {String} userID - alphanumeric ID of user
1185
+ * @param {String} bio - text to set as bio
1186
+ */
1187
+ setUserBio = async (userID, bio) => {
1188
+ if (!this.userToken) {
1189
+ throw new SidechatAPIError("User is not authenticated.");
1190
+ }
1191
+ try {
1192
+ const res = await fetch(`${this.apiRoot}/v1/users/${userID}`, {
1193
+ method: "PATCH",
1194
+ headers: {
1195
+ ...this.defaultHeaders,
1196
+ "App-Version": "5.4.22",
1197
+ Authorization: `Bearer ${this.userToken}`,
1198
+ },
1199
+ body: JSON.stringify({
1200
+ bio: bio
1201
+ }),
1202
+ });
1203
+ const json = await res.json();
1204
+ return await json;
1205
+ } catch (err) {
1206
+ console.error(err);
1207
+ throw new SidechatAPIError(`Failed to set bio.`);
1208
+ }
1209
+ };
1210
+
1131
1211
  /**
1132
1212
  * Checks if user can set their username to a string
1133
1213
  * @method
@@ -1191,6 +1271,60 @@ class SidechatAPIClient {
1191
1271
  }
1192
1272
  };
1193
1273
 
1274
+ /**
1275
+ * Fetches a public user profile
1276
+ * @method
1277
+ * @since 2.6.0
1278
+ * @param {String} username - username of the user to fetch
1279
+ * @returns {SidechatProfile}
1280
+ */
1281
+ getUserProfile = async (username) => {
1282
+ if (!this.userToken) {
1283
+ throw new SidechatAPIError("User is not authenticated.");
1284
+ }
1285
+ try {
1286
+ const res = await fetch(`${this.apiRoot}/v1/groups/username?username=${username}`, {
1287
+ method: "GET",
1288
+ headers: {
1289
+ ...this.defaultHeaders,
1290
+ Authorization: `Bearer ${this.userToken}`,
1291
+ }
1292
+ });
1293
+ const json = await res.json();
1294
+ return await json.group;
1295
+ } catch (err) {
1296
+ console.error(err);
1297
+ throw new SidechatAPIError(`Failed to set icon.`);
1298
+ }
1299
+ };
1300
+
1301
+ /**
1302
+ * Fetches a public user's posts
1303
+ * @method
1304
+ * @since 2.6.0
1305
+ * @param {String} username - username of the user to fetch
1306
+ * @returns {SidechatPostOrComment[]}
1307
+ */
1308
+ getUserPosts = async (username) => {
1309
+ if (!this.userToken) {
1310
+ throw new SidechatAPIError("User is not authenticated.");
1311
+ }
1312
+ try {
1313
+ const res = await fetch(`${this.apiRoot}/v1/users/posts?username=${username}`, {
1314
+ method: "GET",
1315
+ headers: {
1316
+ ...this.defaultHeaders,
1317
+ Authorization: `Bearer ${this.userToken}`,
1318
+ }
1319
+ });
1320
+ const json = await res.json();
1321
+ return await json.posts;
1322
+ } catch (err) {
1323
+ console.error(err);
1324
+ throw new SidechatAPIError(`Failed to set icon.`);
1325
+ }
1326
+ };
1327
+
1194
1328
  /**
1195
1329
  * Marks an activity item as read
1196
1330
  * @method
@@ -1246,8 +1380,13 @@ class SidechatAPIClient {
1246
1380
  };
1247
1381
 
1248
1382
  /**
1249
- * Joins a group chat
1383
+ * Joins a group chat. To mimic the official client, use the user's display name and icon by default.
1250
1384
  * @method
1385
+ * @param {String} groupChatID - alphanumeric ID of group chat to join
1386
+ * @param {String} displayName - display name to use in chat
1387
+ * @param {String} emoji - emoji to use as icon
1388
+ * @param {String} primaryColor - hex string of primary color
1389
+ * @param {String} secondaryColor - hex string of secondary color
1251
1390
  * @since 2.3.5
1252
1391
  */
1253
1392
  joinGroupChat = async (
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * @typedef {Object} SidechatPostOrComment
4
4
  * @prop {"post"|"comment"} type - whether this object represents a post or a comment on a post
5
5
  * @prop {String} id - alphanumeric ID of post or comment
6
- * @prop {Boolean} authored_by_user - undocumented
6
+ * @prop {Boolean} authored_by_user - whether or not the post or comment was created by the current user
7
7
  * @prop {String} alias - post creator's name in-app
8
8
  * @prop {String} group_id - alphanumeric ID of group
9
9
  * @prop {SidechatGroup} group - group in which post or comment was created
@@ -17,8 +17,8 @@
17
17
  * @prop {String[]} tags - undocumented
18
18
  * @prop {SidechatIdentity} identity - creator's identity information
19
19
  * @prop {Boolean} pinned - undocumented
20
- * @prop {Boolean} is_saved - undocumented
21
- * @prop {"following"|"not_following"} follow_status - undocumented
20
+ * @prop {Boolean} is_saved - whether or not the current user has saved the post
21
+ * @prop {"following"|"not_following"} follow_status - whether or not the current user should recieve activity notifications for the post
22
22
  * @prop {"group"} [destination] - undocumented
23
23
  * @prop {Number} [comment_count] - number of comments on post (only if type=post)
24
24
  * @prop {Boolean} [comments_disabled] - whether or not you can comment on post (only if type=post)
@@ -82,6 +82,14 @@
82
82
  * @prop {Boolean} posted_with_username - undocumented
83
83
  */
84
84
 
85
+ /**
86
+ * A conversation icon associated with a user
87
+ * @typedef {Object} SidechatIcon
88
+ * @prop {String} emoji - unicode emoji character
89
+ * @prop {String} color - primary hex color code
90
+ * @prop {String} secondary_color - secondary hex color code
91
+ */
92
+
85
93
  /**
86
94
  * The current user's information
87
95
  * @typedef {Object} SidechatCurrentUser
@@ -95,6 +103,22 @@
95
103
  * @prop {String} wildcardEmailDomain - domain of verified email address on account, preceeded by *. to support subdomains
96
104
  */
97
105
 
106
+ /**
107
+ * A user's public profile
108
+ * @typedef {Object} SidechatProfile
109
+ * @prop {String} id - alphanumeric ID of user
110
+ * @prop {String} name - public-facing username
111
+ * @prop {SidechatIcon} conversation_icon - icon associated with user
112
+ * @prop {Boolean} description - the user bio
113
+ * @prop {String} index_name - undocumented
114
+ * @prop {String} analytics_name - undocumented
115
+ * @prop {String} color - undocumented
116
+ * @prop {String} share_color_start - undocumented
117
+ * @prop {String} share_color_end - undocumented
118
+ * @prop {"account"} group_join_type - undocumented
119
+ * @prop {"public_to_all"} group_visibility - the profile visibility status
120
+ */
121
+
98
122
  /**
99
123
  * Representation of a group membership
100
124
  * @typedef {Object} SidechatMembership
@@ -129,7 +153,6 @@
129
153
  * @prop {SidechatCursorString} cursor
130
154
  */
131
155
 
132
- var SidechatTypes = {};
133
156
 
134
157
  /**
135
158
  * A direct message thread
@@ -166,7 +189,7 @@ var SidechatTypes = {};
166
189
  * @prop {Boolean} allows_view_results - whether or not poll results are publicly visible
167
190
  * @prop {Number} view_results_count - number of users who have viewed poll results
168
191
  * @prop {Boolean} participated - whether or not current user has voted in poll
169
- */
192
+ */
170
193
 
171
194
  /**
172
195
  * Represents a poll choice
@@ -174,7 +197,9 @@ var SidechatTypes = {};
174
197
  * @prop {Number} count - number of votes for choice
175
198
  * @prop {String} text - user-visible text of choice
176
199
  * @prop {Boolean} selected - whether or not current user has voted for choice
177
- */
200
+ */
201
+
202
+ var SidechatTypes = {};
178
203
 
179
204
  /**
180
205
  * Throwable error caused by the Sidechat API
@@ -730,6 +755,33 @@ class SidechatAPIClient {
730
755
  }
731
756
  };
732
757
 
758
+ /**
759
+ * Searches for new groups based on a query keyword
760
+ * @method
761
+ * @since 2.6.0
762
+ * @param {String} query - the string to search for. This will be encoded, so strings with spaces and special characters are okay.
763
+ * @returns {SidechatGroup[]}
764
+ */
765
+ searchAvailableGroups = async (query) => {
766
+ if (!this.userToken) {
767
+ throw new SidechatAPIError("User is not authenticated.");
768
+ }
769
+ try {
770
+ const res = await fetch(`${this.apiRoot}/v1/groups/explore/search?term=${encodeURIComponent(query)}`, {
771
+ method: "GET",
772
+ headers: {
773
+ ...this.defaultHeaders,
774
+ Authorization: `Bearer ${this.userToken}`,
775
+ },
776
+ });
777
+ const json = await res.json();
778
+ return await json.results;
779
+ } catch (err) {
780
+ console.error(err);
781
+ throw new SidechatAPIError(`Failed to search groups.`);
782
+ }
783
+ };
784
+
733
785
  /**
734
786
  * Retrieves the entire accessible asset library. Be warned that as of the time of this documentation, it's a 1.5MB JSON download and this request is very expensive.
735
787
  * @method
@@ -1060,10 +1112,7 @@ class SidechatAPIClient {
1060
1112
  uri: uri,
1061
1113
  });
1062
1114
 
1063
- const urlReq = await this.sendRequest(
1064
- `/v1/assets/upload_url?content_type=${imageType}`,
1065
- "GET"
1066
- );
1115
+ const urlReq = await this.sendRequest(`/v1/assets/upload_url?content_type=${imageType}`);
1067
1116
  const urlJson = await urlReq.json();
1068
1117
 
1069
1118
  try {
@@ -1087,7 +1136,7 @@ class SidechatAPIClient {
1087
1136
  };
1088
1137
 
1089
1138
  /**
1090
- * Sets the conversation icon of the current user
1139
+ * Sets the conversation icon of a user
1091
1140
  * @method
1092
1141
  * @since 2.2.1
1093
1142
  * @param {String} userID - alphanumeric ID of user
@@ -1124,6 +1173,37 @@ class SidechatAPIClient {
1124
1173
  }
1125
1174
  };
1126
1175
 
1176
+ /**
1177
+ * Sets the bio text of a user
1178
+ * @method
1179
+ * @since 2.5.6
1180
+ * @param {String} userID - alphanumeric ID of user
1181
+ * @param {String} bio - text to set as bio
1182
+ */
1183
+ setUserBio = async (userID, bio) => {
1184
+ if (!this.userToken) {
1185
+ throw new SidechatAPIError("User is not authenticated.");
1186
+ }
1187
+ try {
1188
+ const res = await fetch(`${this.apiRoot}/v1/users/${userID}`, {
1189
+ method: "PATCH",
1190
+ headers: {
1191
+ ...this.defaultHeaders,
1192
+ "App-Version": "5.4.22",
1193
+ Authorization: `Bearer ${this.userToken}`,
1194
+ },
1195
+ body: JSON.stringify({
1196
+ bio: bio
1197
+ }),
1198
+ });
1199
+ const json = await res.json();
1200
+ return await json;
1201
+ } catch (err) {
1202
+ console.error(err);
1203
+ throw new SidechatAPIError(`Failed to set bio.`);
1204
+ }
1205
+ };
1206
+
1127
1207
  /**
1128
1208
  * Checks if user can set their username to a string
1129
1209
  * @method
@@ -1187,6 +1267,60 @@ class SidechatAPIClient {
1187
1267
  }
1188
1268
  };
1189
1269
 
1270
+ /**
1271
+ * Fetches a public user profile
1272
+ * @method
1273
+ * @since 2.6.0
1274
+ * @param {String} username - username of the user to fetch
1275
+ * @returns {SidechatProfile}
1276
+ */
1277
+ getUserProfile = async (username) => {
1278
+ if (!this.userToken) {
1279
+ throw new SidechatAPIError("User is not authenticated.");
1280
+ }
1281
+ try {
1282
+ const res = await fetch(`${this.apiRoot}/v1/groups/username?username=${username}`, {
1283
+ method: "GET",
1284
+ headers: {
1285
+ ...this.defaultHeaders,
1286
+ Authorization: `Bearer ${this.userToken}`,
1287
+ }
1288
+ });
1289
+ const json = await res.json();
1290
+ return await json.group;
1291
+ } catch (err) {
1292
+ console.error(err);
1293
+ throw new SidechatAPIError(`Failed to set icon.`);
1294
+ }
1295
+ };
1296
+
1297
+ /**
1298
+ * Fetches a public user's posts
1299
+ * @method
1300
+ * @since 2.6.0
1301
+ * @param {String} username - username of the user to fetch
1302
+ * @returns {SidechatPostOrComment[]}
1303
+ */
1304
+ getUserPosts = async (username) => {
1305
+ if (!this.userToken) {
1306
+ throw new SidechatAPIError("User is not authenticated.");
1307
+ }
1308
+ try {
1309
+ const res = await fetch(`${this.apiRoot}/v1/users/posts?username=${username}`, {
1310
+ method: "GET",
1311
+ headers: {
1312
+ ...this.defaultHeaders,
1313
+ Authorization: `Bearer ${this.userToken}`,
1314
+ }
1315
+ });
1316
+ const json = await res.json();
1317
+ return await json.posts;
1318
+ } catch (err) {
1319
+ console.error(err);
1320
+ throw new SidechatAPIError(`Failed to set icon.`);
1321
+ }
1322
+ };
1323
+
1190
1324
  /**
1191
1325
  * Marks an activity item as read
1192
1326
  * @method
@@ -1242,8 +1376,13 @@ class SidechatAPIClient {
1242
1376
  };
1243
1377
 
1244
1378
  /**
1245
- * Joins a group chat
1379
+ * Joins a group chat. To mimic the official client, use the user's display name and icon by default.
1246
1380
  * @method
1381
+ * @param {String} groupChatID - alphanumeric ID of group chat to join
1382
+ * @param {String} displayName - display name to use in chat
1383
+ * @param {String} emoji - emoji to use as icon
1384
+ * @param {String} primaryColor - hex string of primary color
1385
+ * @param {String} secondaryColor - hex string of secondary color
1247
1386
  * @since 2.3.5
1248
1387
  */
1249
1388
  joinGroupChat = async (
@@ -13,7 +13,7 @@ export type SidechatPostOrComment = {
13
13
  */
14
14
  id: string;
15
15
  /**
16
- * - undocumented
16
+ * - whether or not the post or comment was created by the current user
17
17
  */
18
18
  authored_by_user: boolean;
19
19
  /**
@@ -69,11 +69,11 @@ export type SidechatPostOrComment = {
69
69
  */
70
70
  pinned: boolean;
71
71
  /**
72
- * - undocumented
72
+ * - whether or not the current user has saved the post
73
73
  */
74
74
  is_saved: boolean;
75
75
  /**
76
- * - undocumented
76
+ * - whether or not the current user should recieve activity notifications for the post
77
77
  */
78
78
  follow_status: "following" | "not_following";
79
79
  /**
@@ -246,6 +246,23 @@ export type SidechatIdentity = {
246
246
  */
247
247
  posted_with_username: boolean;
248
248
  };
249
+ /**
250
+ * A conversation icon associated with a user
251
+ */
252
+ export type SidechatIcon = {
253
+ /**
254
+ * - unicode emoji character
255
+ */
256
+ emoji: string;
257
+ /**
258
+ * - primary hex color code
259
+ */
260
+ color: string;
261
+ /**
262
+ * - secondary hex color code
263
+ */
264
+ secondary_color: string;
265
+ };
249
266
  /**
250
267
  * The current user's information
251
268
  */
@@ -280,6 +297,55 @@ export type SidechatCurrentUser = {
280
297
  */
281
298
  wildcardEmailDomain: string;
282
299
  };
300
+ /**
301
+ * A user's public profile
302
+ */
303
+ export type SidechatProfile = {
304
+ /**
305
+ * - alphanumeric ID of user
306
+ */
307
+ id: string;
308
+ /**
309
+ * - public-facing username
310
+ */
311
+ name: string;
312
+ /**
313
+ * - icon associated with user
314
+ */
315
+ conversation_icon: SidechatIcon;
316
+ /**
317
+ * - the user bio
318
+ */
319
+ description: boolean;
320
+ /**
321
+ * - undocumented
322
+ */
323
+ index_name: string;
324
+ /**
325
+ * - undocumented
326
+ */
327
+ analytics_name: string;
328
+ /**
329
+ * - undocumented
330
+ */
331
+ color: string;
332
+ /**
333
+ * - undocumented
334
+ */
335
+ share_color_start: string;
336
+ /**
337
+ * - undocumented
338
+ */
339
+ share_color_end: string;
340
+ /**
341
+ * - undocumented
342
+ */
343
+ group_join_type: "account";
344
+ /**
345
+ * - the profile visibility status
346
+ */
347
+ group_visibility: "public_to_all";
348
+ };
283
349
  /**
284
350
  * Representation of a group membership
285
351
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SidechatTypes.d.ts","sourceRoot":"","sources":["../../src/types/SidechatTypes.js"],"names":[],"mappings":";;;;;;;;;UAGU,MAAM,GAAC,SAAS;;;;;;;;;;;;;;;;;;;;WAKhB,aAAa;;;;;;;;;;;;;;;;iBAIb,kBAAkB;;;;YAClB,mBAAmB,EAAE;;;;;;;;;;;;UAGrB,QAAQ;;;;cACR,gBAAgB;;;;;;;;;;;;mBAGhB,WAAW,GAAC,eAAe;;;;kBAC3B,OAAO;;;;;;;;;;;;WAGP,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAYZ,YAAY,GAAC,QAAQ;;;;;;;;qBAErB,MAAM,GAAC,QAAQ,GAAC,cAAc;;;;sBAC9B,SAAS,GAAC,eAAe,GAAC,mBAAmB;;;;8BAC7C,MAAM,GAAC,MAAM;;;;;;;;;;;;eAGb,uBAAuB;;;;;;;;;;;;;;;;;;;;;UASvB,OAAO;;;;kBACP,MAAM,GAAC,KAAK,GAAC,KAAK;;;;;;;;;;;;UAGlB,uBAAuB;;;;;;;;;;;;;;;;;cAQvB,qBAAqB;;;;SACrB,uBAAuB;;;;;;;;;;;;;;;;;UAQvB,OAAO;;;;kBACP,MAAM,GAAC,KAAK,GAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiBlB,kBAAkB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAyBjB,QAAQ,GAAC,UAAU,GAAC,MAAM;;;;;;;;;WAW7B,qBAAqB,EAAE;YACvB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAapB,UAAU;;;;UACV,MAAM,GAAC,SAAS;;;;cAChB,qBAAqB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAavB,SAAS;;;;;;;;;;;;;;;;;aAQT,kBAAkB,EAAE"}
1
+ {"version":3,"file":"SidechatTypes.d.ts","sourceRoot":"","sources":["../../src/types/SidechatTypes.js"],"names":[],"mappings":";;;;;;;;;UAGU,MAAM,GAAC,SAAS;;;;;;;;;;;;;;;;;;;;WAKhB,aAAa;;;;;;;;;;;;;;;;iBAIb,kBAAkB;;;;YAClB,mBAAmB,EAAE;;;;;;;;;;;;UAGrB,QAAQ;;;;cACR,gBAAgB;;;;;;;;;;;;mBAGhB,WAAW,GAAC,eAAe;;;;kBAC3B,OAAO;;;;;;;;;;;;WAGP,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAYZ,YAAY,GAAC,QAAQ;;;;;;;;qBAErB,MAAM,GAAC,QAAQ,GAAC,cAAc;;;;sBAC9B,SAAS,GAAC,eAAe,GAAC,mBAAmB;;;;8BAC7C,MAAM,GAAC,MAAM;;;;;;;;;;;;eAGb,uBAAuB;;;;;;;;;;;;;;;;;;;;;UASvB,OAAO;;;;kBACP,MAAM,GAAC,KAAK,GAAC,KAAK;;;;;;;;;;;;UAGlB,uBAAuB;;;;;;;;;;;;;;;;;cAQvB,qBAAqB;;;;SACrB,uBAAuB;;;;;;;;;;;;;;;;;UAQvB,OAAO;;;;kBACP,MAAM,GAAC,KAAK,GAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyBlB,kBAAkB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAWpB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAOZ,SAAS;;;;sBACT,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;iCAsBZ,QAAQ,GAAC,UAAU,GAAC,MAAM;;;;;;;;;WAW7B,qBAAqB,EAAE;YACvB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAYpB,UAAU;;;;UACV,MAAM,GAAC,SAAS;;;;cAChB,qBAAqB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAavB,SAAS;;;;;;;;;;;;;;;;;aAQT,kBAAkB,EAAE"}