emusks 0.0.3 → 2.0.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.
- package/README.md +4 -277
- package/build/graphql.js +24 -0
- package/build/v1.1.js +28 -0
- package/build/v2.js +28 -0
- package/package.json +16 -8
- package/src/clients.js +62 -0
- package/src/cycletls.js +26 -0
- package/src/flow.js +399 -0
- package/src/graphql.js +70 -0
- package/src/helpers/account.js +271 -0
- package/src/helpers/bookmarks.js +120 -0
- package/src/helpers/communities.js +271 -0
- package/src/helpers/dms.js +131 -0
- package/src/helpers/index.js +32 -0
- package/src/helpers/lists.js +229 -0
- package/src/helpers/media.js +274 -0
- package/src/helpers/notifications.js +49 -0
- package/src/helpers/search.js +129 -0
- package/src/helpers/spaces.js +55 -0
- package/src/helpers/syndication.js +33 -0
- package/src/helpers/timelines.js +84 -0
- package/src/helpers/topics.js +99 -0
- package/src/helpers/trends.js +86 -0
- package/src/helpers/tweets.js +403 -0
- package/src/helpers/users.js +321 -0
- package/src/index.js +125 -55
- package/src/parsers/timeline.js +105 -0
- package/src/static/graphql.js +1 -0
- package/src/static/v1.1.js +1 -0
- package/src/static/v2.js +1 -0
- package/src/v1.1.js +64 -0
- package/src/v2.js +64 -0
- package/src/methods/bookmarks.js +0 -91
- package/src/methods/follow.js +0 -88
- package/src/methods/like.js +0 -87
- package/src/methods/notifications.js +0 -121
- package/src/methods/retweet.js +0 -91
- package/src/methods/search.js +0 -124
- package/src/methods/timeline.js +0 -215
- package/src/methods/tweet.js +0 -396
- package/src/methods/users.js +0 -209
- package/src/utils/headers.js +0 -23
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import parseUser from "../parsers/user.js";
|
|
2
|
+
|
|
3
|
+
export default (client) => ({
|
|
4
|
+
async settings() {
|
|
5
|
+
const res = await client.v1_1("get:account/settings", {});
|
|
6
|
+
return await res.json();
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
async updateSettings(params = {}) {
|
|
10
|
+
const res = await client.v1_1("post:account/settings", {
|
|
11
|
+
body: JSON.stringify(params),
|
|
12
|
+
});
|
|
13
|
+
return await res.json();
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
async verifyPassword(password) {
|
|
17
|
+
const res = await client.v1_1("account/verify_password", {
|
|
18
|
+
body: `password=${encodeURIComponent(password)}`,
|
|
19
|
+
headers: { "content-type": "application/x-www-form-urlencoded" },
|
|
20
|
+
});
|
|
21
|
+
return await res.json();
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
async changePassword(currentPassword, newPassword) {
|
|
25
|
+
const res = await client.v1_1("account/change_password", {
|
|
26
|
+
body: JSON.stringify({
|
|
27
|
+
current_password: currentPassword,
|
|
28
|
+
password: newPassword,
|
|
29
|
+
password_confirmation: newPassword,
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
return await res.json();
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
async deactivate() {
|
|
36
|
+
const res = await client.v1_1("account/deactivate", {});
|
|
37
|
+
return await res.json();
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
async logout() {
|
|
41
|
+
const res = await client.v1_1("account/logout", {});
|
|
42
|
+
return await res.json();
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
async rateLimitStatus(params = {}) {
|
|
46
|
+
const res = await client.v1_1("application/rate_limit_status", { params });
|
|
47
|
+
return await res.json();
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
async viewer() {
|
|
51
|
+
const res = await client.graphql("Viewer", {
|
|
52
|
+
variables: { withCommunitiesMemberships: true },
|
|
53
|
+
fieldToggles: { withAuxiliaryUserLabels: false },
|
|
54
|
+
});
|
|
55
|
+
const user = res?.data?.viewer?.user_results?.result;
|
|
56
|
+
return user ? parseUser(user) : res;
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
async sessions() {
|
|
60
|
+
return await client.graphql("UserSessionsList", {
|
|
61
|
+
variables: {},
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
async preferences() {
|
|
66
|
+
return await client.graphql("UserPreferences", {
|
|
67
|
+
variables: {},
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
async claims() {
|
|
72
|
+
return await client.graphql("GetUserClaims", {
|
|
73
|
+
variables: {},
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
async phoneState() {
|
|
78
|
+
return await client.graphql("ProfileUserPhoneState", {
|
|
79
|
+
variables: {},
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
async passwordStrength(password) {
|
|
84
|
+
const res = await client.v1_1("account/password_strength", {
|
|
85
|
+
body: JSON.stringify({ password }),
|
|
86
|
+
});
|
|
87
|
+
return await res.json();
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
async resendConfirmationEmail() {
|
|
91
|
+
const res = await client.v1_1("account/resend_confirmation_email", {});
|
|
92
|
+
return await res.json();
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
async emailPhoneInfo(params = {}) {
|
|
96
|
+
const res = await client.v1_1("users/email_phone_info", { params });
|
|
97
|
+
return await res.json();
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
async emailAvailable(email) {
|
|
101
|
+
const res = await client.v1_1("users/email_available", {
|
|
102
|
+
params: { email },
|
|
103
|
+
});
|
|
104
|
+
return await res.json();
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
async phoneAvailable(phone) {
|
|
108
|
+
const res = await client.v1_1("users/phone_number_available", {
|
|
109
|
+
params: { phone_number: phone },
|
|
110
|
+
});
|
|
111
|
+
return await res.json();
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
async usernameAvailable(username) {
|
|
115
|
+
return await client.graphql("GetUsernameAvailabilityAndSuggestions", {
|
|
116
|
+
body: { variables: { username } },
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
async backupCode() {
|
|
121
|
+
const res = await client.v1_1("get:account/backup_code", {});
|
|
122
|
+
return await res.json();
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
async generateBackupCode() {
|
|
126
|
+
const res = await client.v1_1("post:account/backup_code", {});
|
|
127
|
+
return await res.json();
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
async disable2FA() {
|
|
131
|
+
const res = await client.v1_1("account/login_verification_enrollment", {});
|
|
132
|
+
return await res.json();
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
async remove2FAMethod(methodId) {
|
|
136
|
+
const res = await client.v1_1("account/login_verification/remove_method", {
|
|
137
|
+
body: JSON.stringify({ method_id: methodId }),
|
|
138
|
+
});
|
|
139
|
+
return await res.json();
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
async tempPassword() {
|
|
143
|
+
const res = await client.v1_1("account/login_verification/temporary_password", {});
|
|
144
|
+
return await res.json();
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
async renameSecurityKey(methodId, name) {
|
|
148
|
+
const res = await client.v1_1("account/login_verification/rename_security_key_method", {
|
|
149
|
+
body: JSON.stringify({ method_id: methodId, name }),
|
|
150
|
+
});
|
|
151
|
+
return await res.json();
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
async connectedApps() {
|
|
155
|
+
const res = await client.v1_1("oauth/list", {});
|
|
156
|
+
return await res.json();
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
async revokeApp(token) {
|
|
160
|
+
const res = await client.v1_1("oauth/revoke", {
|
|
161
|
+
body: JSON.stringify({ token }),
|
|
162
|
+
});
|
|
163
|
+
return await res.json();
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
async deleteSSOConnection(connectionId) {
|
|
167
|
+
const res = await client.v1_1("sso/delete_connection", {
|
|
168
|
+
body: JSON.stringify({ connection_id: connectionId }),
|
|
169
|
+
});
|
|
170
|
+
return await res.json();
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
async personalizationInterests() {
|
|
174
|
+
const res = await client.v1_1("account/personalization/twitter_interests", {});
|
|
175
|
+
return await res.json();
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
async emailYourData() {
|
|
179
|
+
const res = await client.v1_1("account/personalization/email_your_data", {});
|
|
180
|
+
return await res.json();
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
async multiList() {
|
|
184
|
+
const res = await client.v1_1("account/multi/list", {});
|
|
185
|
+
return await res.json();
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
async enableVerifiedPhoneLabel() {
|
|
189
|
+
return await client.graphql("EnableVerifiedPhoneLabel", {
|
|
190
|
+
body: { variables: {} },
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
async disableVerifiedPhoneLabel() {
|
|
195
|
+
return await client.graphql("DisableVerifiedPhoneLabel", {
|
|
196
|
+
body: { variables: {} },
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
async dataSaverMode() {
|
|
201
|
+
return await client.graphql("DataSaverMode", {
|
|
202
|
+
variables: {},
|
|
203
|
+
});
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
async setDataSaver(dataSaverMode) {
|
|
207
|
+
return await client.graphql("WriteDataSaverPreferences", {
|
|
208
|
+
body: { variables: { dataSaverMode } },
|
|
209
|
+
});
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
async mutedKeywords() {
|
|
213
|
+
const res = await client.v1_1("mutes/keywords/list", {});
|
|
214
|
+
return await res.json();
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
async deleteMutedKeyword(keywordId) {
|
|
218
|
+
const res = await client.v1_1("mutes/keywords/destroy", {
|
|
219
|
+
body: JSON.stringify({ ids: keywordId }),
|
|
220
|
+
});
|
|
221
|
+
return await res.json();
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
async updateMutedKeyword(params = {}) {
|
|
225
|
+
const res = await client.v1_1("mutes/keywords/update", {
|
|
226
|
+
body: JSON.stringify(params),
|
|
227
|
+
});
|
|
228
|
+
return await res.json();
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
async advancedFilters() {
|
|
232
|
+
const res = await client.v1_1("get:mutes/advanced_filters", {});
|
|
233
|
+
return await res.json();
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
async updateAdvancedFilters(params = {}) {
|
|
237
|
+
const res = await client.v1_1("post:mutes/advanced_filters", {
|
|
238
|
+
body: JSON.stringify(params),
|
|
239
|
+
});
|
|
240
|
+
return await res.json();
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
async helpSettings() {
|
|
244
|
+
const res = await client.v1_1("help/settings", {});
|
|
245
|
+
return await res.json();
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
async emailNotificationSettings(params = {}) {
|
|
249
|
+
return await client.graphql("WriteEmailNotificationSettings", {
|
|
250
|
+
body: { variables: { ...params } },
|
|
251
|
+
});
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
async viewerEmailSettings() {
|
|
255
|
+
return await client.graphql("ViewerEmailSettings", {
|
|
256
|
+
variables: {},
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
async accountLabel() {
|
|
261
|
+
return await client.graphql("UserAccountLabel", {
|
|
262
|
+
variables: {},
|
|
263
|
+
});
|
|
264
|
+
},
|
|
265
|
+
|
|
266
|
+
async disableAccountLabel() {
|
|
267
|
+
return await client.graphql("DisableUserAccountLabel", {
|
|
268
|
+
body: { variables: {} },
|
|
269
|
+
});
|
|
270
|
+
},
|
|
271
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import parseTimeline from "../parsers/timeline.js";
|
|
2
|
+
|
|
3
|
+
export default (client) => ({
|
|
4
|
+
async create(tweetId) {
|
|
5
|
+
return await client.graphql("CreateBookmark", {
|
|
6
|
+
body: { variables: { tweet_id: tweetId } },
|
|
7
|
+
});
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
async delete(tweetId) {
|
|
11
|
+
return await client.graphql("DeleteBookmark", {
|
|
12
|
+
body: { variables: { tweet_id: tweetId } },
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
async deleteAll() {
|
|
17
|
+
return await client.graphql("BookmarksAllDelete", {
|
|
18
|
+
body: { variables: {} },
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
async get(opts = {}) {
|
|
23
|
+
const raw = await client.graphql("Bookmarks", {
|
|
24
|
+
variables: {
|
|
25
|
+
count: opts.count || 20,
|
|
26
|
+
cursor: opts.cursor,
|
|
27
|
+
includePromotedContent: false,
|
|
28
|
+
...opts.variables,
|
|
29
|
+
},
|
|
30
|
+
fieldToggles: {
|
|
31
|
+
withArticlePlainText: false,
|
|
32
|
+
withArticleRichContentState: false,
|
|
33
|
+
withAuxiliaryUserLabels: false,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
return parseTimeline(raw);
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
async search(query, opts = {}) {
|
|
40
|
+
const raw = await client.graphql("BookmarkSearchTimeline", {
|
|
41
|
+
variables: {
|
|
42
|
+
search_query: query,
|
|
43
|
+
count: opts.count || 20,
|
|
44
|
+
cursor: opts.cursor,
|
|
45
|
+
includePromotedContent: false,
|
|
46
|
+
...opts.variables,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
return parseTimeline(raw);
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
async folders() {
|
|
53
|
+
return await client.graphql("BookmarkFoldersSlice", {
|
|
54
|
+
variables: {},
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
async createFolder(name) {
|
|
59
|
+
return await client.graphql("createBookmarkFolder", {
|
|
60
|
+
body: { variables: { bookmark_collection_name: name } },
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
async deleteFolder(folderId) {
|
|
65
|
+
return await client.graphql("DeleteBookmarkFolder", {
|
|
66
|
+
body: { variables: { bookmark_collection_id: folderId } },
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
async editFolder(folderId, name) {
|
|
71
|
+
return await client.graphql("EditBookmarkFolder", {
|
|
72
|
+
body: {
|
|
73
|
+
variables: {
|
|
74
|
+
bookmark_collection_id: folderId,
|
|
75
|
+
bookmark_collection_name: name,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
async addToFolder(tweetId, folderId) {
|
|
82
|
+
return await client.graphql("bookmarkTweetToFolder", {
|
|
83
|
+
body: {
|
|
84
|
+
variables: {
|
|
85
|
+
tweet_id: tweetId,
|
|
86
|
+
bookmark_collection_id: folderId,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
async removeFromFolder(tweetId, folderId) {
|
|
93
|
+
return await client.graphql("RemoveTweetFromBookmarkFolder", {
|
|
94
|
+
body: {
|
|
95
|
+
variables: {
|
|
96
|
+
tweet_id: tweetId,
|
|
97
|
+
bookmark_collection_id: folderId,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
async folderTimeline(folderId, opts = {}) {
|
|
104
|
+
const raw = await client.graphql("BookmarkFolderTimeline", {
|
|
105
|
+
variables: {
|
|
106
|
+
bookmark_collection_id: folderId,
|
|
107
|
+
count: opts.count || 20,
|
|
108
|
+
cursor: opts.cursor,
|
|
109
|
+
includePromotedContent: false,
|
|
110
|
+
...opts.variables,
|
|
111
|
+
},
|
|
112
|
+
fieldToggles: {
|
|
113
|
+
withArticlePlainText: false,
|
|
114
|
+
withArticleRichContentState: false,
|
|
115
|
+
withAuxiliaryUserLabels: false,
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
return parseTimeline(raw);
|
|
119
|
+
},
|
|
120
|
+
});
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
export default (client) => ({
|
|
2
|
+
async create(name, opts = {}) {
|
|
3
|
+
return await client.graphql("CreateCommunity", {
|
|
4
|
+
body: {
|
|
5
|
+
variables: {
|
|
6
|
+
name,
|
|
7
|
+
description: opts.description || "",
|
|
8
|
+
...(opts.rules ? { rules: opts.rules } : {}),
|
|
9
|
+
...opts.variables,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
async get(communityId) {
|
|
16
|
+
return await client.graphql("CommunityByRestId", {
|
|
17
|
+
variables: { communityId },
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
async join(communityId) {
|
|
22
|
+
return await client.graphql("JoinCommunity", {
|
|
23
|
+
body: { variables: { communityId } },
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
async leave(communityId) {
|
|
28
|
+
return await client.graphql("LeaveCommunity", {
|
|
29
|
+
body: { variables: { communityId } },
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
async requestJoin(communityId, opts = {}) {
|
|
34
|
+
return await client.graphql("RequestToJoinCommunity", {
|
|
35
|
+
body: {
|
|
36
|
+
variables: {
|
|
37
|
+
communityId,
|
|
38
|
+
...(opts.answer ? { answer: opts.answer } : {}),
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
async timeline(communityId, opts = {}) {
|
|
45
|
+
return await client.graphql("CommunityTweetsTimeline", {
|
|
46
|
+
variables: {
|
|
47
|
+
communityId,
|
|
48
|
+
count: opts.count || 20,
|
|
49
|
+
cursor: opts.cursor,
|
|
50
|
+
rankingMode: opts.rankingMode || "Recency",
|
|
51
|
+
withCommunity: true,
|
|
52
|
+
...opts.variables,
|
|
53
|
+
},
|
|
54
|
+
fieldToggles: {
|
|
55
|
+
withArticlePlainText: false,
|
|
56
|
+
withArticleRichContentState: false,
|
|
57
|
+
withAuxiliaryUserLabels: false,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
async media(communityId, opts = {}) {
|
|
63
|
+
return await client.graphql("CommunityMediaTimeline", {
|
|
64
|
+
variables: {
|
|
65
|
+
communityId,
|
|
66
|
+
count: opts.count || 20,
|
|
67
|
+
cursor: opts.cursor,
|
|
68
|
+
withCommunity: true,
|
|
69
|
+
...opts.variables,
|
|
70
|
+
},
|
|
71
|
+
fieldToggles: {
|
|
72
|
+
withArticlePlainText: false,
|
|
73
|
+
withArticleRichContentState: false,
|
|
74
|
+
withAuxiliaryUserLabels: false,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
async about(communityId, opts = {}) {
|
|
80
|
+
return await client.graphql("CommunityAboutTimeline", {
|
|
81
|
+
variables: {
|
|
82
|
+
communityId,
|
|
83
|
+
count: opts.count || 20,
|
|
84
|
+
cursor: opts.cursor,
|
|
85
|
+
withCommunity: true,
|
|
86
|
+
...opts.variables,
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
async hashtags(communityId, opts = {}) {
|
|
92
|
+
return await client.graphql("CommunityHashtagsTimeline", {
|
|
93
|
+
variables: {
|
|
94
|
+
communityId,
|
|
95
|
+
count: opts.count || 20,
|
|
96
|
+
cursor: opts.cursor,
|
|
97
|
+
...opts.variables,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
async editName(communityId, name) {
|
|
103
|
+
return await client.graphql("CommunityEditName", {
|
|
104
|
+
body: { variables: { communityId, name } },
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
async editPurpose(communityId, purpose) {
|
|
109
|
+
return await client.graphql("CommunityEditPurpose", {
|
|
110
|
+
body: { variables: { communityId, purpose } },
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
async editBanner(communityId, mediaId) {
|
|
115
|
+
return await client.graphql("CommunityEditBannerMedia", {
|
|
116
|
+
body: { variables: { communityId, mediaId } },
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
async removeBanner(communityId) {
|
|
121
|
+
return await client.graphql("CommunityRemoveBannerMedia", {
|
|
122
|
+
body: { variables: { communityId } },
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
async createRule(communityId, name, opts = {}) {
|
|
127
|
+
return await client.graphql("CommunityCreateRule", {
|
|
128
|
+
body: {
|
|
129
|
+
variables: {
|
|
130
|
+
communityId,
|
|
131
|
+
name,
|
|
132
|
+
description: opts.description || "",
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
async editRule(communityId, ruleId, name, opts = {}) {
|
|
139
|
+
return await client.graphql("CommunityEditRule", {
|
|
140
|
+
body: {
|
|
141
|
+
variables: {
|
|
142
|
+
communityId,
|
|
143
|
+
ruleId,
|
|
144
|
+
name,
|
|
145
|
+
...(opts.description !== undefined ? { description: opts.description } : {}),
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
async removeRule(communityId, ruleId) {
|
|
152
|
+
return await client.graphql("CommunityRemoveRule", {
|
|
153
|
+
body: { variables: { communityId, ruleId } },
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
async reorderRules(communityId, ruleIds) {
|
|
158
|
+
return await client.graphql("CommunityReorderRules", {
|
|
159
|
+
body: { variables: { communityId, ruleIds } },
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
async editQuestion(communityId, question) {
|
|
164
|
+
return await client.graphql("CommunityEditQuestion", {
|
|
165
|
+
body: { variables: { communityId, question } },
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
async updateRole(communityId, userId, role) {
|
|
170
|
+
return await client.graphql("CommunityUpdateRole", {
|
|
171
|
+
body: { variables: { communityId, userId, role } },
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
async invite(communityId, userId) {
|
|
176
|
+
return await client.graphql("CommunityUserInvite", {
|
|
177
|
+
body: { variables: { communityId, userId } },
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
async keepTweet(communityId, tweetId) {
|
|
182
|
+
return await client.graphql("CommunityModerationKeepTweet", {
|
|
183
|
+
body: { variables: { communityId, tweetId } },
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
async moderationCases(communityId, opts = {}) {
|
|
188
|
+
return await client.graphql("CommunityModerationTweetCasesSlice", {
|
|
189
|
+
variables: {
|
|
190
|
+
communityId,
|
|
191
|
+
count: opts.count || 20,
|
|
192
|
+
cursor: opts.cursor,
|
|
193
|
+
...opts.variables,
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
async moderationLog(communityId, opts = {}) {
|
|
199
|
+
return await client.graphql("CommunityTweetModerationLogSlice", {
|
|
200
|
+
variables: {
|
|
201
|
+
communityId,
|
|
202
|
+
count: opts.count || 20,
|
|
203
|
+
cursor: opts.cursor,
|
|
204
|
+
...opts.variables,
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
async explore(opts = {}) {
|
|
210
|
+
return await client.graphql("CommunitiesExploreTimeline", {
|
|
211
|
+
variables: {
|
|
212
|
+
count: opts.count || 20,
|
|
213
|
+
cursor: opts.cursor,
|
|
214
|
+
...opts.variables,
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
async discover(opts = {}) {
|
|
220
|
+
return await client.graphql("CommunitiesMainDiscoveryModule", {
|
|
221
|
+
variables: {
|
|
222
|
+
count: opts.count || 20,
|
|
223
|
+
cursor: opts.cursor,
|
|
224
|
+
...opts.variables,
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
async ranked(opts = {}) {
|
|
230
|
+
return await client.graphql("CommunitiesRankedTimeline", {
|
|
231
|
+
variables: {
|
|
232
|
+
count: opts.count || 20,
|
|
233
|
+
cursor: opts.cursor,
|
|
234
|
+
...opts.variables,
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
async memberships(userId, opts = {}) {
|
|
240
|
+
return await client.graphql("CommunitiesMembershipsTimeline", {
|
|
241
|
+
variables: {
|
|
242
|
+
userId,
|
|
243
|
+
count: opts.count || 20,
|
|
244
|
+
cursor: opts.cursor,
|
|
245
|
+
...opts.variables,
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
},
|
|
249
|
+
|
|
250
|
+
async memberSearch(communityId, query, opts = {}) {
|
|
251
|
+
return await client.graphql("CommunityMemberRelationshipTypeahead", {
|
|
252
|
+
variables: {
|
|
253
|
+
communityId,
|
|
254
|
+
query,
|
|
255
|
+
count: opts.count || 20,
|
|
256
|
+
...opts.variables,
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
async userSearch(communityId, query, opts = {}) {
|
|
262
|
+
return await client.graphql("CommunityUserRelationshipTypeahead", {
|
|
263
|
+
variables: {
|
|
264
|
+
communityId,
|
|
265
|
+
query,
|
|
266
|
+
count: opts.count || 20,
|
|
267
|
+
...opts.variables,
|
|
268
|
+
},
|
|
269
|
+
});
|
|
270
|
+
},
|
|
271
|
+
});
|