emusks 2.0.3 → 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,120 +1,118 @@
1
1
  import parseTimeline from "../parsers/timeline.js";
2
2
 
3
- export default (client) => ({
4
- async create(tweetId) {
5
- return await client.graphql("CreateBookmark", {
6
- body: { variables: { tweet_id: tweetId } },
7
- });
8
- },
3
+ export async function create(tweetId) {
4
+ return await this.graphql("CreateBookmark", {
5
+ body: { variables: { tweet_id: tweetId } },
6
+ });
7
+ }
9
8
 
10
- async delete(tweetId) {
11
- return await client.graphql("DeleteBookmark", {
12
- body: { variables: { tweet_id: tweetId } },
13
- });
14
- },
9
+ export async function remove(tweetId) {
10
+ return await this.graphql("DeleteBookmark", {
11
+ body: { variables: { tweet_id: tweetId } },
12
+ });
13
+ }
15
14
 
16
- async deleteAll() {
17
- return await client.graphql("BookmarksAllDelete", {
18
- body: { variables: {} },
19
- });
20
- },
15
+ export async function deleteAll() {
16
+ return await this.graphql("BookmarksAllDelete", {
17
+ body: { variables: {} },
18
+ });
19
+ }
21
20
 
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
- },
21
+ export async function get(opts = {}) {
22
+ const raw = await this.graphql("Bookmarks", {
23
+ variables: {
24
+ count: opts.count || 20,
25
+ cursor: opts.cursor,
26
+ includePromotedContent: false,
27
+ ...opts.variables,
28
+ },
29
+ fieldToggles: {
30
+ withArticlePlainText: false,
31
+ withArticleRichContentState: false,
32
+ withAuxiliaryUserLabels: false,
33
+ },
34
+ });
35
+ return parseTimeline(raw);
36
+ }
38
37
 
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
- },
38
+ export async function search(query, opts = {}) {
39
+ const raw = await this.graphql("BookmarkSearchTimeline", {
40
+ variables: {
41
+ search_query: query,
42
+ count: opts.count || 20,
43
+ cursor: opts.cursor,
44
+ includePromotedContent: false,
45
+ ...opts.variables,
46
+ },
47
+ });
48
+ return parseTimeline(raw);
49
+ }
57
50
 
58
- async createFolder(name) {
59
- return await client.graphql("createBookmarkFolder", {
60
- body: { variables: { bookmark_collection_name: name } },
61
- });
62
- },
51
+ export async function folders() {
52
+ return await this.graphql("BookmarkFoldersSlice", {
53
+ variables: {},
54
+ });
55
+ }
63
56
 
64
- async deleteFolder(folderId) {
65
- return await client.graphql("DeleteBookmarkFolder", {
66
- body: { variables: { bookmark_collection_id: folderId } },
67
- });
68
- },
57
+ export async function createFolder(name) {
58
+ return await this.graphql("createBookmarkFolder", {
59
+ body: { variables: { bookmark_collection_name: name } },
60
+ });
61
+ }
69
62
 
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
- },
63
+ export async function deleteFolder(folderId) {
64
+ return await this.graphql("DeleteBookmarkFolder", {
65
+ body: { variables: { bookmark_collection_id: folderId } },
66
+ });
67
+ }
80
68
 
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
- },
69
+ export async function editFolder(folderId, name) {
70
+ return await this.graphql("EditBookmarkFolder", {
71
+ body: {
72
+ variables: {
73
+ bookmark_collection_id: folderId,
74
+ bookmark_collection_name: name,
88
75
  },
89
- });
90
- },
76
+ },
77
+ });
78
+ }
91
79
 
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
- },
80
+ export async function addToFolder(tweetId, folderId) {
81
+ return await this.graphql("bookmarkTweetToFolder", {
82
+ body: {
83
+ variables: {
84
+ tweet_id: tweetId,
85
+ bookmark_collection_id: folderId,
99
86
  },
100
- });
101
- },
87
+ },
88
+ });
89
+ }
102
90
 
103
- async folderTimeline(folderId, opts = {}) {
104
- const raw = await client.graphql("BookmarkFolderTimeline", {
91
+ export async function removeFromFolder(tweetId, folderId) {
92
+ return await this.graphql("RemoveTweetFromBookmarkFolder", {
93
+ body: {
105
94
  variables: {
95
+ tweet_id: tweetId,
106
96
  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
97
  },
117
- });
118
- return parseTimeline(raw);
119
- },
120
- });
98
+ },
99
+ });
100
+ }
101
+
102
+ export async function folderTimeline(folderId, opts = {}) {
103
+ const raw = await this.graphql("BookmarkFolderTimeline", {
104
+ variables: {
105
+ bookmark_collection_id: folderId,
106
+ count: opts.count || 20,
107
+ cursor: opts.cursor,
108
+ includePromotedContent: false,
109
+ ...opts.variables,
110
+ },
111
+ fieldToggles: {
112
+ withArticlePlainText: false,
113
+ withArticleRichContentState: false,
114
+ withAuxiliaryUserLabels: false,
115
+ },
116
+ });
117
+ return parseTimeline(raw);
118
+ }