emusks 2.0.4 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,229 +1,227 @@
1
- export default (client) => ({
2
- async create(name, opts = {}) {
3
- return await client.graphql("CreateList", {
4
- body: {
5
- variables: {
6
- isPrivate: opts.private || false,
7
- name,
8
- description: opts.description || "",
9
- },
10
- },
11
- });
12
- },
13
-
14
- async delete(listId) {
15
- return await client.graphql("DeleteList", {
16
- body: { variables: { listId } },
17
- });
18
- },
19
-
20
- async update(listId, opts = {}) {
21
- return await client.graphql("UpdateList", {
22
- body: {
23
- variables: {
24
- listId,
25
- ...(opts.name !== undefined ? { name: opts.name } : {}),
26
- ...(opts.description !== undefined ? { description: opts.description } : {}),
27
- ...(opts.private !== undefined ? { isPrivate: opts.private } : {}),
28
- },
29
- },
30
- });
31
- },
32
-
33
- async get(listId) {
34
- return await client.graphql("ListByRestId", {
35
- variables: { listId },
36
- });
37
- },
38
-
39
- async getBySlug(slug, opts = {}) {
40
- return await client.graphql("ListBySlug", {
41
- variables: { slug, listOwnerScreenName: opts.ownerScreenName || "" },
42
- });
43
- },
44
-
45
- async addMember(listId, userId) {
46
- return await client.graphql("ListAddMember", {
47
- body: { variables: { listId, userId } },
48
- });
49
- },
50
-
51
- async removeMember(listId, userId) {
52
- return await client.graphql("ListRemoveMember", {
53
- body: { variables: { listId, userId } },
54
- });
55
- },
56
-
57
- async members(listId, opts = {}) {
58
- return await client.graphql("ListMembers", {
59
- variables: {
60
- listId,
61
- count: opts.count || 20,
62
- cursor: opts.cursor,
63
- ...opts.variables,
64
- },
65
- });
66
- },
67
-
68
- async subscribers(listId, opts = {}) {
69
- return await client.graphql("ListSubscribers", {
70
- variables: {
71
- listId,
72
- count: opts.count || 20,
73
- cursor: opts.cursor,
74
- ...opts.variables,
75
- },
76
- });
77
- },
78
-
79
- async subscribe(listId) {
80
- return await client.graphql("ListSubscribe", {
81
- body: { variables: { listId } },
82
- });
83
- },
84
-
85
- async unsubscribe(listId) {
86
- return await client.graphql("ListUnsubscribe", {
87
- body: { variables: { listId } },
88
- });
89
- },
90
-
91
- async mute(listId) {
92
- return await client.graphql("MuteList", {
93
- body: { variables: { listId } },
94
- });
95
- },
96
-
97
- async unmute(listId) {
98
- return await client.graphql("UnmuteList", {
99
- body: { variables: { listId } },
100
- });
101
- },
102
-
103
- async timeline(listId, opts = {}) {
104
- return await client.graphql("ListLatestTweetsTimeline", {
105
- variables: {
106
- listId,
107
- count: opts.count || 20,
108
- cursor: opts.cursor,
109
- ...opts.variables,
110
- },
111
- fieldToggles: {
112
- withArticlePlainText: false,
113
- withArticleRichContentState: false,
114
- withAuxiliaryUserLabels: false,
115
- },
116
- });
117
- },
118
-
119
- async ranked(listId, opts = {}) {
120
- return await client.graphql("ListRankedTweetsTimeline", {
1
+ export async function create(name, opts = {}) {
2
+ return await this.graphql("CreateList", {
3
+ body: {
121
4
  variables: {
122
- listId,
123
- count: opts.count || 20,
124
- cursor: opts.cursor,
125
- ...opts.variables,
126
- },
127
- fieldToggles: {
128
- withArticlePlainText: false,
129
- withArticleRichContentState: false,
130
- withAuxiliaryUserLabels: false,
5
+ isPrivate: opts.private || false,
6
+ name,
7
+ description: opts.description || "",
131
8
  },
132
- });
133
- },
134
-
135
- async search(listId, query, opts = {}) {
136
- return await client.graphql("ListSearchTimeline", {
9
+ },
10
+ });
11
+ }
12
+
13
+ export async function remove(listId) {
14
+ return await this.graphql("DeleteList", {
15
+ body: { variables: { listId } },
16
+ });
17
+ }
18
+
19
+ export async function update(listId, opts = {}) {
20
+ return await this.graphql("UpdateList", {
21
+ body: {
137
22
  variables: {
138
23
  listId,
139
- search_query: query,
140
- count: opts.count || 20,
141
- cursor: opts.cursor,
142
- ...opts.variables,
143
- },
144
- });
145
- },
146
-
147
- async ownerships(userId, opts = {}) {
148
- return await client.graphql("ListOwnerships", {
149
- variables: {
150
- userId,
151
- count: opts.count || 20,
152
- cursor: opts.cursor,
153
- isCreator: true,
154
- ...opts.variables,
155
- },
156
- });
157
- },
158
-
159
- async memberships(userId, opts = {}) {
160
- return await client.graphql("ListMemberships", {
161
- variables: {
162
- userId,
163
- count: opts.count || 20,
164
- cursor: opts.cursor,
165
- ...opts.variables,
166
- },
167
- });
168
- },
169
-
170
- async discover(opts = {}) {
171
- return await client.graphql("ListsDiscovery", {
172
- variables: {
173
- count: opts.count || 20,
174
- cursor: opts.cursor,
175
- ...opts.variables,
176
- },
177
- });
178
- },
179
-
180
- async combined(opts = {}) {
181
- return await client.graphql("CombinedLists", {
182
- variables: {
183
- count: opts.count || 20,
184
- cursor: opts.cursor,
185
- ...opts.variables,
186
- },
187
- });
188
- },
189
-
190
- async manage(opts = {}) {
191
- return await client.graphql("ListsManagementPageTimeline", {
192
- variables: {
193
- count: opts.count || 20,
194
- cursor: opts.cursor,
195
- ...opts.variables,
24
+ ...(opts.name !== undefined ? { name: opts.name } : {}),
25
+ ...(opts.description !== undefined ? { description: opts.description } : {}),
26
+ ...(opts.private !== undefined ? { isPrivate: opts.private } : {}),
196
27
  },
197
- });
198
- },
199
-
200
- async editBanner(listId, mediaId) {
201
- return await client.graphql("EditListBanner", {
202
- body: { variables: { listId, mediaId } },
203
- });
204
- },
205
-
206
- async deleteBanner(listId) {
207
- return await client.graphql("DeleteListBanner", {
208
- body: { variables: { listId } },
209
- });
210
- },
211
-
212
- async pinTimeline(timelineId) {
213
- return await client.graphql("PinTimeline", {
214
- body: { variables: { timeline_id: timelineId } },
215
- });
216
- },
217
-
218
- async unpinTimeline(timelineId) {
219
- return await client.graphql("UnpinTimeline", {
220
- body: { variables: { timeline_id: timelineId } },
221
- });
222
- },
223
-
224
- async pinned() {
225
- return await client.graphql("PinnedTimelines", {
226
- variables: {},
227
- });
228
- },
229
- });
28
+ },
29
+ });
30
+ }
31
+
32
+ export async function get(listId) {
33
+ return await this.graphql("ListByRestId", {
34
+ variables: { listId },
35
+ });
36
+ }
37
+
38
+ export async function getBySlug(slug, opts = {}) {
39
+ return await this.graphql("ListBySlug", {
40
+ variables: { slug, listOwnerScreenName: opts.ownerScreenName || "" },
41
+ });
42
+ }
43
+
44
+ export async function addMember(listId, userId) {
45
+ return await this.graphql("ListAddMember", {
46
+ body: { variables: { listId, userId } },
47
+ });
48
+ }
49
+
50
+ export async function removeMember(listId, userId) {
51
+ return await this.graphql("ListRemoveMember", {
52
+ body: { variables: { listId, userId } },
53
+ });
54
+ }
55
+
56
+ export async function members(listId, opts = {}) {
57
+ return await this.graphql("ListMembers", {
58
+ variables: {
59
+ listId,
60
+ count: opts.count || 20,
61
+ cursor: opts.cursor,
62
+ ...opts.variables,
63
+ },
64
+ });
65
+ }
66
+
67
+ export async function subscribers(listId, opts = {}) {
68
+ return await this.graphql("ListSubscribers", {
69
+ variables: {
70
+ listId,
71
+ count: opts.count || 20,
72
+ cursor: opts.cursor,
73
+ ...opts.variables,
74
+ },
75
+ });
76
+ }
77
+
78
+ export async function subscribe(listId) {
79
+ return await this.graphql("ListSubscribe", {
80
+ body: { variables: { listId } },
81
+ });
82
+ }
83
+
84
+ export async function unsubscribe(listId) {
85
+ return await this.graphql("ListUnsubscribe", {
86
+ body: { variables: { listId } },
87
+ });
88
+ }
89
+
90
+ export async function mute(listId) {
91
+ return await this.graphql("MuteList", {
92
+ body: { variables: { listId } },
93
+ });
94
+ }
95
+
96
+ export async function unmute(listId) {
97
+ return await this.graphql("UnmuteList", {
98
+ body: { variables: { listId } },
99
+ });
100
+ }
101
+
102
+ export async function timeline(listId, opts = {}) {
103
+ return await this.graphql("ListLatestTweetsTimeline", {
104
+ variables: {
105
+ listId,
106
+ count: opts.count || 20,
107
+ cursor: opts.cursor,
108
+ ...opts.variables,
109
+ },
110
+ fieldToggles: {
111
+ withArticlePlainText: false,
112
+ withArticleRichContentState: false,
113
+ withAuxiliaryUserLabels: false,
114
+ },
115
+ });
116
+ }
117
+
118
+ export async function ranked(listId, opts = {}) {
119
+ return await this.graphql("ListRankedTweetsTimeline", {
120
+ variables: {
121
+ listId,
122
+ count: opts.count || 20,
123
+ cursor: opts.cursor,
124
+ ...opts.variables,
125
+ },
126
+ fieldToggles: {
127
+ withArticlePlainText: false,
128
+ withArticleRichContentState: false,
129
+ withAuxiliaryUserLabels: false,
130
+ },
131
+ });
132
+ }
133
+
134
+ export async function search(listId, query, opts = {}) {
135
+ return await this.graphql("ListSearchTimeline", {
136
+ variables: {
137
+ listId,
138
+ search_query: query,
139
+ count: opts.count || 20,
140
+ cursor: opts.cursor,
141
+ ...opts.variables,
142
+ },
143
+ });
144
+ }
145
+
146
+ export async function ownerships(userId, opts = {}) {
147
+ return await this.graphql("ListOwnerships", {
148
+ variables: {
149
+ userId,
150
+ count: opts.count || 20,
151
+ cursor: opts.cursor,
152
+ isCreator: true,
153
+ ...opts.variables,
154
+ },
155
+ });
156
+ }
157
+
158
+ export async function listMemberships(userId, opts = {}) {
159
+ return await this.graphql("ListMemberships", {
160
+ variables: {
161
+ userId,
162
+ count: opts.count || 20,
163
+ cursor: opts.cursor,
164
+ ...opts.variables,
165
+ },
166
+ });
167
+ }
168
+
169
+ export async function discover(opts = {}) {
170
+ return await this.graphql("ListsDiscovery", {
171
+ variables: {
172
+ count: opts.count || 20,
173
+ cursor: opts.cursor,
174
+ ...opts.variables,
175
+ },
176
+ });
177
+ }
178
+
179
+ export async function combined(opts = {}) {
180
+ return await this.graphql("CombinedLists", {
181
+ variables: {
182
+ count: opts.count || 20,
183
+ cursor: opts.cursor,
184
+ ...opts.variables,
185
+ },
186
+ });
187
+ }
188
+
189
+ export async function manage(opts = {}) {
190
+ return await this.graphql("ListsManagementPageTimeline", {
191
+ variables: {
192
+ count: opts.count || 20,
193
+ cursor: opts.cursor,
194
+ ...opts.variables,
195
+ },
196
+ });
197
+ }
198
+
199
+ export async function editBanner(listId, mediaId) {
200
+ return await this.graphql("EditListBanner", {
201
+ body: { variables: { listId, mediaId } },
202
+ });
203
+ }
204
+
205
+ export async function deleteBanner(listId) {
206
+ return await this.graphql("DeleteListBanner", {
207
+ body: { variables: { listId } },
208
+ });
209
+ }
210
+
211
+ export async function pinTimeline(timelineId) {
212
+ return await this.graphql("PinTimeline", {
213
+ body: { variables: { timeline_id: timelineId } },
214
+ });
215
+ }
216
+
217
+ export async function unpinTimeline(timelineId) {
218
+ return await this.graphql("UnpinTimeline", {
219
+ body: { variables: { timeline_id: timelineId } },
220
+ });
221
+ }
222
+
223
+ export async function pinned() {
224
+ return await this.graphql("PinnedTimelines", {
225
+ variables: {},
226
+ });
227
+ }