emusks 2.1.0 → 2.1.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/package.json +1 -1
- package/src/graphql.js +5 -1
- package/src/helpers/lists.js +6 -2
- package/src/helpers/tweets.js +3 -1
package/package.json
CHANGED
package/src/graphql.js
CHANGED
|
@@ -141,7 +141,11 @@ export default async function graphql(queryName, { variables, fieldToggles, body
|
|
|
141
141
|
).json();
|
|
142
142
|
|
|
143
143
|
if (res?.errors?.[0]) {
|
|
144
|
-
|
|
144
|
+
const hasData =
|
|
145
|
+
res.data != null && typeof res.data === "object" && Object.keys(res.data).length > 0;
|
|
146
|
+
if (!hasData) {
|
|
147
|
+
throw new Error(res.errors.map((err) => err.message).join(", "));
|
|
148
|
+
}
|
|
145
149
|
}
|
|
146
150
|
|
|
147
151
|
return res;
|
package/src/helpers/lists.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import parseTimeline from "../parsers/timeline.js";
|
|
2
|
+
|
|
1
3
|
export async function create(name, opts = {}) {
|
|
2
4
|
return await this.graphql("CreateList", {
|
|
3
5
|
body: {
|
|
@@ -54,7 +56,7 @@ export async function removeMember(listId, userId) {
|
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
export async function members(listId, opts = {}) {
|
|
57
|
-
|
|
59
|
+
const raw = await this.graphql("ListMembers", {
|
|
58
60
|
variables: {
|
|
59
61
|
listId,
|
|
60
62
|
count: opts.count || 20,
|
|
@@ -62,10 +64,11 @@ export async function members(listId, opts = {}) {
|
|
|
62
64
|
...opts.variables,
|
|
63
65
|
},
|
|
64
66
|
});
|
|
67
|
+
return parseTimeline(raw);
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
export async function subscribers(listId, opts = {}) {
|
|
68
|
-
|
|
71
|
+
const raw = await this.graphql("ListSubscribers", {
|
|
69
72
|
variables: {
|
|
70
73
|
listId,
|
|
71
74
|
count: opts.count || 20,
|
|
@@ -73,6 +76,7 @@ export async function subscribers(listId, opts = {}) {
|
|
|
73
76
|
...opts.variables,
|
|
74
77
|
},
|
|
75
78
|
});
|
|
79
|
+
return parseTimeline(raw);
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
export async function subscribe(listId) {
|
package/src/helpers/tweets.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import getCycleTLS from "../cycletls.js";
|
|
2
|
+
import parseTimeline from "../parsers/timeline.js";
|
|
2
3
|
import parseTweet from "../parsers/tweet.js";
|
|
3
4
|
|
|
4
5
|
async function createPollCard(instance, poll) {
|
|
@@ -262,7 +263,7 @@ export async function getMany(tweetIds) {
|
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
export async function detail(tweetId, opts = {}) {
|
|
265
|
-
|
|
266
|
+
const raw = await this.graphql("TweetDetail", {
|
|
266
267
|
variables: {
|
|
267
268
|
focalTweetId: tweetId,
|
|
268
269
|
with_rux_injections: false,
|
|
@@ -280,6 +281,7 @@ export async function detail(tweetId, opts = {}) {
|
|
|
280
281
|
withAuxiliaryUserLabels: false,
|
|
281
282
|
},
|
|
282
283
|
});
|
|
284
|
+
return parseTimeline(raw);
|
|
283
285
|
}
|
|
284
286
|
|
|
285
287
|
export async function editHistory(tweetId) {
|