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.
- package/build/graphql.js +9 -14
- package/package.json +1 -1
- package/src/graphql.js +34 -12
- package/src/helpers/account.js +267 -269
- package/src/helpers/bookmarks.js +101 -103
- package/src/helpers/communities.js +236 -238
- package/src/helpers/dms.js +129 -131
- package/src/helpers/index.js +50 -31
- package/src/helpers/lists.js +222 -224
- package/src/helpers/media.js +137 -139
- package/src/helpers/notifications.js +42 -44
- package/src/helpers/search.js +117 -119
- package/src/helpers/spaces.js +47 -49
- package/src/helpers/syndication.js +23 -25
- package/src/helpers/timelines.js +76 -78
- package/src/helpers/topics.js +87 -89
- package/src/helpers/trends.js +74 -76
- package/src/helpers/tweets.js +302 -304
- package/src/helpers/users.js +287 -289
- package/src/index.js +29 -16
- package/src/static/graphql.js +1 -1
package/src/helpers/dms.js
CHANGED
|
@@ -1,131 +1,129 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
});
|
|
1
|
+
export async function inbox(params = {}) {
|
|
2
|
+
const res = await this.v1_1("dm/inbox_initial_state", { params });
|
|
3
|
+
return await res.json();
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export async function conversation(conversationId, params = {}) {
|
|
7
|
+
const res = await this.v1_1("dm/conversation", {
|
|
8
|
+
params: { id: conversationId, ...params },
|
|
9
|
+
});
|
|
10
|
+
return await res.json();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export async function search(query, opts = {}) {
|
|
14
|
+
return await this.graphql("DmAllSearchSlice", {
|
|
15
|
+
variables: {
|
|
16
|
+
query,
|
|
17
|
+
count: opts.count || 20,
|
|
18
|
+
cursor: opts.cursor,
|
|
19
|
+
...opts.variables,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function searchGroups(query, opts = {}) {
|
|
25
|
+
return await this.graphql("DmGroupSearchSlice", {
|
|
26
|
+
variables: {
|
|
27
|
+
query,
|
|
28
|
+
count: opts.count || 20,
|
|
29
|
+
cursor: opts.cursor,
|
|
30
|
+
...opts.variables,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function searchPeople(query, opts = {}) {
|
|
36
|
+
return await this.graphql("DmPeopleSearchSlice", {
|
|
37
|
+
variables: {
|
|
38
|
+
query,
|
|
39
|
+
count: opts.count || 20,
|
|
40
|
+
cursor: opts.cursor,
|
|
41
|
+
...opts.variables,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function block(userId) {
|
|
47
|
+
return await this.graphql("dmBlockUser", {
|
|
48
|
+
body: { variables: { user_id: userId } },
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function unblock(userId) {
|
|
53
|
+
return await this.graphql("dmUnblockUser", {
|
|
54
|
+
body: { variables: { user_id: userId } },
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export async function deleteConversations(conversationIds) {
|
|
59
|
+
const ids = Array.isArray(conversationIds) ? conversationIds : [conversationIds];
|
|
60
|
+
const res = await this.v1_1("dm/conversation/bulk_delete", {
|
|
61
|
+
body: JSON.stringify({ conversation_ids: ids }),
|
|
62
|
+
});
|
|
63
|
+
return await res.json();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export async function updateLastSeen(eventId) {
|
|
67
|
+
const res = await this.v1_1("dm/update_last_seen_event_id", {
|
|
68
|
+
body: JSON.stringify({ last_seen_event_id: eventId, trusted_last_seen_event_id: eventId }),
|
|
69
|
+
});
|
|
70
|
+
return await res.json();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export async function muted(opts = {}) {
|
|
74
|
+
return await this.graphql("DmMutedTimeline", {
|
|
75
|
+
variables: {
|
|
76
|
+
count: opts.count || 20,
|
|
77
|
+
cursor: opts.cursor,
|
|
78
|
+
...opts.variables,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export async function edit(messageId, conversationId, text) {
|
|
84
|
+
const res = await this.v1_1("dm/edit", {
|
|
85
|
+
body: JSON.stringify({
|
|
86
|
+
message_id: messageId,
|
|
87
|
+
conversation_id: conversationId,
|
|
88
|
+
text,
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
return await res.json();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export async function permissions(params = {}) {
|
|
95
|
+
const res = await this.v1_1("dm/permissions", { params });
|
|
96
|
+
return await res.json();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export async function nsfwFilter(enabled) {
|
|
100
|
+
return await this.graphql("DmNsfwMediaFilterUpdate", {
|
|
101
|
+
body: { variables: { enabled } },
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export async function updateRelationship(userId, action) {
|
|
106
|
+
const res = await this.v1_1("dm/user/update_relationship_state", {
|
|
107
|
+
body: JSON.stringify({ user_id: userId, action }),
|
|
108
|
+
});
|
|
109
|
+
return await res.json();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export async function reportSpam(conversationId, messageId) {
|
|
113
|
+
const res = await this.v1_1("direct_messages/report_spam", {
|
|
114
|
+
body: JSON.stringify({ conversation_id: conversationId, message_id: messageId }),
|
|
115
|
+
});
|
|
116
|
+
return await res.json();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export async function report(conversationId, messageId) {
|
|
120
|
+
const res = await this.v1_1("dm/report", {
|
|
121
|
+
body: JSON.stringify({ conversation_id: conversationId, message_id: messageId }),
|
|
122
|
+
});
|
|
123
|
+
return await res.json();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export async function userUpdates(params = {}) {
|
|
127
|
+
const res = await this.v1_1("dm/user_updates", { params });
|
|
128
|
+
return await res.json();
|
|
129
|
+
}
|
package/src/helpers/index.js
CHANGED
|
@@ -1,32 +1,51 @@
|
|
|
1
|
-
import account from "./account.js";
|
|
2
|
-
import bookmarks from "./bookmarks.js";
|
|
3
|
-
import communities from "./communities.js";
|
|
4
|
-
import dms from "./dms.js";
|
|
5
|
-
import lists from "./lists.js";
|
|
6
|
-
import media from "./media.js";
|
|
7
|
-
import notifications from "./notifications.js";
|
|
8
|
-
import search from "./search.js";
|
|
9
|
-
import spaces from "./spaces.js";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
1
|
+
import * as account from "./account.js";
|
|
2
|
+
import * as bookmarks from "./bookmarks.js";
|
|
3
|
+
import * as communities from "./communities.js";
|
|
4
|
+
import * as dms from "./dms.js";
|
|
5
|
+
import * as lists from "./lists.js";
|
|
6
|
+
import * as media from "./media.js";
|
|
7
|
+
import * as notifications from "./notifications.js";
|
|
8
|
+
import * as search from "./search.js";
|
|
9
|
+
import * as spaces from "./spaces.js";
|
|
10
|
+
import * as syndication from "./syndication.js";
|
|
11
|
+
import * as timelines from "./timelines.js";
|
|
12
|
+
import * as topics from "./topics.js";
|
|
13
|
+
import * as trends from "./trends.js";
|
|
14
|
+
import * as tweets from "./tweets.js";
|
|
15
|
+
import * as users from "./users.js";
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
17
|
+
function namespace(proto, name, methods) {
|
|
18
|
+
Object.defineProperty(proto, name, {
|
|
19
|
+
get() {
|
|
20
|
+
const bound = {};
|
|
21
|
+
for (const [k, fn] of Object.entries(methods)) {
|
|
22
|
+
if (typeof fn === "function") bound[k] = fn.bind(this);
|
|
23
|
+
}
|
|
24
|
+
Object.defineProperty(this, name, {
|
|
25
|
+
value: bound,
|
|
26
|
+
writable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
});
|
|
29
|
+
return bound;
|
|
30
|
+
},
|
|
31
|
+
configurable: true,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default function initHelpers(proto) {
|
|
36
|
+
namespace(proto, "tweets", tweets);
|
|
37
|
+
namespace(proto, "users", users);
|
|
38
|
+
namespace(proto, "timelines", timelines);
|
|
39
|
+
namespace(proto, "bookmarks", bookmarks);
|
|
40
|
+
namespace(proto, "dms", dms);
|
|
41
|
+
namespace(proto, "lists", lists);
|
|
42
|
+
namespace(proto, "communities", communities);
|
|
43
|
+
namespace(proto, "search", search);
|
|
44
|
+
namespace(proto, "spaces", spaces);
|
|
45
|
+
namespace(proto, "account", account);
|
|
46
|
+
namespace(proto, "notifications", notifications);
|
|
47
|
+
namespace(proto, "trends", trends);
|
|
48
|
+
namespace(proto, "topics", topics);
|
|
49
|
+
namespace(proto, "media", media);
|
|
50
|
+
namespace(proto, "syndication", syndication);
|
|
51
|
+
}
|