sidechat.js 2.4.0 → 2.4.2
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 +2 -1
- package/dist/classes/SidechatAPIClient.d.ts.map +1 -1
- package/dist/index.cjs +137 -1
- 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 +137 -2
- package/package.json +54 -54
- package/src/classes/SidechatAPIClient.js +4 -1
- package/src/index.js +7 -2
|
@@ -192,9 +192,10 @@ declare class SidechatAPIClient {
|
|
|
192
192
|
* @param {String} [replyCommentID] - alphanumeric ID of comment to reply to. Falls back to parentPostID
|
|
193
193
|
* @param {SidechatSimpleAsset[]} [assetList] - list of assets to attach
|
|
194
194
|
* @param {Boolean} [disableDMs] - prevent direct messages being sent to comment's author
|
|
195
|
+
* @param {Boolean} [anonymous] - whether or not to hide user's name and icon on comment
|
|
195
196
|
* @returns {SidechatPostOrComment} created comment
|
|
196
197
|
*/
|
|
197
|
-
createComment: (parentPostID: string, text: string, groupID: string, replyCommentID?: string, assetList?: SidechatSimpleAsset[], disableDMs?: boolean) => SidechatPostOrComment;
|
|
198
|
+
createComment: (parentPostID: string, text: string, groupID: string, replyCommentID?: string, assetList?: SidechatSimpleAsset[], disableDMs?: boolean, anonymous?: boolean) => SidechatPostOrComment;
|
|
198
199
|
/**
|
|
199
200
|
* Creates a new post in the specified group
|
|
200
201
|
* @method
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidechatAPIClient.d.ts","sourceRoot":"","sources":["../../src/classes/SidechatAPIClient.js"],"names":[],"mappings":";AAGA;;;;GAIG;AACH;IA2BE;;;;OAIG;IACH,yDAOC;IAtCD;;;SAGK;IACL,6BAAU;IAEV;;;;;OAKG;IACH,oBAKE;IAEF;;;;OAIG;IACH,gBAAqC;IAgBrC;;;;OAIG;IACH,6CAEE;IAEF;;;;;OAKG;IACH,kCAEE;IAEF;;;;;OAKG;IACH,mDAgBE;IAEF;;;;;;OAMG;IACH,mEAmBE;IAEF;;;;;;OAMG;IACH,8DAsBE;IAEF;;;;;;OAMG;IACH,+CAwBE;IAEF;;;;OAIG;IACH,2CAsBE;IAEF;;;;;OAKG;IACH,6CAwBE;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,CAyBlC;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;;;;;;OAMG;IACH,yEAwBE;IAEF
|
|
1
|
+
{"version":3,"file":"SidechatAPIClient.d.ts","sourceRoot":"","sources":["../../src/classes/SidechatAPIClient.js"],"names":[],"mappings":";AAGA;;;;GAIG;AACH;IA2BE;;;;OAIG;IACH,yDAOC;IAtCD;;;SAGK;IACL,6BAAU;IAEV;;;;;OAKG;IACH,oBAKE;IAEF;;;;OAIG;IACH,gBAAqC;IAgBrC;;;;OAIG;IACH,6CAEE;IAEF;;;;;OAKG;IACH,kCAEE;IAEF;;;;;OAKG;IACH,mDAgBE;IAEF;;;;;;OAMG;IACH,mEAmBE;IAEF;;;;;;OAMG;IACH,8DAsBE;IAEF;;;;;;OAMG;IACH,+CAwBE;IAEF;;;;OAIG;IACH,2CAsBE;IAEF;;;;;OAKG;IACH,6CAwBE;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,CAyBlC;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;;;;;;OAMG;IACH,yEAwBE;IAEF;;;;;;;;;;;;OAYG;IACH,0GALW,qBAAqB,sEAyC9B;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"}
|
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,138 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* A user-created post or comment, depending on the "type" prop
|
|
7
|
+
* @typedef {Object} SidechatPostOrComment
|
|
8
|
+
* @prop {"post"|"comment"} type - whether this object represents a post or a comment on a post
|
|
9
|
+
* @prop {String} id - alphanumeric ID of post or comment
|
|
10
|
+
* @prop {Boolean} authored_by_user - undocumented
|
|
11
|
+
* @prop {String} alias - post creator's name in-app
|
|
12
|
+
* @prop {String} group_id - alphanumeric ID of group
|
|
13
|
+
* @prop {SidechatGroup} group - group in which post or comment was created
|
|
14
|
+
* @prop {String} text - text content of post or comment
|
|
15
|
+
* @prop {String} created_at - date string of post or comment creation time
|
|
16
|
+
* @prop {Number} vote_total - sum of upvotes and downvotes
|
|
17
|
+
* @prop {SidechatVoteString} vote_status - current user's vote on post or comment
|
|
18
|
+
* @prop {SidechatSimpleAsset[]} assets - array of simple assets attached to post or comment
|
|
19
|
+
* @prop {Array} attachments - undocumented
|
|
20
|
+
* @prop {Boolean} dms_disabled - whether or not you can send a DM to creator of post
|
|
21
|
+
* @prop {Array} tags - undocumented
|
|
22
|
+
* @prop {SidechatIdentity} identity - creator's identity information
|
|
23
|
+
* @prop {Boolean} pinned - undocumented
|
|
24
|
+
* @prop {Boolean} is_saved - undocumented
|
|
25
|
+
* @prop {"following"|"not_following"} follow_status - undocumented
|
|
26
|
+
* @prop {"group"} [destination] - undocumented
|
|
27
|
+
* @prop {Number} [comment_count] - number of comments on post (only if type=post)
|
|
28
|
+
* @prop {Boolean} [comments_disabled] - whether or not you can comment on post (only if type=post)
|
|
29
|
+
* @prop {String} [parent_post_id] - alphanumeric ID of parent post (only if type=comment)
|
|
30
|
+
* @prop {String} [reply_post_id] - alphanumeric ID of comment being replied to, falls back to parent_post_id (only if type=comment)
|
|
31
|
+
* @prop {String} [context] - text content of comment being replied to, falls back to text (only if type=comment)
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A group object, containing metadata about a group as well as its join conditions and states. Some properties vary based on the endpoint the object came from.
|
|
36
|
+
* @typedef {Object} SidechatGroup
|
|
37
|
+
* @prop {String} id - alphanumeric ID of group
|
|
38
|
+
* @prop {String} name - human-readable name of group
|
|
39
|
+
* @prop {String} analytics_name - name to file group under
|
|
40
|
+
* @prop {"non_member"|"member"} membership_type - whether or not current user is a member of group
|
|
41
|
+
* @prop {String} color - group's theme color as hex code (e.g., #FFFFFF)
|
|
42
|
+
* @prop {"open"|"closed"|"email_domain"} group_join_type - basis on which group accepts new members
|
|
43
|
+
* @prop {"private"|"public_to_all"|"public_to_schools"} group_visibility - group's visibility setting
|
|
44
|
+
* @prop {"show"|"hide"} asset_library_visibility - whether or not group's asset library is visible
|
|
45
|
+
* @prop {Array} [roles] - undocumented
|
|
46
|
+
* @prop {String} [description] - description of group
|
|
47
|
+
* @prop {SidechatPrivateAssetURL} [icon_url] - image URL for group icon
|
|
48
|
+
* @prop {Number} [member_count] - number of users in group
|
|
49
|
+
* @prop {Boolean} [should_show_leaderboard] - undocumented
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* An asset object, containing information about an image within a post or comment
|
|
54
|
+
* @typedef {Object} SidechatSimpleAsset
|
|
55
|
+
* @prop {String} id - alphanumeric ID of asset
|
|
56
|
+
* @prop {"image"} type - undocumented
|
|
57
|
+
* @prop {"jpeg"|"png"|"gif"} content_type - file type of asset
|
|
58
|
+
* @prop {Number} width - width of asset
|
|
59
|
+
* @prop {Number} height - height of asset
|
|
60
|
+
* @prop {SidechatPrivateAssetURL} [url] - URL string of asset's location
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* An asset object, containing information about an image from the asset library
|
|
65
|
+
* @typedef {Object} SidechatLibraryAsset
|
|
66
|
+
* @prop {String} id - alphanumeric ID of asset
|
|
67
|
+
* @prop {String} created_at - date string of asset creation time
|
|
68
|
+
* @prop {SidechatAssetMetadata} metadata - metadata associated with asset
|
|
69
|
+
* @prop {SidechatPrivateAssetURL} url - URL string of asset's location
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* An asset object, containing information about an image from the asset library
|
|
74
|
+
* @typedef {Object} SidechatAssetMetadata
|
|
75
|
+
* @prop {Number} width - width of asset
|
|
76
|
+
* @prop {Number} height - height of asset
|
|
77
|
+
* @prop {"image"} type - undocumented
|
|
78
|
+
* @prop {"jpeg"|"png"|"gif"} content_type - file type of asset
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* A user's anonymous identity information
|
|
83
|
+
* @typedef {Object} SidechatIdentity
|
|
84
|
+
* @prop {String} name - representation of user's name (varies across app)
|
|
85
|
+
* @prop {Boolean} posted_with_username - undocumented
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The current user's information
|
|
90
|
+
* @typedef {Object} SidechatCurrentUser
|
|
91
|
+
* @prop {String} id - alphanumeric ID of current user
|
|
92
|
+
* @prop {String} hashedVerifiedEmail - verified email of current user in an unreadable hashed form
|
|
93
|
+
* @prop {Boolean} isGlobalModerator - whether or not user is a moderator
|
|
94
|
+
* @prop {Boolean} isGlobalAdmin - whether or not user is an admin
|
|
95
|
+
* @prop {SidechatMembership[]} memberships
|
|
96
|
+
* @prop {Array} roles - undocumented
|
|
97
|
+
* @prop {String} emailDomain - domain of verified email address on account
|
|
98
|
+
* @prop {String} wildcardEmailDomain - domain of verified email address on account, preceeded by *. to support subdomains
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Representation of a group membership
|
|
103
|
+
* @typedef {Object} SidechatMembership
|
|
104
|
+
* @prop {String} groupId - alphanumeric ID of group
|
|
105
|
+
* @prop {String} type - role of current user in group
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* An asset URL that can only be accessed by making a request with a user's bearer token attached in the Authorization header
|
|
110
|
+
* @typedef {String} SidechatPrivateAssetURL
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* A cursor for paginating through post lists
|
|
115
|
+
* @typedef {String} SidechatCursorString
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A vote on a comment or post
|
|
120
|
+
* @typedef {"upvote"|"downvote"|"none"} SidechatVoteString
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* A user's bearer authentication token needed for most requests
|
|
125
|
+
* @typedef {String} SidechatAuthToken
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* A list of posts and the associated cursor
|
|
130
|
+
* @typedef {Object} SidechatPostsAndCursor
|
|
131
|
+
* @prop {SidechatPostOrComment[]} posts
|
|
132
|
+
* @prop {SidechatCursorString} cursor
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
var SidechatTypes = {};
|
|
136
|
+
|
|
5
137
|
/**
|
|
6
138
|
* Throwable error caused by the Sidechat API
|
|
7
139
|
* @class
|
|
@@ -651,6 +783,7 @@ class SidechatAPIClient {
|
|
|
651
783
|
* @param {String} [replyCommentID] - alphanumeric ID of comment to reply to. Falls back to parentPostID
|
|
652
784
|
* @param {SidechatSimpleAsset[]} [assetList] - list of assets to attach
|
|
653
785
|
* @param {Boolean} [disableDMs] - prevent direct messages being sent to comment's author
|
|
786
|
+
* @param {Boolean} [anonymous] - whether or not to hide user's name and icon on comment
|
|
654
787
|
* @returns {SidechatPostOrComment} created comment
|
|
655
788
|
*/
|
|
656
789
|
createComment = async (
|
|
@@ -659,7 +792,8 @@ class SidechatAPIClient {
|
|
|
659
792
|
groupID,
|
|
660
793
|
replyCommentID = parentPostID,
|
|
661
794
|
assetList = [],
|
|
662
|
-
disableDMs = false
|
|
795
|
+
disableDMs = false,
|
|
796
|
+
anonymous = false
|
|
663
797
|
) => {
|
|
664
798
|
if (!this.userToken) {
|
|
665
799
|
throw new SidechatAPIError("User is not authenticated.");
|
|
@@ -679,6 +813,7 @@ class SidechatAPIClient {
|
|
|
679
813
|
reply_post_id: replyCommentID,
|
|
680
814
|
parent_post_id: parentPostID,
|
|
681
815
|
dms_disabled: disableDMs,
|
|
816
|
+
using_identity: !anonymous,
|
|
682
817
|
}),
|
|
683
818
|
});
|
|
684
819
|
const json = await res.json();
|
|
@@ -1041,3 +1176,4 @@ class SidechatColorList {
|
|
|
1041
1176
|
exports.SidechatAPIClient = SidechatAPIClient;
|
|
1042
1177
|
exports.SidechatAPIError = SidechatAPIError;
|
|
1043
1178
|
exports.SidechatColorList = SidechatColorList;
|
|
1179
|
+
exports.SidechatTypes = SidechatTypes;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
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
|
-
|
|
4
|
+
import SidechatTypes from "./types/SidechatTypes.js";
|
|
5
|
+
export { SidechatAPIClient, SidechatAPIError, SidechatColorList, SidechatTypes };
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
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
|
-
|
|
4
|
+
import SidechatTypes from "./types/SidechatTypes.js";
|
|
5
|
+
export { SidechatAPIClient, SidechatAPIError, SidechatColorList, SidechatTypes };
|
|
5
6
|
//# 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;8BAC9B,gCAAgC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"8BAC8B,gCAAgC;6BACjC,+BAA+B;8BAC9B,gCAAgC;0BAHpC,0BAA0B"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A user-created post or comment, depending on the "type" prop
|
|
3
|
+
* @typedef {Object} SidechatPostOrComment
|
|
4
|
+
* @prop {"post"|"comment"} type - whether this object represents a post or a comment on a post
|
|
5
|
+
* @prop {String} id - alphanumeric ID of post or comment
|
|
6
|
+
* @prop {Boolean} authored_by_user - undocumented
|
|
7
|
+
* @prop {String} alias - post creator's name in-app
|
|
8
|
+
* @prop {String} group_id - alphanumeric ID of group
|
|
9
|
+
* @prop {SidechatGroup} group - group in which post or comment was created
|
|
10
|
+
* @prop {String} text - text content of post or comment
|
|
11
|
+
* @prop {String} created_at - date string of post or comment creation time
|
|
12
|
+
* @prop {Number} vote_total - sum of upvotes and downvotes
|
|
13
|
+
* @prop {SidechatVoteString} vote_status - current user's vote on post or comment
|
|
14
|
+
* @prop {SidechatSimpleAsset[]} assets - array of simple assets attached to post or comment
|
|
15
|
+
* @prop {Array} attachments - undocumented
|
|
16
|
+
* @prop {Boolean} dms_disabled - whether or not you can send a DM to creator of post
|
|
17
|
+
* @prop {Array} tags - undocumented
|
|
18
|
+
* @prop {SidechatIdentity} identity - creator's identity information
|
|
19
|
+
* @prop {Boolean} pinned - undocumented
|
|
20
|
+
* @prop {Boolean} is_saved - undocumented
|
|
21
|
+
* @prop {"following"|"not_following"} follow_status - undocumented
|
|
22
|
+
* @prop {"group"} [destination] - undocumented
|
|
23
|
+
* @prop {Number} [comment_count] - number of comments on post (only if type=post)
|
|
24
|
+
* @prop {Boolean} [comments_disabled] - whether or not you can comment on post (only if type=post)
|
|
25
|
+
* @prop {String} [parent_post_id] - alphanumeric ID of parent post (only if type=comment)
|
|
26
|
+
* @prop {String} [reply_post_id] - alphanumeric ID of comment being replied to, falls back to parent_post_id (only if type=comment)
|
|
27
|
+
* @prop {String} [context] - text content of comment being replied to, falls back to text (only if type=comment)
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A group object, containing metadata about a group as well as its join conditions and states. Some properties vary based on the endpoint the object came from.
|
|
32
|
+
* @typedef {Object} SidechatGroup
|
|
33
|
+
* @prop {String} id - alphanumeric ID of group
|
|
34
|
+
* @prop {String} name - human-readable name of group
|
|
35
|
+
* @prop {String} analytics_name - name to file group under
|
|
36
|
+
* @prop {"non_member"|"member"} membership_type - whether or not current user is a member of group
|
|
37
|
+
* @prop {String} color - group's theme color as hex code (e.g., #FFFFFF)
|
|
38
|
+
* @prop {"open"|"closed"|"email_domain"} group_join_type - basis on which group accepts new members
|
|
39
|
+
* @prop {"private"|"public_to_all"|"public_to_schools"} group_visibility - group's visibility setting
|
|
40
|
+
* @prop {"show"|"hide"} asset_library_visibility - whether or not group's asset library is visible
|
|
41
|
+
* @prop {Array} [roles] - undocumented
|
|
42
|
+
* @prop {String} [description] - description of group
|
|
43
|
+
* @prop {SidechatPrivateAssetURL} [icon_url] - image URL for group icon
|
|
44
|
+
* @prop {Number} [member_count] - number of users in group
|
|
45
|
+
* @prop {Boolean} [should_show_leaderboard] - undocumented
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* An asset object, containing information about an image within a post or comment
|
|
50
|
+
* @typedef {Object} SidechatSimpleAsset
|
|
51
|
+
* @prop {String} id - alphanumeric ID of asset
|
|
52
|
+
* @prop {"image"} type - undocumented
|
|
53
|
+
* @prop {"jpeg"|"png"|"gif"} content_type - file type of asset
|
|
54
|
+
* @prop {Number} width - width of asset
|
|
55
|
+
* @prop {Number} height - height of asset
|
|
56
|
+
* @prop {SidechatPrivateAssetURL} [url] - URL string of asset's location
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* An asset object, containing information about an image from the asset library
|
|
61
|
+
* @typedef {Object} SidechatLibraryAsset
|
|
62
|
+
* @prop {String} id - alphanumeric ID of asset
|
|
63
|
+
* @prop {String} created_at - date string of asset creation time
|
|
64
|
+
* @prop {SidechatAssetMetadata} metadata - metadata associated with asset
|
|
65
|
+
* @prop {SidechatPrivateAssetURL} url - URL string of asset's location
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* An asset object, containing information about an image from the asset library
|
|
70
|
+
* @typedef {Object} SidechatAssetMetadata
|
|
71
|
+
* @prop {Number} width - width of asset
|
|
72
|
+
* @prop {Number} height - height of asset
|
|
73
|
+
* @prop {"image"} type - undocumented
|
|
74
|
+
* @prop {"jpeg"|"png"|"gif"} content_type - file type of asset
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* A user's anonymous identity information
|
|
79
|
+
* @typedef {Object} SidechatIdentity
|
|
80
|
+
* @prop {String} name - representation of user's name (varies across app)
|
|
81
|
+
* @prop {Boolean} posted_with_username - undocumented
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The current user's information
|
|
86
|
+
* @typedef {Object} SidechatCurrentUser
|
|
87
|
+
* @prop {String} id - alphanumeric ID of current user
|
|
88
|
+
* @prop {String} hashedVerifiedEmail - verified email of current user in an unreadable hashed form
|
|
89
|
+
* @prop {Boolean} isGlobalModerator - whether or not user is a moderator
|
|
90
|
+
* @prop {Boolean} isGlobalAdmin - whether or not user is an admin
|
|
91
|
+
* @prop {SidechatMembership[]} memberships
|
|
92
|
+
* @prop {Array} roles - undocumented
|
|
93
|
+
* @prop {String} emailDomain - domain of verified email address on account
|
|
94
|
+
* @prop {String} wildcardEmailDomain - domain of verified email address on account, preceeded by *. to support subdomains
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Representation of a group membership
|
|
99
|
+
* @typedef {Object} SidechatMembership
|
|
100
|
+
* @prop {String} groupId - alphanumeric ID of group
|
|
101
|
+
* @prop {String} type - role of current user in group
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* An asset URL that can only be accessed by making a request with a user's bearer token attached in the Authorization header
|
|
106
|
+
* @typedef {String} SidechatPrivateAssetURL
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* A cursor for paginating through post lists
|
|
111
|
+
* @typedef {String} SidechatCursorString
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* A vote on a comment or post
|
|
116
|
+
* @typedef {"upvote"|"downvote"|"none"} SidechatVoteString
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* A user's bearer authentication token needed for most requests
|
|
121
|
+
* @typedef {String} SidechatAuthToken
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* A list of posts and the associated cursor
|
|
126
|
+
* @typedef {Object} SidechatPostsAndCursor
|
|
127
|
+
* @prop {SidechatPostOrComment[]} posts
|
|
128
|
+
* @prop {SidechatCursorString} cursor
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
var SidechatTypes = {};
|
|
132
|
+
|
|
1
133
|
/**
|
|
2
134
|
* Throwable error caused by the Sidechat API
|
|
3
135
|
* @class
|
|
@@ -647,6 +779,7 @@ class SidechatAPIClient {
|
|
|
647
779
|
* @param {String} [replyCommentID] - alphanumeric ID of comment to reply to. Falls back to parentPostID
|
|
648
780
|
* @param {SidechatSimpleAsset[]} [assetList] - list of assets to attach
|
|
649
781
|
* @param {Boolean} [disableDMs] - prevent direct messages being sent to comment's author
|
|
782
|
+
* @param {Boolean} [anonymous] - whether or not to hide user's name and icon on comment
|
|
650
783
|
* @returns {SidechatPostOrComment} created comment
|
|
651
784
|
*/
|
|
652
785
|
createComment = async (
|
|
@@ -655,7 +788,8 @@ class SidechatAPIClient {
|
|
|
655
788
|
groupID,
|
|
656
789
|
replyCommentID = parentPostID,
|
|
657
790
|
assetList = [],
|
|
658
|
-
disableDMs = false
|
|
791
|
+
disableDMs = false,
|
|
792
|
+
anonymous = false
|
|
659
793
|
) => {
|
|
660
794
|
if (!this.userToken) {
|
|
661
795
|
throw new SidechatAPIError("User is not authenticated.");
|
|
@@ -675,6 +809,7 @@ class SidechatAPIClient {
|
|
|
675
809
|
reply_post_id: replyCommentID,
|
|
676
810
|
parent_post_id: parentPostID,
|
|
677
811
|
dms_disabled: disableDMs,
|
|
812
|
+
using_identity: !anonymous,
|
|
678
813
|
}),
|
|
679
814
|
});
|
|
680
815
|
const json = await res.json();
|
|
@@ -1034,4 +1169,4 @@ class SidechatColorList {
|
|
|
1034
1169
|
];
|
|
1035
1170
|
}
|
|
1036
1171
|
|
|
1037
|
-
export { SidechatAPIClient, SidechatAPIError, SidechatColorList };
|
|
1172
|
+
export { SidechatAPIClient, SidechatAPIError, SidechatColorList, SidechatTypes };
|
package/package.json
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "sidechat.js",
|
|
3
|
-
"version": "2.4.
|
|
4
|
-
"description": "A reverse-engineered API wrapper for Sidechat",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"source": "./src/index.js",
|
|
7
|
-
"main": "./dist/index.cjs",
|
|
8
|
-
"module": "./dist/index.mjs",
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"import": {
|
|
13
|
-
"types": "./dist/index.d.mts",
|
|
14
|
-
"default": "./dist/index.mjs"
|
|
15
|
-
},
|
|
16
|
-
"require": {
|
|
17
|
-
"types": "./dist/index.d.ts",
|
|
18
|
-
"default": "./dist/index.cjs"
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"./src/types": {
|
|
22
|
-
"types": "./dist/types/SidechatTypes.d.ts",
|
|
23
|
-
"default": "./src/types/SidechatTypes.js"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "rollup -c",
|
|
28
|
-
"dev": "rollup -c --watch",
|
|
29
|
-
"docs": "jsdoc --configure jsdoc.json --verbose",
|
|
30
|
-
"prepublish": "tsc",
|
|
31
|
-
"typegen": "tsc"
|
|
32
|
-
},
|
|
33
|
-
"repository": {
|
|
34
|
-
"type": "git",
|
|
35
|
-
"url": "git+https://github.com/micahlt/sidechat.js.git"
|
|
36
|
-
},
|
|
37
|
-
"author": "Micah Lindley",
|
|
38
|
-
"license": "MIT",
|
|
39
|
-
"bugs": {
|
|
40
|
-
"url": "https://github.com/micahlt/sidechat.js/issues"
|
|
41
|
-
},
|
|
42
|
-
"homepage": "https://github.com/micahlt/sidechat.js#readme",
|
|
43
|
-
"engines": {
|
|
44
|
-
"node": ">=18.0.0"
|
|
45
|
-
},
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"clean-jsdoc-theme": "^4.2.
|
|
48
|
-
"dotenv": "^16.4.5",
|
|
49
|
-
"prompt-sync": "^4.2.0",
|
|
50
|
-
"rollup": "^2.79.1",
|
|
51
|
-
"rollup-plugin-copy": "^3.5.0",
|
|
52
|
-
"typescript": "^5.4.
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "sidechat.js",
|
|
3
|
+
"version": "2.4.2",
|
|
4
|
+
"description": "A reverse-engineered API wrapper for Sidechat",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"source": "./src/index.js",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.mjs",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.mts",
|
|
14
|
+
"default": "./dist/index.mjs"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./src/types": {
|
|
22
|
+
"types": "./dist/types/SidechatTypes.d.ts",
|
|
23
|
+
"default": "./src/types/SidechatTypes.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "rollup -c",
|
|
28
|
+
"dev": "rollup -c --watch",
|
|
29
|
+
"docs": "jsdoc --configure jsdoc.json --verbose",
|
|
30
|
+
"prepublish": "tsc",
|
|
31
|
+
"typegen": "tsc"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/micahlt/sidechat.js.git"
|
|
36
|
+
},
|
|
37
|
+
"author": "Micah Lindley",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/micahlt/sidechat.js/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/micahlt/sidechat.js#readme",
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18.0.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"clean-jsdoc-theme": "^4.2.18",
|
|
48
|
+
"dotenv": "^16.4.5",
|
|
49
|
+
"prompt-sync": "^4.2.0",
|
|
50
|
+
"rollup": "^2.79.1",
|
|
51
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
52
|
+
"typescript": "^5.4.5"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -638,6 +638,7 @@ class SidechatAPIClient {
|
|
|
638
638
|
* @param {String} [replyCommentID] - alphanumeric ID of comment to reply to. Falls back to parentPostID
|
|
639
639
|
* @param {SidechatSimpleAsset[]} [assetList] - list of assets to attach
|
|
640
640
|
* @param {Boolean} [disableDMs] - prevent direct messages being sent to comment's author
|
|
641
|
+
* @param {Boolean} [anonymous] - whether or not to hide user's name and icon on comment
|
|
641
642
|
* @returns {SidechatPostOrComment} created comment
|
|
642
643
|
*/
|
|
643
644
|
createComment = async (
|
|
@@ -646,7 +647,8 @@ class SidechatAPIClient {
|
|
|
646
647
|
groupID,
|
|
647
648
|
replyCommentID = parentPostID,
|
|
648
649
|
assetList = [],
|
|
649
|
-
disableDMs = false
|
|
650
|
+
disableDMs = false,
|
|
651
|
+
anonymous = false
|
|
650
652
|
) => {
|
|
651
653
|
if (!this.userToken) {
|
|
652
654
|
throw new SidechatAPIError("User is not authenticated.");
|
|
@@ -666,6 +668,7 @@ class SidechatAPIClient {
|
|
|
666
668
|
reply_post_id: replyCommentID,
|
|
667
669
|
parent_post_id: parentPostID,
|
|
668
670
|
dms_disabled: disableDMs,
|
|
671
|
+
using_identity: !anonymous,
|
|
669
672
|
}),
|
|
670
673
|
});
|
|
671
674
|
const json = await res.json();
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import "./types/SidechatTypes.js";
|
|
1
|
+
import SidechatTypes from "./types/SidechatTypes.js";
|
|
2
2
|
import SidechatAPIClient from "./classes/SidechatAPIClient.js";
|
|
3
3
|
import SidechatAPIError from "./classes/SidechatAPIError.js";
|
|
4
4
|
import SidechatColorList from "./classes/SidechatColorList.js";
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export {
|
|
7
|
+
SidechatAPIClient,
|
|
8
|
+
SidechatAPIError,
|
|
9
|
+
SidechatColorList,
|
|
10
|
+
SidechatTypes,
|
|
11
|
+
};
|