sidechat.js 2.5.6 → 2.6.1

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 (91) hide show
  1. package/dist/classes/SidechatAPIClient.d.ts +32 -3
  2. package/dist/classes/SidechatAPIClient.d.ts.map +1 -1
  3. package/dist/index.cjs +121 -8
  4. package/dist/index.mjs +121 -8
  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.6.0/SidechatAPIClient.html +3 -0
  8. package/docs/sidechat.js/2.6.0/SidechatAPIError.html +3 -0
  9. package/docs/sidechat.js/2.6.0/SidechatColorList.html +3 -0
  10. package/docs/sidechat.js/{2.4.9 → 2.6.0}/classes_SidechatAPIClient.js.html +237 -9
  11. package/docs/sidechat.js/2.6.0/classes_SidechatAPIError.js.html +16 -0
  12. package/docs/sidechat.js/2.6.0/classes_SidechatColorList.js.html +79 -0
  13. package/docs/sidechat.js/2.6.0/data/search.json +1 -0
  14. package/docs/sidechat.js/2.6.0/global.html +3 -0
  15. package/docs/sidechat.js/2.6.0/index.html +4 -0
  16. package/docs/sidechat.js/2.6.0/tutorial-Authentication.html +14 -0
  17. package/docs/sidechat.js/2.6.0/tutorial-Email Registration.html +6 -0
  18. package/docs/sidechat.js/{2.4.9 → 2.6.0}/types_SidechatTypes.js.html +51 -7
  19. package/docs/sidechat.js/2.6.1/SidechatAPIClient.html +3 -0
  20. package/docs/sidechat.js/2.6.1/SidechatAPIError.html +3 -0
  21. package/docs/sidechat.js/2.6.1/SidechatColorList.html +3 -0
  22. package/docs/sidechat.js/2.6.1/classes_SidechatAPIClient.js.html +1358 -0
  23. package/docs/sidechat.js/2.6.1/classes_SidechatAPIError.js.html +16 -0
  24. package/docs/sidechat.js/2.6.1/classes_SidechatColorList.js.html +79 -0
  25. package/docs/sidechat.js/2.6.1/data/search.json +1 -0
  26. package/docs/sidechat.js/2.6.1/fonts/Inconsolata-Regular.ttf +0 -0
  27. package/docs/sidechat.js/2.6.1/fonts/OpenSans-Regular.ttf +0 -0
  28. package/docs/sidechat.js/2.6.1/fonts/WorkSans-Bold.ttf +0 -0
  29. package/docs/sidechat.js/2.6.1/global.html +3 -0
  30. package/docs/sidechat.js/2.6.1/index.html +4 -0
  31. package/docs/sidechat.js/2.6.1/scripts/core.js +726 -0
  32. package/docs/sidechat.js/2.6.1/scripts/core.min.js +23 -0
  33. package/docs/sidechat.js/2.6.1/scripts/resize.js +90 -0
  34. package/docs/sidechat.js/2.6.1/scripts/search.js +265 -0
  35. package/docs/sidechat.js/2.6.1/scripts/search.min.js +6 -0
  36. package/docs/sidechat.js/2.6.1/scripts/third-party/Apache-License-2.0.txt +202 -0
  37. package/docs/sidechat.js/2.6.1/scripts/third-party/fuse.js +9 -0
  38. package/docs/sidechat.js/2.6.1/scripts/third-party/hljs-line-num-original.js +369 -0
  39. package/docs/sidechat.js/2.6.1/scripts/third-party/hljs-line-num.js +1 -0
  40. package/docs/sidechat.js/2.6.1/scripts/third-party/hljs-original.js +5171 -0
  41. package/docs/sidechat.js/2.6.1/scripts/third-party/hljs.js +1 -0
  42. package/docs/sidechat.js/2.6.1/scripts/third-party/popper.js +5 -0
  43. package/docs/sidechat.js/2.6.1/scripts/third-party/tippy.js +1 -0
  44. package/docs/sidechat.js/2.6.1/scripts/third-party/tocbot.js +672 -0
  45. package/docs/sidechat.js/2.6.1/scripts/third-party/tocbot.min.js +1 -0
  46. package/docs/sidechat.js/2.6.1/styles/clean-jsdoc-theme-base.css +1159 -0
  47. package/docs/sidechat.js/2.6.1/styles/clean-jsdoc-theme-dark.css +412 -0
  48. package/docs/sidechat.js/2.6.1/styles/clean-jsdoc-theme-light.css +482 -0
  49. package/docs/sidechat.js/2.6.1/styles/clean-jsdoc-theme-scrollbar.css +30 -0
  50. package/docs/sidechat.js/2.6.1/styles/clean-jsdoc-theme-without-scrollbar.min.css +1 -0
  51. package/docs/sidechat.js/2.6.1/styles/clean-jsdoc-theme.min.css +1 -0
  52. package/docs/sidechat.js/2.6.1/tutorial-Authentication.html +14 -0
  53. package/docs/sidechat.js/2.6.1/tutorial-Email Registration.html +6 -0
  54. package/docs/sidechat.js/2.6.1/types_SidechatTypes.js.html +204 -0
  55. package/package.json +1 -1
  56. package/src/classes/SidechatAPIClient.js +90 -2
  57. package/src/types/SidechatTypes.js +31 -6
  58. package/docs/sidechat.js/2.4.9/SidechatAPIClient.html +0 -3
  59. package/docs/sidechat.js/2.4.9/SidechatAPIError.html +0 -3
  60. package/docs/sidechat.js/2.4.9/SidechatColorList.html +0 -3
  61. package/docs/sidechat.js/2.4.9/classes_SidechatAPIError.js.html +0 -16
  62. package/docs/sidechat.js/2.4.9/classes_SidechatColorList.js.html +0 -79
  63. package/docs/sidechat.js/2.4.9/data/search.json +0 -1
  64. package/docs/sidechat.js/2.4.9/global.html +0 -3
  65. package/docs/sidechat.js/2.4.9/index.html +0 -4
  66. package/docs/sidechat.js/2.4.9/tutorial-Authentication.html +0 -14
  67. package/docs/sidechat.js/2.4.9/tutorial-Email Registration.html +0 -6
  68. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/fonts/Inconsolata-Regular.ttf +0 -0
  69. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/fonts/OpenSans-Regular.ttf +0 -0
  70. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/fonts/WorkSans-Bold.ttf +0 -0
  71. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/core.js +0 -0
  72. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/core.min.js +0 -0
  73. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/resize.js +0 -0
  74. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/search.js +0 -0
  75. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/search.min.js +0 -0
  76. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/third-party/Apache-License-2.0.txt +0 -0
  77. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/third-party/fuse.js +0 -0
  78. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/third-party/hljs-line-num-original.js +0 -0
  79. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/third-party/hljs-line-num.js +0 -0
  80. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/third-party/hljs-original.js +0 -0
  81. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/third-party/hljs.js +0 -0
  82. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/third-party/popper.js +0 -0
  83. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/third-party/tippy.js +0 -0
  84. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/third-party/tocbot.js +0 -0
  85. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/scripts/third-party/tocbot.min.js +0 -0
  86. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/styles/clean-jsdoc-theme-base.css +0 -0
  87. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/styles/clean-jsdoc-theme-dark.css +0 -0
  88. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/styles/clean-jsdoc-theme-light.css +0 -0
  89. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/styles/clean-jsdoc-theme-scrollbar.css +0 -0
  90. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -0
  91. /package/docs/sidechat.js/{2.4.9 → 2.6.0}/styles/clean-jsdoc-theme.min.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
@@ -220,7 +228,7 @@ declare class SidechatAPIClient {
220
228
  * @param {Boolean} [anonymous] - whether or not to hide user's name and icon on post
221
229
  * @returns {SidechatPostOrComment} the created post
222
230
  */
223
- createPost: (text: string, groupID: string, assetList?: SidechatSimpleAsset[], disableDMs?: boolean, disableComments?: boolean, anonymous?: boolean) => SidechatPostOrComment;
231
+ createPost: (text: string, groupID: string, assetList?: SidechatSimpleAsset[], disableDMs?: boolean, disableComments?: boolean, anonymous?: boolean, repostId?: any) => SidechatPostOrComment;
224
232
  /**
225
233
  * Deletes a post or comment that the user created
226
234
  * @method
@@ -287,6 +295,22 @@ declare class SidechatAPIClient {
287
295
  * @param {String} username - new username to set
288
296
  */
289
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[];
290
314
  /**
291
315
  * Marks an activity item as read
292
316
  * @method
@@ -301,11 +325,16 @@ declare class SidechatAPIClient {
301
325
  */
302
326
  getGroupChats: () => Promise<any>;
303
327
  /**
304
- * Joins a group chat
328
+ * Joins a group chat. To mimic the official client, use the user's display name and icon by default.
305
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
306
335
  * @since 2.3.5
307
336
  */
308
- 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>;
309
338
  /**
310
339
  * Gets a list of the user's direct messages
311
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,sEAsCE;IAEF;;;;;;;;OAQG;IACH,2GA2BE;IAEF;;;;;;OAMG;IACH,0DAsBE;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;I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CE;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
@@ -918,7 +970,8 @@ class SidechatAPIClient {
918
970
  assetList = [],
919
971
  disableDMs = false,
920
972
  disableComments = false,
921
- anonymous = false
973
+ anonymous = false,
974
+ repostId = undefined
922
975
  ) => {
923
976
  if (!this.userToken) {
924
977
  throw new SidechatAPIError("User is not authenticated.");
@@ -939,6 +992,7 @@ class SidechatAPIClient {
939
992
  dms_disabled: disableDMs,
940
993
  comments_disabled: disableComments,
941
994
  using_identity: !anonymous,
995
+ quote_post_id: repostId
942
996
  }),
943
997
  });
944
998
  const json = await res.json();
@@ -1219,6 +1273,60 @@ class SidechatAPIClient {
1219
1273
  }
1220
1274
  };
1221
1275
 
1276
+ /**
1277
+ * Fetches a public user profile
1278
+ * @method
1279
+ * @since 2.6.0
1280
+ * @param {String} username - username of the user to fetch
1281
+ * @returns {SidechatProfile}
1282
+ */
1283
+ getUserProfile = async (username) => {
1284
+ if (!this.userToken) {
1285
+ throw new SidechatAPIError("User is not authenticated.");
1286
+ }
1287
+ try {
1288
+ const res = await fetch(`${this.apiRoot}/v1/groups/username?username=${username}`, {
1289
+ method: "GET",
1290
+ headers: {
1291
+ ...this.defaultHeaders,
1292
+ Authorization: `Bearer ${this.userToken}`,
1293
+ }
1294
+ });
1295
+ const json = await res.json();
1296
+ return await json.group;
1297
+ } catch (err) {
1298
+ console.error(err);
1299
+ throw new SidechatAPIError(`Failed to set icon.`);
1300
+ }
1301
+ };
1302
+
1303
+ /**
1304
+ * Fetches a public user's posts
1305
+ * @method
1306
+ * @since 2.6.0
1307
+ * @param {String} username - username of the user to fetch
1308
+ * @returns {SidechatPostOrComment[]}
1309
+ */
1310
+ getUserPosts = async (username) => {
1311
+ if (!this.userToken) {
1312
+ throw new SidechatAPIError("User is not authenticated.");
1313
+ }
1314
+ try {
1315
+ const res = await fetch(`${this.apiRoot}/v1/users/posts?username=${username}`, {
1316
+ method: "GET",
1317
+ headers: {
1318
+ ...this.defaultHeaders,
1319
+ Authorization: `Bearer ${this.userToken}`,
1320
+ }
1321
+ });
1322
+ const json = await res.json();
1323
+ return await json.posts;
1324
+ } catch (err) {
1325
+ console.error(err);
1326
+ throw new SidechatAPIError(`Failed to set icon.`);
1327
+ }
1328
+ };
1329
+
1222
1330
  /**
1223
1331
  * Marks an activity item as read
1224
1332
  * @method
@@ -1274,8 +1382,13 @@ class SidechatAPIClient {
1274
1382
  };
1275
1383
 
1276
1384
  /**
1277
- * Joins a group chat
1385
+ * Joins a group chat. To mimic the official client, use the user's display name and icon by default.
1278
1386
  * @method
1387
+ * @param {String} groupChatID - alphanumeric ID of group chat to join
1388
+ * @param {String} displayName - display name to use in chat
1389
+ * @param {String} emoji - emoji to use as icon
1390
+ * @param {String} primaryColor - hex string of primary color
1391
+ * @param {String} secondaryColor - hex string of secondary color
1279
1392
  * @since 2.3.5
1280
1393
  */
1281
1394
  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
@@ -914,7 +966,8 @@ class SidechatAPIClient {
914
966
  assetList = [],
915
967
  disableDMs = false,
916
968
  disableComments = false,
917
- anonymous = false
969
+ anonymous = false,
970
+ repostId = undefined
918
971
  ) => {
919
972
  if (!this.userToken) {
920
973
  throw new SidechatAPIError("User is not authenticated.");
@@ -935,6 +988,7 @@ class SidechatAPIClient {
935
988
  dms_disabled: disableDMs,
936
989
  comments_disabled: disableComments,
937
990
  using_identity: !anonymous,
991
+ quote_post_id: repostId
938
992
  }),
939
993
  });
940
994
  const json = await res.json();
@@ -1215,6 +1269,60 @@ class SidechatAPIClient {
1215
1269
  }
1216
1270
  };
1217
1271
 
1272
+ /**
1273
+ * Fetches a public user profile
1274
+ * @method
1275
+ * @since 2.6.0
1276
+ * @param {String} username - username of the user to fetch
1277
+ * @returns {SidechatProfile}
1278
+ */
1279
+ getUserProfile = async (username) => {
1280
+ if (!this.userToken) {
1281
+ throw new SidechatAPIError("User is not authenticated.");
1282
+ }
1283
+ try {
1284
+ const res = await fetch(`${this.apiRoot}/v1/groups/username?username=${username}`, {
1285
+ method: "GET",
1286
+ headers: {
1287
+ ...this.defaultHeaders,
1288
+ Authorization: `Bearer ${this.userToken}`,
1289
+ }
1290
+ });
1291
+ const json = await res.json();
1292
+ return await json.group;
1293
+ } catch (err) {
1294
+ console.error(err);
1295
+ throw new SidechatAPIError(`Failed to set icon.`);
1296
+ }
1297
+ };
1298
+
1299
+ /**
1300
+ * Fetches a public user's posts
1301
+ * @method
1302
+ * @since 2.6.0
1303
+ * @param {String} username - username of the user to fetch
1304
+ * @returns {SidechatPostOrComment[]}
1305
+ */
1306
+ getUserPosts = async (username) => {
1307
+ if (!this.userToken) {
1308
+ throw new SidechatAPIError("User is not authenticated.");
1309
+ }
1310
+ try {
1311
+ const res = await fetch(`${this.apiRoot}/v1/users/posts?username=${username}`, {
1312
+ method: "GET",
1313
+ headers: {
1314
+ ...this.defaultHeaders,
1315
+ Authorization: `Bearer ${this.userToken}`,
1316
+ }
1317
+ });
1318
+ const json = await res.json();
1319
+ return await json.posts;
1320
+ } catch (err) {
1321
+ console.error(err);
1322
+ throw new SidechatAPIError(`Failed to set icon.`);
1323
+ }
1324
+ };
1325
+
1218
1326
  /**
1219
1327
  * Marks an activity item as read
1220
1328
  * @method
@@ -1270,8 +1378,13 @@ class SidechatAPIClient {
1270
1378
  };
1271
1379
 
1272
1380
  /**
1273
- * Joins a group chat
1381
+ * Joins a group chat. To mimic the official client, use the user's display name and icon by default.
1274
1382
  * @method
1383
+ * @param {String} groupChatID - alphanumeric ID of group chat to join
1384
+ * @param {String} displayName - display name to use in chat
1385
+ * @param {String} emoji - emoji to use as icon
1386
+ * @param {String} primaryColor - hex string of primary color
1387
+ * @param {String} secondaryColor - hex string of secondary color
1275
1388
  * @since 2.3.5
1276
1389
  */
1277
1390
  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;;;;;;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