sidechat.js 2.3.3 → 2.3.6
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.
- package/dist/classes/SidechatAPIClient.d.ts +39 -2
- package/dist/classes/SidechatAPIClient.d.ts.map +1 -1
- package/dist/classes/SidechatColorList.d.ts +25 -0
- package/dist/classes/SidechatColorList.d.ts.map +1 -0
- package/dist/index.cjs +246 -2
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +246 -3
- package/docs/sidechat.js/2.3.6/SidechatAPIClient.html +3 -0
- package/docs/sidechat.js/2.3.6/SidechatAPIError.html +3 -0
- package/docs/sidechat.js/2.3.6/classes_SidechatAPIClient.js.html +919 -0
- package/docs/sidechat.js/2.3.6/classes_SidechatAPIError.js.html +16 -0
- package/docs/sidechat.js/2.3.6/classes_SidechatColorList.js.html +80 -0
- package/docs/sidechat.js/2.3.6/data/search.json +1 -0
- package/docs/sidechat.js/2.3.6/fonts/Inconsolata-Regular.ttf +0 -0
- package/docs/sidechat.js/2.3.6/fonts/OpenSans-Regular.ttf +0 -0
- package/docs/sidechat.js/2.3.6/fonts/WorkSans-Bold.ttf +0 -0
- package/docs/sidechat.js/2.3.6/global.html +3 -0
- package/docs/sidechat.js/2.3.6/index.html +4 -0
- package/docs/sidechat.js/2.3.6/scripts/core.js +702 -0
- package/docs/sidechat.js/2.3.6/scripts/core.min.js +23 -0
- package/docs/sidechat.js/2.3.6/scripts/resize.js +90 -0
- package/docs/sidechat.js/2.3.6/scripts/search.js +265 -0
- package/docs/sidechat.js/2.3.6/scripts/search.min.js +6 -0
- package/docs/sidechat.js/2.3.6/scripts/third-party/Apache-License-2.0.txt +202 -0
- package/docs/sidechat.js/2.3.6/scripts/third-party/fuse.js +9 -0
- package/docs/sidechat.js/2.3.6/scripts/third-party/hljs-line-num-original.js +369 -0
- package/docs/sidechat.js/2.3.6/scripts/third-party/hljs-line-num.js +1 -0
- package/docs/sidechat.js/2.3.6/scripts/third-party/hljs-original.js +5171 -0
- package/docs/sidechat.js/2.3.6/scripts/third-party/hljs.js +1 -0
- package/docs/sidechat.js/2.3.6/scripts/third-party/popper.js +5 -0
- package/docs/sidechat.js/2.3.6/scripts/third-party/tippy.js +1 -0
- package/docs/sidechat.js/2.3.6/scripts/third-party/tocbot.js +672 -0
- package/docs/sidechat.js/2.3.6/scripts/third-party/tocbot.min.js +1 -0
- package/docs/sidechat.js/2.3.6/styles/clean-jsdoc-theme-base.css +975 -0
- package/docs/sidechat.js/2.3.6/styles/clean-jsdoc-theme-dark.css +407 -0
- package/docs/sidechat.js/2.3.6/styles/clean-jsdoc-theme-light.css +388 -0
- package/docs/sidechat.js/2.3.6/styles/clean-jsdoc-theme.min.css +1 -0
- package/docs/sidechat.js/2.3.6/tutorial-Authentication.html +14 -0
- package/docs/sidechat.js/2.3.6/tutorial-Email Registration.html +6 -0
- package/docs/sidechat.js/2.3.6/types_SidechatTypes.js.html +134 -0
- package/jsdoc.json +2 -1
- package/package.json +1 -1
- package/src/classes/SidechatAPIClient.js +169 -2
- package/src/classes/SidechatColorList.js +77 -0
- package/src/index.js +2 -1
- package/src/tests/colorTest.js +1 -0
|
@@ -114,6 +114,14 @@ declare class SidechatAPIClient {
|
|
|
114
114
|
* @returns {SidechatPostOrComment} post object
|
|
115
115
|
*/
|
|
116
116
|
getPost: (postID: string, includeDeleted?: boolean) => SidechatPostOrComment;
|
|
117
|
+
/**
|
|
118
|
+
* Fetches the posts or comments that the user has created
|
|
119
|
+
* @method
|
|
120
|
+
* @since 2.3.5
|
|
121
|
+
* @param {"posts"|"comments"} contentType - type of user content to fetch
|
|
122
|
+
* @returns {SidechatPostOrComment[]} post object
|
|
123
|
+
*/
|
|
124
|
+
getUserContent: (contentType: "posts" | "comments") => SidechatPostOrComment[];
|
|
117
125
|
/**
|
|
118
126
|
* Get all the commments on a post
|
|
119
127
|
* @method
|
|
@@ -174,9 +182,10 @@ declare class SidechatAPIClient {
|
|
|
174
182
|
* @param {SidechatSimpleAsset[]} [assetList] - list of assets to attach.
|
|
175
183
|
* @param {Boolean} [disableDMs] - prevent direct messages from being sent to post's author
|
|
176
184
|
* @param {Boolean} [disableComments] - whether or not comments should be disabled on post
|
|
185
|
+
* @param {Boolean} [anonymous] - whether or not to hide user's name and icon on post
|
|
177
186
|
* @returns {SidechatPostOrComment} the created post
|
|
178
187
|
*/
|
|
179
|
-
createPost: (text: string, groupID: string, assetList?: SidechatSimpleAsset[], disableDMs?: boolean, disableComments?: boolean) => SidechatPostOrComment;
|
|
188
|
+
createPost: (text: string, groupID: string, assetList?: SidechatSimpleAsset[], disableDMs?: boolean, disableComments?: boolean, anonymous?: boolean) => SidechatPostOrComment;
|
|
180
189
|
/**
|
|
181
190
|
* Deletes a post or comment that the user created
|
|
182
191
|
* @method
|
|
@@ -188,12 +197,28 @@ declare class SidechatAPIClient {
|
|
|
188
197
|
* Sets the conversation icon of the current user
|
|
189
198
|
* @method
|
|
190
199
|
* @since 2.2.1
|
|
191
|
-
* @param {String} userID - alphanumeric ID of
|
|
200
|
+
* @param {String} userID - alphanumeric ID of user
|
|
192
201
|
* @param {String} emoji - emoji to set as icon
|
|
193
202
|
* @param {String} primaryColor - hex string (including #) of primary color
|
|
194
203
|
* @param {String} secondaryColor - hex string (including #) of secondary color
|
|
195
204
|
*/
|
|
196
205
|
setUserIcon: (userID: string, emoji: string, primaryColor: string, secondaryColor: string) => Promise<any>;
|
|
206
|
+
/**
|
|
207
|
+
* Checks if user can set their username to a string
|
|
208
|
+
* @method
|
|
209
|
+
* @since 2.3.6
|
|
210
|
+
* @param {String} username - string to check
|
|
211
|
+
* @returns {Boolean} whether or not username is valid and unused
|
|
212
|
+
*/
|
|
213
|
+
checkUsername: (username: string) => boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Changes the username of the current user
|
|
216
|
+
* @method
|
|
217
|
+
* @since 2.3.6
|
|
218
|
+
* @param {String} userID - alphanumeric ID of user
|
|
219
|
+
* @param {String} username - new username to set
|
|
220
|
+
*/
|
|
221
|
+
setUsername: (userID: string, username: string) => Promise<any>;
|
|
197
222
|
/**
|
|
198
223
|
* Marks an activity item as read
|
|
199
224
|
* @method
|
|
@@ -201,5 +226,17 @@ declare class SidechatAPIClient {
|
|
|
201
226
|
* @param {String} activityID - alphanumeric ID of activity object
|
|
202
227
|
*/
|
|
203
228
|
readActivity: (activityID: string) => Promise<any>;
|
|
229
|
+
/**
|
|
230
|
+
* Retrieves joinable group chats
|
|
231
|
+
* @method
|
|
232
|
+
* @since 2.3.5
|
|
233
|
+
*/
|
|
234
|
+
getGroupChats: () => Promise<any>;
|
|
235
|
+
/**
|
|
236
|
+
* Joins a group chat
|
|
237
|
+
* @method
|
|
238
|
+
* @since 2.3.5
|
|
239
|
+
*/
|
|
240
|
+
joinGroupChat: (groupChatID: any, displayName: any, emoji: any, primaryColor: any, secondaryColor: any) => Promise<any>;
|
|
204
241
|
}
|
|
205
242
|
//# sourceMappingURL=SidechatAPIClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidechatAPIClient.d.ts","sourceRoot":"","sources":["../../src/classes/SidechatAPIClient.js"],"names":[],"mappings":";AAGA;;;;GAIG;AACH;IAmBE;;;OAGG;IACH,uCAIC;IA1BD;;;SAGK;IACL,6BAAU;IACV;;;;;OAKG;IACH,oBAKE;IAYF;;;;OAIG;IACH,6CAEE;IAEF;;;;;OAKG;IACH,mDAgBE;IAEF;;;;;;OAMG;IACH,mEAsBE;IAEF;;;;;;OAMG;IACH,8DAyBE;IAEF;;;;;;OAMG;IACH,+CA2BE;IAEF;;;;OAIG;IACH,2CAyBE;IAEF;;;;;OAKG;IACH,6CA2BE;IAEF;;;;;;OAMG;IACH,oDAGE;IAEF;;;;;OAKG;IACH,+CAqBE;IAEF;;;;;;;;OAQG;IACH,4CAJW,KAAK,GAAC,QAAQ,GAAC,KAAK,2DA2B7B;IAEF;;;;;;OAMG;IACH,sEAsBE;IAEF;;;;;;;OAOG;IACH,6EAqBE;IAEF;;;;;;OAMG;IACH,qCAFa,uBAAuB,CAqElC;IAEF;;;;;;OAMG;IACH,2CAFa,eAAe,CAqB1B;IAEF;;;;;OAKG;IACH,uBAFa,sBAAsB,CAoBjC;IAEF;;;;;OAKG;IACH,0CAkBE;IAEF;;;;;;OAMG;IACH,sDAkBE;IAEF;;;;;;;;;;;OAWG;IACH,0GAJW,qBAAqB,iDAsC9B;IAEF
|
|
1
|
+
{"version":3,"file":"SidechatAPIClient.d.ts","sourceRoot":"","sources":["../../src/classes/SidechatAPIClient.js"],"names":[],"mappings":";AAGA;;;;GAIG;AACH;IAmBE;;;OAGG;IACH,uCAIC;IA1BD;;;SAGK;IACL,6BAAU;IACV;;;;;OAKG;IACH,oBAKE;IAYF;;;;OAIG;IACH,6CAEE;IAEF;;;;;OAKG;IACH,mDAgBE;IAEF;;;;;;OAMG;IACH,mEAsBE;IAEF;;;;;;OAMG;IACH,8DAyBE;IAEF;;;;;;OAMG;IACH,+CA2BE;IAEF;;;;OAIG;IACH,2CAyBE;IAEF;;;;;OAKG;IACH,6CA2BE;IAEF;;;;;;OAMG;IACH,oDAGE;IAEF;;;;;OAKG;IACH,+CAqBE;IAEF;;;;;;;;OAQG;IACH,4CAJW,KAAK,GAAC,QAAQ,GAAC,KAAK,2DA2B7B;IAEF;;;;;;OAMG;IACH,sEAsBE;IAEF;;;;;;;OAOG;IACH,6EAqBE;IAEF;;;;;;OAMG;IACH,8BAHW,OAAO,GAAC,UAAU,KAChB,uBAAuB,CA4BlC;IAEF;;;;;;OAMG;IACH,qCAFa,uBAAuB,CAqElC;IAEF;;;;;;OAMG;IACH,2CAFa,eAAe,CAqB1B;IAEF;;;;;OAKG;IACH,uBAFa,sBAAsB,CAoBjC;IAEF;;;;;OAKG;IACH,0CAkBE;IAEF;;;;;;OAMG;IACH,sDAkBE;IAEF;;;;;;;;;;;OAWG;IACH,0GAJW,qBAAqB,iDAsC9B;IAEF;;;;;;;;;;;OAWG;IACH,wDANW,qBAAqB,iGAyC9B;IAEF;;;;;OAKG;IACH,+DAqBE;IAEF;;;;;;;;OAQG;IACH,2GA2BE;IAEF;;;;;;OAMG;IACH,6CAwBE;IAEF;;;;;;OAMG;IACH,gEAqBE;IAEF;;;;;OAKG;IACH,mDAqBE;IAEF;;;;OAIG;IACH,kCAkBE;IAEF;;;;OAIG;IACH,wHAiCE;CACH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default SidechatColorList;
|
|
2
|
+
export type SidechatColor = {
|
|
3
|
+
/**
|
|
4
|
+
* - hex code of primary color
|
|
5
|
+
*/
|
|
6
|
+
primary: string;
|
|
7
|
+
/**
|
|
8
|
+
* - hex code of secondary color
|
|
9
|
+
*/
|
|
10
|
+
secondary: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @typedef SidechatColor
|
|
14
|
+
* @prop {String} primary - hex code of primary color
|
|
15
|
+
* @prop {String} secondary - hex code of secondary color
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* List of colors compatible with user conversation icons
|
|
19
|
+
* @constant
|
|
20
|
+
* @type {{ colors: SidechatColor[] }}
|
|
21
|
+
*/
|
|
22
|
+
declare const SidechatColorList: {
|
|
23
|
+
colors: SidechatColor[];
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=SidechatColorList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidechatColorList.d.ts","sourceRoot":"","sources":["../../src/classes/SidechatColorList.js"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,iCAFU;IAAE,MAAM,EAAE,aAAa,EAAE,CAAA;CAAE,CAiEnC"}
|
package/dist/index.cjs
CHANGED
|
@@ -386,6 +386,41 @@ class SidechatAPIClient {
|
|
|
386
386
|
}
|
|
387
387
|
};
|
|
388
388
|
|
|
389
|
+
/**
|
|
390
|
+
* Fetches the posts or comments that the user has created
|
|
391
|
+
* @method
|
|
392
|
+
* @since 2.3.5
|
|
393
|
+
* @param {"posts"|"comments"} contentType - type of user content to fetch
|
|
394
|
+
* @returns {SidechatPostOrComment[]} post object
|
|
395
|
+
*/
|
|
396
|
+
getUserContent = async (contentType) => {
|
|
397
|
+
if (!this.userToken) {
|
|
398
|
+
throw new SidechatAPIError("User is not authenticated.");
|
|
399
|
+
}
|
|
400
|
+
if (contentType == "posts") {
|
|
401
|
+
contentType = "my_posts";
|
|
402
|
+
} else if (contentType == "comments") {
|
|
403
|
+
contentType = "my_comments";
|
|
404
|
+
}
|
|
405
|
+
try {
|
|
406
|
+
const res = await fetch(
|
|
407
|
+
`https://api.sidechat.lol/v1/posts&type=${contentType}`,
|
|
408
|
+
{
|
|
409
|
+
method: "GET",
|
|
410
|
+
headers: {
|
|
411
|
+
...this.defaultHeaders,
|
|
412
|
+
Authorization: `Bearer ${this.userToken}`,
|
|
413
|
+
},
|
|
414
|
+
}
|
|
415
|
+
);
|
|
416
|
+
const json = await res.json();
|
|
417
|
+
return json.posts;
|
|
418
|
+
} catch (err) {
|
|
419
|
+
console.error(err);
|
|
420
|
+
throw new SidechatAPIError(`Failed to get content from user.`);
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
|
|
389
424
|
/**
|
|
390
425
|
* Get all the commments on a post
|
|
391
426
|
* @method
|
|
@@ -626,6 +661,7 @@ class SidechatAPIClient {
|
|
|
626
661
|
* @param {SidechatSimpleAsset[]} [assetList] - list of assets to attach.
|
|
627
662
|
* @param {Boolean} [disableDMs] - prevent direct messages from being sent to post's author
|
|
628
663
|
* @param {Boolean} [disableComments] - whether or not comments should be disabled on post
|
|
664
|
+
* @param {Boolean} [anonymous] - whether or not to hide user's name and icon on post
|
|
629
665
|
* @returns {SidechatPostOrComment} the created post
|
|
630
666
|
*/
|
|
631
667
|
createPost = async (
|
|
@@ -633,7 +669,8 @@ class SidechatAPIClient {
|
|
|
633
669
|
groupID,
|
|
634
670
|
assetList = [],
|
|
635
671
|
disableDMs = false,
|
|
636
|
-
disableComments = false
|
|
672
|
+
disableComments = false,
|
|
673
|
+
anonymous = false
|
|
637
674
|
) => {
|
|
638
675
|
if (!this.userToken) {
|
|
639
676
|
throw new SidechatAPIError("User is not authenticated.");
|
|
@@ -653,6 +690,7 @@ class SidechatAPIClient {
|
|
|
653
690
|
attachments: [],
|
|
654
691
|
dms_disabled: disableDMs,
|
|
655
692
|
comments_disabled: disableComments,
|
|
693
|
+
using_identity: !anonymous,
|
|
656
694
|
}),
|
|
657
695
|
});
|
|
658
696
|
const json = await res.json();
|
|
@@ -696,7 +734,7 @@ class SidechatAPIClient {
|
|
|
696
734
|
* Sets the conversation icon of the current user
|
|
697
735
|
* @method
|
|
698
736
|
* @since 2.2.1
|
|
699
|
-
* @param {String} userID - alphanumeric ID of
|
|
737
|
+
* @param {String} userID - alphanumeric ID of user
|
|
700
738
|
* @param {String} emoji - emoji to set as icon
|
|
701
739
|
* @param {String} primaryColor - hex string (including #) of primary color
|
|
702
740
|
* @param {String} secondaryColor - hex string (including #) of secondary color
|
|
@@ -710,6 +748,7 @@ class SidechatAPIClient {
|
|
|
710
748
|
method: "PATCH",
|
|
711
749
|
headers: {
|
|
712
750
|
...this.defaultHeaders,
|
|
751
|
+
"App-Version": "0",
|
|
713
752
|
Authorization: `Bearer ${this.userToken}`,
|
|
714
753
|
},
|
|
715
754
|
body: JSON.stringify({
|
|
@@ -729,6 +768,69 @@ class SidechatAPIClient {
|
|
|
729
768
|
}
|
|
730
769
|
};
|
|
731
770
|
|
|
771
|
+
/**
|
|
772
|
+
* Checks if user can set their username to a string
|
|
773
|
+
* @method
|
|
774
|
+
* @since 2.3.6
|
|
775
|
+
* @param {String} username - string to check
|
|
776
|
+
* @returns {Boolean} whether or not username is valid and unused
|
|
777
|
+
*/
|
|
778
|
+
checkUsername = async (username) => {
|
|
779
|
+
if (!this.userToken) {
|
|
780
|
+
throw new SidechatAPIError("User is not authenticated.");
|
|
781
|
+
}
|
|
782
|
+
try {
|
|
783
|
+
const res = await fetch(
|
|
784
|
+
`https://api.sidechat.lol/v1/users/username?username=${username}`,
|
|
785
|
+
{
|
|
786
|
+
method: "GET",
|
|
787
|
+
headers: {
|
|
788
|
+
...this.defaultHeaders,
|
|
789
|
+
Authorization: `Bearer ${this.userToken}`,
|
|
790
|
+
},
|
|
791
|
+
}
|
|
792
|
+
);
|
|
793
|
+
if (res?.status == 200 || res?.status == 204) {
|
|
794
|
+
return true;
|
|
795
|
+
} else {
|
|
796
|
+
return false;
|
|
797
|
+
}
|
|
798
|
+
} catch (err) {
|
|
799
|
+
console.error(err);
|
|
800
|
+
throw new SidechatAPIError(`Failed to check username.`);
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Changes the username of the current user
|
|
806
|
+
* @method
|
|
807
|
+
* @since 2.3.6
|
|
808
|
+
* @param {String} userID - alphanumeric ID of user
|
|
809
|
+
* @param {String} username - new username to set
|
|
810
|
+
*/
|
|
811
|
+
setUsername = async (userID, username) => {
|
|
812
|
+
if (!this.userToken) {
|
|
813
|
+
throw new SidechatAPIError("User is not authenticated.");
|
|
814
|
+
}
|
|
815
|
+
try {
|
|
816
|
+
const res = await fetch(`https://api.sidechat.lol/v1/users/${userID}`, {
|
|
817
|
+
method: "PATCH",
|
|
818
|
+
headers: {
|
|
819
|
+
...this.defaultHeaders,
|
|
820
|
+
Authorization: `Bearer ${this.userToken}`,
|
|
821
|
+
},
|
|
822
|
+
body: JSON.stringify({
|
|
823
|
+
username: username,
|
|
824
|
+
}),
|
|
825
|
+
});
|
|
826
|
+
const json = await res.json();
|
|
827
|
+
return await json.user;
|
|
828
|
+
} catch (err) {
|
|
829
|
+
console.error(err);
|
|
830
|
+
throw new SidechatAPIError(`Failed to set icon.`);
|
|
831
|
+
}
|
|
832
|
+
};
|
|
833
|
+
|
|
732
834
|
/**
|
|
733
835
|
* Marks an activity item as read
|
|
734
836
|
* @method
|
|
@@ -757,7 +859,149 @@ class SidechatAPIClient {
|
|
|
757
859
|
throw new SidechatAPIError(`Failed to mark activity as read.`);
|
|
758
860
|
}
|
|
759
861
|
};
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* Retrieves joinable group chats
|
|
865
|
+
* @method
|
|
866
|
+
* @since 2.3.5
|
|
867
|
+
*/
|
|
868
|
+
getGroupChats = async () => {
|
|
869
|
+
if (!this.userToken) {
|
|
870
|
+
throw new SidechatAPIError("User is not authenticated.");
|
|
871
|
+
}
|
|
872
|
+
try {
|
|
873
|
+
const res = await fetch(`https://api.sidechat.lol/v1/chats/explore`, {
|
|
874
|
+
method: "GET",
|
|
875
|
+
headers: {
|
|
876
|
+
...this.defaultHeaders,
|
|
877
|
+
Authorization: `Bearer ${this.userToken}`,
|
|
878
|
+
},
|
|
879
|
+
});
|
|
880
|
+
const json = await res.json();
|
|
881
|
+
return await json.chats;
|
|
882
|
+
} catch (err) {
|
|
883
|
+
console.error(err);
|
|
884
|
+
throw new SidechatAPIError(`Failed to get groupchats.`);
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* Joins a group chat
|
|
890
|
+
* @method
|
|
891
|
+
* @since 2.3.5
|
|
892
|
+
*/
|
|
893
|
+
joinGroupChat = async (
|
|
894
|
+
groupChatID,
|
|
895
|
+
displayName,
|
|
896
|
+
emoji,
|
|
897
|
+
primaryColor,
|
|
898
|
+
secondaryColor
|
|
899
|
+
) => {
|
|
900
|
+
if (!this.userToken) {
|
|
901
|
+
throw new SidechatAPIError("User is not authenticated.");
|
|
902
|
+
}
|
|
903
|
+
try {
|
|
904
|
+
const res = await fetch(`https://api.sidechat.lol/v1/chats/groups/join`, {
|
|
905
|
+
method: "GET",
|
|
906
|
+
headers: {
|
|
907
|
+
...this.defaultHeaders,
|
|
908
|
+
Authorization: `Bearer ${this.userToken}`,
|
|
909
|
+
},
|
|
910
|
+
body: JSON.stringify({
|
|
911
|
+
chat_id: groupChatID,
|
|
912
|
+
identity: {
|
|
913
|
+
display_name: displayName,
|
|
914
|
+
emoji: emoji,
|
|
915
|
+
secondary_color: secondaryColor,
|
|
916
|
+
color: primaryColor,
|
|
917
|
+
},
|
|
918
|
+
}),
|
|
919
|
+
});
|
|
920
|
+
const json = await res.json();
|
|
921
|
+
return await json;
|
|
922
|
+
} catch (err) {
|
|
923
|
+
console.error(err);
|
|
924
|
+
throw new SidechatAPIError(`Failed to join groupchat.`);
|
|
925
|
+
}
|
|
926
|
+
};
|
|
760
927
|
}
|
|
761
928
|
|
|
929
|
+
/**
|
|
930
|
+
* @typedef SidechatColor
|
|
931
|
+
* @prop {String} primary - hex code of primary color
|
|
932
|
+
* @prop {String} secondary - hex code of secondary color
|
|
933
|
+
*/
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* List of colors compatible with user conversation icons
|
|
937
|
+
* @constant
|
|
938
|
+
* @type {{ colors: SidechatColor[] }}
|
|
939
|
+
*/
|
|
940
|
+
const SidechatColorList = {
|
|
941
|
+
colors: [
|
|
942
|
+
{
|
|
943
|
+
primary: "#74DEEE",
|
|
944
|
+
secondary: "#239EAB",
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
primary: "#15FF46",
|
|
948
|
+
secondary: "#3FC0FF",
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
primary: "#D9FB8A",
|
|
952
|
+
secondary: "#B1FD00",
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
primary: "#FC40FF",
|
|
956
|
+
secondary: "#0DD5B2",
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
primary: "#3E973C",
|
|
960
|
+
secondary: "#0F430E",
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
primary: "#FFD305",
|
|
964
|
+
secondary: "#F4B320",
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
primary: "#8483FF",
|
|
968
|
+
secondary: "#5857FF",
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
primary: "#FA81FF",
|
|
972
|
+
secondary: "#722DFF",
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
primary: "#00CBFE",
|
|
976
|
+
secondary: "#0D13D5",
|
|
977
|
+
},
|
|
978
|
+
{
|
|
979
|
+
primary: "#FF7B51",
|
|
980
|
+
secondary: "#B2431F",
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
primary: "#FF47CC",
|
|
984
|
+
secondary: "#69004C",
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
primary: "#00EE6E",
|
|
988
|
+
secondary: "#0C75E6",
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
primary: "#FF1885",
|
|
992
|
+
secondary: "#FA81FF",
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
primary: "#D8DC44",
|
|
996
|
+
secondary: "#228B3F",
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
primary: "#0968E5",
|
|
1000
|
+
secondary: "#091970",
|
|
1001
|
+
},
|
|
1002
|
+
],
|
|
1003
|
+
};
|
|
1004
|
+
|
|
762
1005
|
exports.SidechatAPIClient = SidechatAPIClient;
|
|
763
1006
|
exports.SidechatAPIError = SidechatAPIError;
|
|
1007
|
+
exports.SidechatColorList = SidechatColorList;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import SidechatAPIClient from "./classes/SidechatAPIClient.js";
|
|
2
2
|
import SidechatAPIError from "./classes/SidechatAPIError.js";
|
|
3
|
-
|
|
3
|
+
import SidechatColorList from "./classes/SidechatColorList.js";
|
|
4
|
+
export { SidechatAPIClient, SidechatAPIError, SidechatColorList };
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import SidechatAPIClient from "./classes/SidechatAPIClient.js";
|
|
2
2
|
import SidechatAPIError from "./classes/SidechatAPIError.js";
|
|
3
|
-
|
|
3
|
+
import SidechatColorList from "./classes/SidechatColorList.js";
|
|
4
|
+
export { SidechatAPIClient, SidechatAPIError, SidechatColorList };
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"8BAC8B,gCAAgC;6BACjC,+BAA+B"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"8BAC8B,gCAAgC;6BACjC,+BAA+B;8BAC9B,gCAAgC"}
|