emusks 2.0.4 → 2.0.5

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.
@@ -1,271 +1,269 @@
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
- },
1
+ export async function create(name, opts = {}) {
2
+ return await this.graphql("CreateCommunity", {
3
+ body: {
4
+ variables: {
5
+ name,
6
+ description: opts.description || "",
7
+ ...(opts.rules ? { rules: opts.rules } : {}),
8
+ ...opts.variables,
11
9
  },
12
- });
13
- },
10
+ },
11
+ });
12
+ }
14
13
 
15
- async get(communityId) {
16
- return await client.graphql("CommunityByRestId", {
17
- variables: { communityId },
18
- });
19
- },
14
+ export async function get(communityId) {
15
+ return await this.graphql("CommunityByRestId", {
16
+ variables: { communityId },
17
+ });
18
+ }
20
19
 
21
- async join(communityId) {
22
- return await client.graphql("JoinCommunity", {
23
- body: { variables: { communityId } },
24
- });
25
- },
20
+ export async function join(communityId) {
21
+ return await this.graphql("JoinCommunity", {
22
+ body: { variables: { communityId } },
23
+ });
24
+ }
26
25
 
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
- },
26
+ export async function leave(communityId) {
27
+ return await this.graphql("LeaveCommunity", {
28
+ body: { variables: { communityId } },
29
+ });
30
+ }
43
31
 
44
- async timeline(communityId, opts = {}) {
45
- return await client.graphql("CommunityTweetsTimeline", {
32
+ export async function requestJoin(communityId, opts = {}) {
33
+ return await this.graphql("RequestToJoinCommunity", {
34
+ body: {
46
35
  variables: {
47
36
  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,
37
+ ...(opts.answer ? { answer: opts.answer } : {}),
58
38
  },
59
- });
60
- },
39
+ },
40
+ });
41
+ }
61
42
 
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
- },
43
+ export async function timeline(communityId, opts = {}) {
44
+ return await this.graphql("CommunityTweetsTimeline", {
45
+ variables: {
46
+ communityId,
47
+ count: opts.count || 20,
48
+ cursor: opts.cursor,
49
+ rankingMode: opts.rankingMode || "Recency",
50
+ withCommunity: true,
51
+ ...opts.variables,
52
+ },
53
+ fieldToggles: {
54
+ withArticlePlainText: false,
55
+ withArticleRichContentState: false,
56
+ withAuxiliaryUserLabels: false,
57
+ },
58
+ });
59
+ }
78
60
 
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
- },
61
+ export async function media(communityId, opts = {}) {
62
+ return await this.graphql("CommunityMediaTimeline", {
63
+ variables: {
64
+ communityId,
65
+ count: opts.count || 20,
66
+ cursor: opts.cursor,
67
+ withCommunity: true,
68
+ ...opts.variables,
69
+ },
70
+ fieldToggles: {
71
+ withArticlePlainText: false,
72
+ withArticleRichContentState: false,
73
+ withAuxiliaryUserLabels: false,
74
+ },
75
+ });
76
+ }
90
77
 
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
- },
78
+ export async function about(communityId, opts = {}) {
79
+ return await this.graphql("CommunityAboutTimeline", {
80
+ variables: {
81
+ communityId,
82
+ count: opts.count || 20,
83
+ cursor: opts.cursor,
84
+ withCommunity: true,
85
+ ...opts.variables,
86
+ },
87
+ });
88
+ }
89
+
90
+ export async function hashtags(communityId, opts = {}) {
91
+ return await this.graphql("CommunityHashtagsTimeline", {
92
+ variables: {
93
+ communityId,
94
+ count: opts.count || 20,
95
+ cursor: opts.cursor,
96
+ ...opts.variables,
97
+ },
98
+ });
99
+ }
101
100
 
102
- async editName(communityId, name) {
103
- return await client.graphql("CommunityEditName", {
104
- body: { variables: { communityId, name } },
105
- });
106
- },
101
+ export async function editName(communityId, name) {
102
+ return await this.graphql("CommunityEditName", {
103
+ body: { variables: { communityId, name } },
104
+ });
105
+ }
107
106
 
108
- async editPurpose(communityId, purpose) {
109
- return await client.graphql("CommunityEditPurpose", {
110
- body: { variables: { communityId, purpose } },
111
- });
112
- },
107
+ export async function editPurpose(communityId, purpose) {
108
+ return await this.graphql("CommunityEditPurpose", {
109
+ body: { variables: { communityId, purpose } },
110
+ });
111
+ }
113
112
 
114
- async editBanner(communityId, mediaId) {
115
- return await client.graphql("CommunityEditBannerMedia", {
116
- body: { variables: { communityId, mediaId } },
117
- });
118
- },
113
+ export async function editBanner(communityId, mediaId) {
114
+ return await this.graphql("CommunityEditBannerMedia", {
115
+ body: { variables: { communityId, mediaId } },
116
+ });
117
+ }
119
118
 
120
- async removeBanner(communityId) {
121
- return await client.graphql("CommunityRemoveBannerMedia", {
122
- body: { variables: { communityId } },
123
- });
124
- },
119
+ export async function removeBanner(communityId) {
120
+ return await this.graphql("CommunityRemoveBannerMedia", {
121
+ body: { variables: { communityId } },
122
+ });
123
+ }
125
124
 
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
- },
125
+ export async function createRule(communityId, name, opts = {}) {
126
+ return await this.graphql("CommunityCreateRule", {
127
+ body: {
128
+ variables: {
129
+ communityId,
130
+ name,
131
+ description: opts.description || "",
134
132
  },
135
- });
136
- },
133
+ },
134
+ });
135
+ }
137
136
 
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
- },
137
+ export async function editRule(communityId, ruleId, name, opts = {}) {
138
+ return await this.graphql("CommunityEditRule", {
139
+ body: {
140
+ variables: {
141
+ communityId,
142
+ ruleId,
143
+ name,
144
+ ...(opts.description !== undefined ? { description: opts.description } : {}),
147
145
  },
148
- });
149
- },
146
+ },
147
+ });
148
+ }
150
149
 
151
- async removeRule(communityId, ruleId) {
152
- return await client.graphql("CommunityRemoveRule", {
153
- body: { variables: { communityId, ruleId } },
154
- });
155
- },
150
+ export async function removeRule(communityId, ruleId) {
151
+ return await this.graphql("CommunityRemoveRule", {
152
+ body: { variables: { communityId, ruleId } },
153
+ });
154
+ }
156
155
 
157
- async reorderRules(communityId, ruleIds) {
158
- return await client.graphql("CommunityReorderRules", {
159
- body: { variables: { communityId, ruleIds } },
160
- });
161
- },
156
+ export async function reorderRules(communityId, ruleIds) {
157
+ return await this.graphql("CommunityReorderRules", {
158
+ body: { variables: { communityId, ruleIds } },
159
+ });
160
+ }
162
161
 
163
- async editQuestion(communityId, question) {
164
- return await client.graphql("CommunityEditQuestion", {
165
- body: { variables: { communityId, question } },
166
- });
167
- },
162
+ export async function editQuestion(communityId, question) {
163
+ return await this.graphql("CommunityEditQuestion", {
164
+ body: { variables: { communityId, question } },
165
+ });
166
+ }
168
167
 
169
- async updateRole(communityId, userId, role) {
170
- return await client.graphql("CommunityUpdateRole", {
171
- body: { variables: { communityId, userId, role } },
172
- });
173
- },
168
+ export async function updateRole(communityId, userId, role) {
169
+ return await this.graphql("CommunityUpdateRole", {
170
+ body: { variables: { communityId, userId, role } },
171
+ });
172
+ }
174
173
 
175
- async invite(communityId, userId) {
176
- return await client.graphql("CommunityUserInvite", {
177
- body: { variables: { communityId, userId } },
178
- });
179
- },
174
+ export async function invite(communityId, userId) {
175
+ return await this.graphql("CommunityUserInvite", {
176
+ body: { variables: { communityId, userId } },
177
+ });
178
+ }
180
179
 
181
- async keepTweet(communityId, tweetId) {
182
- return await client.graphql("CommunityModerationKeepTweet", {
183
- body: { variables: { communityId, tweetId } },
184
- });
185
- },
180
+ export async function keepTweet(communityId, tweetId) {
181
+ return await this.graphql("CommunityModerationKeepTweet", {
182
+ body: { variables: { communityId, tweetId } },
183
+ });
184
+ }
186
185
 
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
- },
186
+ export async function moderationCases(communityId, opts = {}) {
187
+ return await this.graphql("CommunityModerationTweetCasesSlice", {
188
+ variables: {
189
+ communityId,
190
+ count: opts.count || 20,
191
+ cursor: opts.cursor,
192
+ ...opts.variables,
193
+ },
194
+ });
195
+ }
197
196
 
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
- },
197
+ export async function moderationLog(communityId, opts = {}) {
198
+ return await this.graphql("CommunityTweetModerationLogSlice", {
199
+ variables: {
200
+ communityId,
201
+ count: opts.count || 20,
202
+ cursor: opts.cursor,
203
+ ...opts.variables,
204
+ },
205
+ });
206
+ }
208
207
 
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
- },
208
+ export async function explore(opts = {}) {
209
+ return await this.graphql("CommunitiesExploreTimeline", {
210
+ variables: {
211
+ count: opts.count || 20,
212
+ cursor: opts.cursor,
213
+ ...opts.variables,
214
+ },
215
+ });
216
+ }
218
217
 
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
- },
218
+ export async function discover(opts = {}) {
219
+ return await this.graphql("CommunitiesMainDiscoveryModule", {
220
+ variables: {
221
+ count: opts.count || 20,
222
+ cursor: opts.cursor,
223
+ ...opts.variables,
224
+ },
225
+ });
226
+ }
228
227
 
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
- },
228
+ export async function ranked(opts = {}) {
229
+ return await this.graphql("CommunitiesRankedTimeline", {
230
+ variables: {
231
+ count: opts.count || 20,
232
+ cursor: opts.cursor,
233
+ ...opts.variables,
234
+ },
235
+ });
236
+ }
238
237
 
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
- },
238
+ export async function memberships(userId, opts = {}) {
239
+ return await this.graphql("CommunitiesMembershipsTimeline", {
240
+ variables: {
241
+ userId,
242
+ count: opts.count || 20,
243
+ cursor: opts.cursor,
244
+ ...opts.variables,
245
+ },
246
+ });
247
+ }
249
248
 
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
- },
249
+ export async function memberSearch(communityId, query, opts = {}) {
250
+ return await this.graphql("CommunityMemberRelationshipTypeahead", {
251
+ variables: {
252
+ communityId,
253
+ query,
254
+ count: opts.count || 20,
255
+ ...opts.variables,
256
+ },
257
+ });
258
+ }
260
259
 
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
- });
260
+ export async function userSearch(communityId, query, opts = {}) {
261
+ return await this.graphql("CommunityUserRelationshipTypeahead", {
262
+ variables: {
263
+ communityId,
264
+ query,
265
+ count: opts.count || 20,
266
+ ...opts.variables,
267
+ },
268
+ });
269
+ }