sidechat.js 2.0.0 → 2.0.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.
@@ -0,0 +1,104 @@
1
+ export default SidechatAPIClient;
2
+ /**
3
+ * API client class for making requests to Sidechat's private API. You'll need to [authenticate]{@tutorial Authentication} before using most of the methods.
4
+ * @class
5
+ * @since 2.0.0-alpha.0
6
+ */
7
+ declare class SidechatAPIClient {
8
+ /**
9
+ * Create a new instance of the API client
10
+ * @param {SidechatAuthToken} [token] - user bearer token
11
+ */
12
+ constructor(token?: SidechatAuthToken);
13
+ /**
14
+ * User bearer token
15
+ * @type {SidechatAuthToken}
16
+ * */
17
+ userToken: SidechatAuthToken;
18
+ /**
19
+ * Default headers for every API request
20
+ * @type {Object}
21
+ * @static
22
+ */
23
+ defaultHeaders: any;
24
+ /**
25
+ * Manually set the currently signed in user's token. Generally try to avoid this and instead either pass a token to the constructor or login automatically through the auth functions
26
+ * @method
27
+ * @param {SidechatAuthToken} token - user bearer token
28
+ */
29
+ setToken: (token: SidechatAuthToken) => void;
30
+ /**
31
+ * Initiate the login process with a phone number. Should be followed up with verifySMSCode().
32
+ * @method
33
+ * @param {Number} phoneNumber - US phone number (WITHOUT +1) to send verification code to
34
+ */
35
+ loginViaSMS: (phoneNumber: number) => Promise<any>;
36
+ /**
37
+ * Verify the code sent via SMS with loginViaSMS().
38
+ * @method
39
+ * @param {Number} phoneNumber - US phone number (WITHOUT +1) that verification code was sent to
40
+ * @param {String} code - the verification code
41
+ */
42
+ verifySMSCode: (phoneNumber: number, code: string) => Promise<any>;
43
+ /**
44
+ * Set the user's age
45
+ * @method
46
+ * @param {Number} age - user's age in years
47
+ * @param {String} registrationID - the registration ID generated by verifySMSCode()
48
+ */
49
+ setAge: (age: number, registrationID: string) => Promise<any>;
50
+ /**
51
+ * Initiate the email setup process. Should be followed up with checkEmailVerification().
52
+ * @method
53
+ * @param {String} email - school email address to send verification code to
54
+ * @tutorial Email Registration
55
+ */
56
+ registerEmail: (email: string) => Promise<any>;
57
+ /**
58
+ * Check is the user's email is verified.
59
+ * @method
60
+ */
61
+ checkEmailVerification: () => Promise<any>;
62
+ /**
63
+ * Set the device ID of the current user
64
+ * @method
65
+ * @param {String} deviceId - the device ID to set
66
+ */
67
+ setDeviceID: (deviceID: any) => Promise<any>;
68
+ /**
69
+ * Get updated status for user and group
70
+ * @method
71
+ * @param {String} [groupID] - ID of a specific group to retrieve info from
72
+ */
73
+ getUserAndGroup: (groupID?: string) => Promise<any>;
74
+ /**
75
+ * Fetches posts from the specified category in a group
76
+ * @method
77
+ * @param {String} groupID - group ID
78
+ * @param {"hot"|"recent"|"top"} category - category to filter posts
79
+ * @param {SidechatCursorString} [cursor] - cursor string
80
+ * @returns {SidechatPostsAndCursor} List of posts and cursor
81
+ */
82
+ getGroupPosts: (groupID: string, category?: "hot" | "recent" | "top", cursor?: SidechatCursorString) => SidechatPostsAndCursor;
83
+ /**
84
+ * Upvote or downvote, or unvote a post
85
+ * @method
86
+ * @param {String} postID - post ID to vote on
87
+ * @param {SidechatVoteString} action - whether to upvote, downvote, or reset vote
88
+ */
89
+ setVote: (postID: string, action: SidechatVoteString) => Promise<any>;
90
+ /**
91
+ * Get all the commments on a post
92
+ * @method
93
+ * @param {String} postID - post ID to get comments for
94
+ * @returns {SidechatPostOrComment[]} list of comments
95
+ */
96
+ getPostComments: (postID: string) => SidechatPostOrComment[];
97
+ /**
98
+ * Gets groups to be displayed on the "Explore Groups" page
99
+ * @method
100
+ * @returns {SidechatGroup[]}
101
+ */
102
+ getAvailableGroups: () => SidechatGroup[];
103
+ }
104
+ //# sourceMappingURL=SidechatAPIClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidechatAPIClient.d.ts","sourceRoot":"","sources":["../../src/classes/SidechatAPIClient.js"],"names":[],"mappings":";AAGA;;;;GAIG;AACH;IAgBE;;;OAGG;IACH,oBAFW,iBAAiB,EAM3B;IAvBD;;;SAGK;IACL,WAFU,iBAAiB,CAEjB;IACV;;;;OAIG;IACH,oBAGE;IAYF;;;;OAIG;IACH,kBAFW,iBAAiB,UAI1B;IAEF;;;;OAIG;IACH,mDAgBE;IAEF;;;;;OAKG;IACH,mEAsBE;IAEF;;;;;OAKG;IACH,8DAyBE;IAEF;;;;;OAKG;IACH,+CA2BE;IAEF;;;OAGG;IACH,2CAyBE;IAEF;;;;OAIG;IACH,6CA2BE;IAEF;;;;OAIG;IACH,oDAqBE;IAEF;;;;;;;OAOG;IACH,4CAJW,KAAK,GAAC,QAAQ,GAAC,KAAK,WACpB,oBAAoB,KAClB,sBAAsB,CAyBjC;IAEF;;;;;OAKG;IACH,kCAFW,kBAAkB,kBAwB3B;IAEF;;;;;OAKG;IACH,qCAFa,qBAAqB,EAAE,CAqElC;IAEF;;;;OAIG;IACH,0BAFa,aAAa,EAAE,CAoB1B;CACH"}
@@ -0,0 +1,10 @@
1
+ export default SidechatAPIError;
2
+ /**
3
+ * Throwable error caused by the Sidechat API
4
+ * @class
5
+ * @extends Error
6
+ */
7
+ declare class SidechatAPIError extends Error {
8
+ constructor(message: any);
9
+ }
10
+ //# sourceMappingURL=SidechatAPIError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidechatAPIError.d.ts","sourceRoot":"","sources":["../../src/classes/SidechatAPIError.js"],"names":[],"mappings":";AAAA;;;;GAIG;AACH;IACE,0BAGC;CACF"}
@@ -0,0 +1,4 @@
1
+ import SidechatAPIClient from "./classes/SidechatAPIClient.js";
2
+ import SidechatAPIError from "./classes/SidechatAPIError.js";
3
+ export { SidechatAPIClient, SidechatAPIError };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"8BAA8B,gCAAgC;6BACjC,+BAA+B"}
@@ -0,0 +1,224 @@
1
+ /**
2
+ * A user-created post or comment, depending on the "type" prop
3
+ */
4
+ type SidechatPostOrComment = {
5
+ /**
6
+ * - whether this object represents a post or a comment on a post
7
+ */
8
+ type: "post" | "comment";
9
+ /**
10
+ * - alphanumeric ID of post or comment
11
+ */
12
+ id: string;
13
+ /**
14
+ * - undocumented
15
+ */
16
+ authored_by_user: boolean;
17
+ /**
18
+ * - post creator's name in-app
19
+ */
20
+ alias: string;
21
+ /**
22
+ * - alphanumeric ID of group
23
+ */
24
+ group_id: string;
25
+ /**
26
+ * - group in which post or comment was created
27
+ */
28
+ group: SidechatGroup;
29
+ /**
30
+ * - text content of post or comment
31
+ */
32
+ text: string;
33
+ /**
34
+ * - date string of post or comment creation time
35
+ */
36
+ created_at: string;
37
+ /**
38
+ * - sum of upvotes and downvotes
39
+ */
40
+ vote_total: number;
41
+ /**
42
+ * - current user's vote on post or comment
43
+ */
44
+ vote_status: SidechatVoteString;
45
+ /**
46
+ * - array of assets attached to post or comment
47
+ */
48
+ assets: SidechatAsset[];
49
+ /**
50
+ * - undocumented
51
+ */
52
+ attachments: any[];
53
+ /**
54
+ * - whether or not you can send a DM to creator of post
55
+ */
56
+ dms_disabled: boolean;
57
+ /**
58
+ * - undocumented
59
+ */
60
+ tags: any[];
61
+ /**
62
+ * - creator's identity information
63
+ */
64
+ identity: SidechatIdentity;
65
+ /**
66
+ * - undocumented
67
+ */
68
+ pinned: boolean;
69
+ /**
70
+ * - undocumented
71
+ */
72
+ is_saved: boolean;
73
+ /**
74
+ * - undocumented
75
+ */
76
+ follow_status: "following" | "not_following";
77
+ /**
78
+ * - undocumented
79
+ */
80
+ destination?: "group";
81
+ /**
82
+ * - number of comments on post (only if type=post)
83
+ */
84
+ comment_count?: number;
85
+ /**
86
+ * - whether or not you can comment on post (only if type=post)
87
+ */
88
+ comments_disabled?: boolean;
89
+ /**
90
+ * - alphanumeric ID of parent post (only if type=comment)
91
+ */
92
+ parent_post_id?: string;
93
+ /**
94
+ * - alphanumeric ID of comment being replied to, falls back to parent_post_id (only if type=comment)
95
+ */
96
+ reply_post_id?: string;
97
+ /**
98
+ * - text content of comment being replied to, falls back to text (only if type=comment)
99
+ */
100
+ context?: string;
101
+ };
102
+ /**
103
+ * A group object, containing metadata about a group as well as its join conditions and states
104
+ */
105
+ type SidechatGroup = {
106
+ /**
107
+ * - alphanumeric ID of group
108
+ */
109
+ id: string;
110
+ /**
111
+ * - human-readable name of group
112
+ */
113
+ name: string;
114
+ /**
115
+ * - name to file group under
116
+ */
117
+ analytics_name: string;
118
+ /**
119
+ * - whether or not current user is a member of group
120
+ */
121
+ membership_type: "non_member" | "member";
122
+ /**
123
+ * - group's theme color as hex code (e.g., #FFFFFF)
124
+ */
125
+ color: string;
126
+ /**
127
+ * - basis on which group accepts new members
128
+ */
129
+ group_join_type: "open" | "closed" | "email_domain";
130
+ /**
131
+ * - group's visibility setting
132
+ */
133
+ group_visibility: "private" | "public_to_all" | "public_to_schools";
134
+ /**
135
+ * - whether or not group's asset library is visible
136
+ */
137
+ asset_library_visibility: "show" | "hide";
138
+ /**
139
+ * - undocumented
140
+ */
141
+ roles?: any[];
142
+ /**
143
+ * - description of group
144
+ */
145
+ description?: string;
146
+ /**
147
+ * - image URL for group icon
148
+ */
149
+ icon_url?: SidechatPrivateAssetURL;
150
+ /**
151
+ * - number of users in group
152
+ */
153
+ member_count?: number;
154
+ /**
155
+ * - undocumented
156
+ */
157
+ should_show_leaderboard?: boolean;
158
+ };
159
+ /**
160
+ * An asset object, containing information about an image within a post or comment
161
+ */
162
+ type SidechatAsset = {
163
+ /**
164
+ * - alphanumeric ID of asset
165
+ */
166
+ id: string;
167
+ /**
168
+ * - undocumented
169
+ */
170
+ type: "image";
171
+ /**
172
+ * - file type of asset
173
+ */
174
+ content_type: "jpeg" | "png" | "gif";
175
+ /**
176
+ * - the width of asset
177
+ */
178
+ width: number;
179
+ /**
180
+ * - the height of asset
181
+ */
182
+ height: number;
183
+ /**
184
+ * - URL string of asset's location
185
+ */
186
+ url: SidechatPrivateAssetURL;
187
+ };
188
+ /**
189
+ * A user's identity information
190
+ */
191
+ type SidechatIdentity = {
192
+ /**
193
+ * - representation of user's name (varies across app)
194
+ */
195
+ name: string;
196
+ /**
197
+ * - undocumented
198
+ */
199
+ posted_with_username: boolean;
200
+ };
201
+ /**
202
+ * An asset URL that can only be accessed by making a request with a user's bearer token attached in the Authorization header
203
+ */
204
+ type SidechatPrivateAssetURL = string;
205
+ /**
206
+ * A cursor for paginating through post lists
207
+ */
208
+ type SidechatCursorString = string;
209
+ /**
210
+ * A vote on a comment or post
211
+ */
212
+ type SidechatVoteString = "upvote" | "downvote" | "none";
213
+ /**
214
+ * A user's bearer authentication token needed for most requests
215
+ */
216
+ type SidechatAuthToken = string;
217
+ /**
218
+ * A list of posts and the associated cursor
219
+ */
220
+ type SidechatPostsAndCursor = {
221
+ posts: SidechatPostOrComment[];
222
+ cursor: SidechatCursorString;
223
+ };
224
+ //# sourceMappingURL=SidechatTypes.d.ts.map
@@ -0,0 +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,aAAa,EAAE;;;;;;;;;;;;;;;;cAIf,gBAAgB;;;;;;;;;;;;mBAGhB,WAAW,GAAC,eAAe;;;;kBAC3B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAcP,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;;;;;;;;;;;;SAGlB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;0BAsBpB,QAAQ,GAAC,UAAU,GAAC,MAAM;;;;;;;;;WAW7B,qBAAqB,EAAE;YACvB,oBAAoB"}
package/package.json CHANGED
@@ -1,20 +1,23 @@
1
1
  {
2
2
  "name": "sidechat.js",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "A reverse-engineered API wrapper for Sidechat",
5
5
  "type": "module",
6
6
  "source": "./src/index.js",
7
+ "types": "./src/index.d.ts",
7
8
  "exports": {
8
- "require": "./dist/sidechat.cjs",
9
- "default": "./dist/sidechat.modern.js"
9
+ "default": "./dist/sidechat.modern.js",
10
+ "require": "./dist/sidechat.cjs"
10
11
  },
12
+ "unpkg": "./dist/sidechat.umd.js",
11
13
  "main": "./dist/sidechat.cjs",
12
14
  "module": "./dist/sidechat.module.js",
13
- "unpkg": "./dist/sidechat.umd.js",
14
15
  "scripts": {
15
16
  "build": "microbundle",
16
17
  "dev": "microbundle watch",
17
- "docs": "npx jsdoc --configure jsdoc.json --verbose"
18
+ "docs": "jsdoc --configure jsdoc.json --verbose",
19
+ "prepublish": "tsc",
20
+ "typegen": "tsc"
18
21
  },
19
22
  "repository": {
20
23
  "type": "git",
@@ -32,6 +35,10 @@
32
35
  "devDependencies": {
33
36
  "clean-jsdoc-theme": "^4.2.17",
34
37
  "microbundle": "^0.15.1",
35
- "prompt-sync": "^4.2.0"
38
+ "prompt-sync": "^4.2.0",
39
+ "typescript": "^5.4.2"
40
+ },
41
+ "dependencies": {
42
+ "tsd-jsdoc": "^2.5.0"
36
43
  }
37
44
  }
@@ -0,0 +1,104 @@
1
+ export default SidechatAPIClient;
2
+ /**
3
+ * API client class for making requests to Sidechat's private API. You'll need to [authenticate]{@tutorial Authentication} before using most of the methods.
4
+ * @class
5
+ * @since 2.0.0-alpha.0
6
+ */
7
+ declare class SidechatAPIClient {
8
+ /**
9
+ * Create a new instance of the API client
10
+ * @param {SidechatAuthToken} [token] - user bearer token
11
+ */
12
+ constructor(token?: SidechatAuthToken);
13
+ /**
14
+ * User bearer token
15
+ * @type {SidechatAuthToken}
16
+ * */
17
+ userToken: SidechatAuthToken;
18
+ /**
19
+ * Default headers for every API request
20
+ * @type {Object}
21
+ * @static
22
+ */
23
+ defaultHeaders: any;
24
+ /**
25
+ * Manually set the currently signed in user's token. Generally try to avoid this and instead either pass a token to the constructor or login automatically through the auth functions
26
+ * @method
27
+ * @param {SidechatAuthToken} token - user bearer token
28
+ */
29
+ setToken: (token: SidechatAuthToken) => void;
30
+ /**
31
+ * Initiate the login process with a phone number. Should be followed up with verifySMSCode().
32
+ * @method
33
+ * @param {Number} phoneNumber - US phone number (WITHOUT +1) to send verification code to
34
+ */
35
+ loginViaSMS: (phoneNumber: number) => Promise<any>;
36
+ /**
37
+ * Verify the code sent via SMS with loginViaSMS().
38
+ * @method
39
+ * @param {Number} phoneNumber - US phone number (WITHOUT +1) that verification code was sent to
40
+ * @param {String} code - the verification code
41
+ */
42
+ verifySMSCode: (phoneNumber: number, code: string) => Promise<any>;
43
+ /**
44
+ * Set the user's age
45
+ * @method
46
+ * @param {Number} age - user's age in years
47
+ * @param {String} registrationID - the registration ID generated by verifySMSCode()
48
+ */
49
+ setAge: (age: number, registrationID: string) => Promise<any>;
50
+ /**
51
+ * Initiate the email setup process. Should be followed up with checkEmailVerification().
52
+ * @method
53
+ * @param {String} email - school email address to send verification code to
54
+ * @tutorial Email Registration
55
+ */
56
+ registerEmail: (email: string) => Promise<any>;
57
+ /**
58
+ * Check is the user's email is verified.
59
+ * @method
60
+ */
61
+ checkEmailVerification: () => Promise<any>;
62
+ /**
63
+ * Set the device ID of the current user
64
+ * @method
65
+ * @param {String} deviceId - the device ID to set
66
+ */
67
+ setDeviceID: (deviceID: any) => Promise<any>;
68
+ /**
69
+ * Get updated status for user and group
70
+ * @method
71
+ * @param {String} [groupID] - ID of a specific group to retrieve info from
72
+ */
73
+ getUserAndGroup: (groupID?: string) => Promise<any>;
74
+ /**
75
+ * Fetches posts from the specified category in a group
76
+ * @method
77
+ * @param {String} groupID - group ID
78
+ * @param {"hot"|"recent"|"top"} category - category to filter posts
79
+ * @param {SidechatCursorString} [cursor] - cursor string
80
+ * @returns {SidechatPostsAndCursor} List of posts and cursor
81
+ */
82
+ getGroupPosts: (groupID: string, category?: "hot" | "recent" | "top", cursor?: SidechatCursorString) => SidechatPostsAndCursor;
83
+ /**
84
+ * Upvote or downvote, or unvote a post
85
+ * @method
86
+ * @param {String} postID - post ID to vote on
87
+ * @param {SidechatVoteString} action - whether to upvote, downvote, or reset vote
88
+ */
89
+ setVote: (postID: string, action: SidechatVoteString) => Promise<any>;
90
+ /**
91
+ * Get all the commments on a post
92
+ * @method
93
+ * @param {String} postID - post ID to get comments for
94
+ * @returns {SidechatPostOrComment[]} list of comments
95
+ */
96
+ getPostComments: (postID: string) => SidechatPostOrComment[];
97
+ /**
98
+ * Gets groups to be displayed on the "Explore Groups" page
99
+ * @method
100
+ * @returns {SidechatGroup[]}
101
+ */
102
+ getAvailableGroups: () => SidechatGroup[];
103
+ }
104
+ //# sourceMappingURL=SidechatAPIClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidechatAPIClient.d.ts","sourceRoot":"","sources":["SidechatAPIClient.js"],"names":[],"mappings":";AAGA;;;;GAIG;AACH;IAgBE;;;OAGG;IACH,oBAFW,iBAAiB,EAM3B;IAvBD;;;SAGK;IACL,WAFU,iBAAiB,CAEjB;IACV;;;;OAIG;IACH,oBAGE;IAYF;;;;OAIG;IACH,kBAFW,iBAAiB,UAI1B;IAEF;;;;OAIG;IACH,mDAgBE;IAEF;;;;;OAKG;IACH,mEAsBE;IAEF;;;;;OAKG;IACH,8DAyBE;IAEF;;;;;OAKG;IACH,+CA2BE;IAEF;;;OAGG;IACH,2CAyBE;IAEF;;;;OAIG;IACH,6CA2BE;IAEF;;;;OAIG;IACH,oDAqBE;IAEF;;;;;;;OAOG;IACH,4CAJW,KAAK,GAAC,QAAQ,GAAC,KAAK,WACpB,oBAAoB,KAClB,sBAAsB,CAyBjC;IAEF;;;;;OAKG;IACH,kCAFW,kBAAkB,kBAwB3B;IAEF;;;;;OAKG;IACH,qCAFa,qBAAqB,EAAE,CAqElC;IAEF;;;;OAIG;IACH,0BAFa,aAAa,EAAE,CAoB1B;CACH"}
@@ -0,0 +1,10 @@
1
+ export default SidechatAPIError;
2
+ /**
3
+ * Throwable error caused by the Sidechat API
4
+ * @class
5
+ * @extends Error
6
+ */
7
+ declare class SidechatAPIError extends Error {
8
+ constructor(message: any);
9
+ }
10
+ //# sourceMappingURL=SidechatAPIError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidechatAPIError.d.ts","sourceRoot":"","sources":["SidechatAPIError.js"],"names":[],"mappings":";AAAA;;;;GAIG;AACH;IACE,0BAGC;CACF"}
package/src/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import SidechatAPIClient from "./classes/SidechatAPIClient.js";
2
+ import SidechatAPIError from "./classes/SidechatAPIError.js";
3
+ export { SidechatAPIClient, SidechatAPIError };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"8BAC8B,gCAAgC;6BACjC,+BAA+B"}
package/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "./types/SidechatTypes";
1
2
  import SidechatAPIClient from "./classes/SidechatAPIClient.js";
2
3
  import SidechatAPIError from "./classes/SidechatAPIError.js";
3
4
 
@@ -0,0 +1,224 @@
1
+ /**
2
+ * A user-created post or comment, depending on the "type" prop
3
+ */
4
+ type SidechatPostOrComment = {
5
+ /**
6
+ * - whether this object represents a post or a comment on a post
7
+ */
8
+ type: "post" | "comment";
9
+ /**
10
+ * - alphanumeric ID of post or comment
11
+ */
12
+ id: string;
13
+ /**
14
+ * - undocumented
15
+ */
16
+ authored_by_user: boolean;
17
+ /**
18
+ * - post creator's name in-app
19
+ */
20
+ alias: string;
21
+ /**
22
+ * - alphanumeric ID of group
23
+ */
24
+ group_id: string;
25
+ /**
26
+ * - group in which post or comment was created
27
+ */
28
+ group: SidechatGroup;
29
+ /**
30
+ * - text content of post or comment
31
+ */
32
+ text: string;
33
+ /**
34
+ * - date string of post or comment creation time
35
+ */
36
+ created_at: string;
37
+ /**
38
+ * - sum of upvotes and downvotes
39
+ */
40
+ vote_total: number;
41
+ /**
42
+ * - current user's vote on post or comment
43
+ */
44
+ vote_status: SidechatVoteString;
45
+ /**
46
+ * - array of assets attached to post or comment
47
+ */
48
+ assets: SidechatAsset[];
49
+ /**
50
+ * - undocumented
51
+ */
52
+ attachments: any[];
53
+ /**
54
+ * - whether or not you can send a DM to creator of post
55
+ */
56
+ dms_disabled: boolean;
57
+ /**
58
+ * - undocumented
59
+ */
60
+ tags: any[];
61
+ /**
62
+ * - creator's identity information
63
+ */
64
+ identity: SidechatIdentity;
65
+ /**
66
+ * - undocumented
67
+ */
68
+ pinned: boolean;
69
+ /**
70
+ * - undocumented
71
+ */
72
+ is_saved: boolean;
73
+ /**
74
+ * - undocumented
75
+ */
76
+ follow_status: "following" | "not_following";
77
+ /**
78
+ * - undocumented
79
+ */
80
+ destination?: "group";
81
+ /**
82
+ * - number of comments on post (only if type=post)
83
+ */
84
+ comment_count?: number;
85
+ /**
86
+ * - whether or not you can comment on post (only if type=post)
87
+ */
88
+ comments_disabled?: boolean;
89
+ /**
90
+ * - alphanumeric ID of parent post (only if type=comment)
91
+ */
92
+ parent_post_id?: string;
93
+ /**
94
+ * - alphanumeric ID of comment being replied to, falls back to parent_post_id (only if type=comment)
95
+ */
96
+ reply_post_id?: string;
97
+ /**
98
+ * - text content of comment being replied to, falls back to text (only if type=comment)
99
+ */
100
+ context?: string;
101
+ };
102
+ /**
103
+ * A group object, containing metadata about a group as well as its join conditions and states
104
+ */
105
+ type SidechatGroup = {
106
+ /**
107
+ * - alphanumeric ID of group
108
+ */
109
+ id: string;
110
+ /**
111
+ * - human-readable name of group
112
+ */
113
+ name: string;
114
+ /**
115
+ * - name to file group under
116
+ */
117
+ analytics_name: string;
118
+ /**
119
+ * - whether or not current user is a member of group
120
+ */
121
+ membership_type: "non_member" | "member";
122
+ /**
123
+ * - group's theme color as hex code (e.g., #FFFFFF)
124
+ */
125
+ color: string;
126
+ /**
127
+ * - basis on which group accepts new members
128
+ */
129
+ group_join_type: "open" | "closed" | "email_domain";
130
+ /**
131
+ * - group's visibility setting
132
+ */
133
+ group_visibility: "private" | "public_to_all" | "public_to_schools";
134
+ /**
135
+ * - whether or not group's asset library is visible
136
+ */
137
+ asset_library_visibility: "show" | "hide";
138
+ /**
139
+ * - undocumented
140
+ */
141
+ roles?: any[];
142
+ /**
143
+ * - description of group
144
+ */
145
+ description?: string;
146
+ /**
147
+ * - image URL for group icon
148
+ */
149
+ icon_url?: SidechatPrivateAssetURL;
150
+ /**
151
+ * - number of users in group
152
+ */
153
+ member_count?: number;
154
+ /**
155
+ * - undocumented
156
+ */
157
+ should_show_leaderboard?: boolean;
158
+ };
159
+ /**
160
+ * An asset object, containing information about an image within a post or comment
161
+ */
162
+ type SidechatAsset = {
163
+ /**
164
+ * - alphanumeric ID of asset
165
+ */
166
+ id: string;
167
+ /**
168
+ * - undocumented
169
+ */
170
+ type: "image";
171
+ /**
172
+ * - file type of asset
173
+ */
174
+ content_type: "jpeg" | "png" | "gif";
175
+ /**
176
+ * - the width of asset
177
+ */
178
+ width: number;
179
+ /**
180
+ * - the height of asset
181
+ */
182
+ height: number;
183
+ /**
184
+ * - URL string of asset's location
185
+ */
186
+ url: SidechatPrivateAssetURL;
187
+ };
188
+ /**
189
+ * A user's identity information
190
+ */
191
+ type SidechatIdentity = {
192
+ /**
193
+ * - representation of user's name (varies across app)
194
+ */
195
+ name: string;
196
+ /**
197
+ * - undocumented
198
+ */
199
+ posted_with_username: boolean;
200
+ };
201
+ /**
202
+ * An asset URL that can only be accessed by making a request with a user's bearer token attached in the Authorization header
203
+ */
204
+ type SidechatPrivateAssetURL = string;
205
+ /**
206
+ * A cursor for paginating through post lists
207
+ */
208
+ type SidechatCursorString = string;
209
+ /**
210
+ * A vote on a comment or post
211
+ */
212
+ type SidechatVoteString = "upvote" | "downvote" | "none";
213
+ /**
214
+ * A user's bearer authentication token needed for most requests
215
+ */
216
+ type SidechatAuthToken = string;
217
+ /**
218
+ * A list of posts and the associated cursor
219
+ */
220
+ type SidechatPostsAndCursor = {
221
+ posts: SidechatPostOrComment[];
222
+ cursor: SidechatCursorString;
223
+ };
224
+ //# sourceMappingURL=SidechatTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidechatTypes.d.ts","sourceRoot":"","sources":["SidechatTypes.js"],"names":[],"mappings":";;;;;;;UAGU,MAAM,GAAC,SAAS;;;;;;;;;;;;;;;;;;;;WAKhB,aAAa;;;;;;;;;;;;;;;;iBAIb,kBAAkB;;;;YAClB,aAAa,EAAE;;;;;;;;;;;;;;;;cAIf,gBAAgB;;;;;;;;;;;;mBAGhB,WAAW,GAAC,eAAe;;;;kBAC3B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAcP,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;;;;;;;;;;;;SAGlB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;0BAsBpB,QAAQ,GAAC,UAAU,GAAC,MAAM;;;;;;;;;WAW7B,qBAAqB,EAAE;YACvB,oBAAoB"}
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ // Change this to match your project
3
+ "include": ["src/*.js"],
4
+ "exclude": ["src/tests", "src/internal"],
5
+ "compilerOptions": {
6
+ // Tells TypeScript to read JS files, as
7
+ // normally they are ignored as source files
8
+ "allowJs": true,
9
+ // Generate d.ts files
10
+ "declaration": true,
11
+ // This compiler run should
12
+ // only output d.ts files
13
+ "emitDeclarationOnly": true,
14
+ // go to js file when using IDE functions like
15
+ // "Go to Definition" in VSCode
16
+ "declarationMap": true
17
+ }
18
+ }