@pipedream/twitter 0.3.2 → 0.3.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.
- package/actions/add-user-to-list/add-user-to-list.mjs +62 -0
- package/actions/advanced-search/advanced-search.mjs +113 -0
- package/actions/common.mjs +29 -0
- package/actions/create-tweet/create-tweet.mjs +146 -0
- package/actions/delete-tweet/delete-tweet.mjs +42 -0
- package/actions/follow-user/follow-user.mjs +48 -0
- package/actions/get-tweet/get-tweet.mjs +42 -0
- package/actions/get-user/get-user.mjs +50 -0
- package/actions/like-tweet/like-tweet.mjs +42 -0
- package/actions/list-favorites/list-favorites.mjs +63 -0
- package/actions/list-followers/list-followers.mjs +67 -0
- package/actions/list-lists/list-lists.mjs +69 -0
- package/actions/list-mentions/list-mentions.mjs +55 -0
- package/actions/list-pending-followers/list-pending-followers.mjs +32 -0
- package/actions/list-retweets/list-retweets.mjs +54 -0
- package/actions/list-user-tweets/list-user-tweets.mjs +80 -0
- package/actions/retweet/retweet.mjs +27 -0
- package/actions/simple-search/simple-search.mjs +62 -0
- package/actions/simple-search-in-list/simple-search-in-list.mjs +48 -0
- package/actions/unfollow-user/unfollow-user.mjs +48 -0
- package/actions/unlike-tweet/unlike-tweet.mjs +40 -0
- package/package.json +21 -21
- package/readme.md +0 -4
- package/sources/common/followed.mjs +37 -0
- package/sources/common/followers.mjs +158 -0
- package/sources/common/tweets.mjs +154 -0
- package/sources/{language-codes.js → language-codes.mjs} +6 -2
- package/sources/my-liked-tweets/my-liked-tweets.mjs +29 -0
- package/sources/my-tweets/my-tweets.mjs +48 -0
- package/sources/new-follower-of-me/new-follower-of-me.mjs +69 -0
- package/sources/new-follower-of-user/new-follower-of-user.mjs +25 -0
- package/sources/new-list-followed/new-list-followed.mjs +24 -0
- package/sources/new-trends-by-geo/new-trends-by-geo.mjs +39 -0
- package/sources/new-tweet-in-list/new-tweet-in-list.mjs +49 -0
- package/sources/new-unfollower-of-me/{new-unfollower-of-me.js → new-unfollower-of-me.mjs} +5 -4
- package/sources/new-unfollower-of-user/new-unfollower-of-user.mjs +25 -0
- package/sources/new-user-followed/new-user-followed.mjs +25 -0
- package/sources/search-mentions/search-mentions.mjs +143 -0
- package/sources/tweets-liked-by-user/tweets-liked-by-user.mjs +37 -0
- package/sources/user-tweets/user-tweets.mjs +49 -0
- package/sources/watch-retweets-of-me/watch-retweets-of-me.mjs +36 -0
- package/sources/watch-retweets-of-my-tweet/watch-retweets-of-my-tweet.mjs +44 -0
- package/sources/watch-retweets-of-user-tweet/watch-retweets-of-user-tweet.mjs +34 -0
- package/twitter.app.mjs +1149 -0
- package/sources/common-followers.js +0 -99
- package/sources/my-liked-tweets/my-liked-tweets.js +0 -26
- package/sources/my-tweets/my-tweets.js +0 -83
- package/sources/new-follower-of-me/new-follower-of-me.js +0 -68
- package/sources/new-follower-of-user/new-follower-of-user.js +0 -69
- package/sources/new-trends-by-geo/new-trends-by-geo.js +0 -29
- package/sources/new-unfollower-of-user/new-unfollower-of-user.js +0 -22
- package/sources/search-mentions/search-mentions.js +0 -76
- package/sources/tweets-liked-by-user/tweets-liked-by-user.js +0 -27
- package/sources/user-tweets/user-tweets.js +0 -66
- package/twitter.app.js +0 -461
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import twitter from "../../twitter.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "twitter-add-user-to-list",
|
|
5
|
+
name: "Add User To List",
|
|
6
|
+
description: "Add a member to a list. The authenticated user must own the list to be able to add members to it. [See the docs here](https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
twitter,
|
|
11
|
+
list: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
twitter,
|
|
14
|
+
"listSlug",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
userId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
twitter,
|
|
20
|
+
"userId",
|
|
21
|
+
],
|
|
22
|
+
optional: true,
|
|
23
|
+
},
|
|
24
|
+
screenName: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
twitter,
|
|
27
|
+
"screenName",
|
|
28
|
+
],
|
|
29
|
+
optional: true,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
async run({ $ }) {
|
|
33
|
+
const {
|
|
34
|
+
list,
|
|
35
|
+
userId,
|
|
36
|
+
screenName,
|
|
37
|
+
} = this;
|
|
38
|
+
|
|
39
|
+
if (!userId && !screenName) {
|
|
40
|
+
throw new Error("This action requires either User ID or Screen Name. Please enter one or the other above.");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const { screen_name: ownerScreenName } = await this.twitter.verifyCredentials({
|
|
44
|
+
$,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const params = {
|
|
48
|
+
slug: list,
|
|
49
|
+
ownerScreenName,
|
|
50
|
+
};
|
|
51
|
+
if (userId) params.userId = userId;
|
|
52
|
+
if (screenName) params.screenName = screenName;
|
|
53
|
+
|
|
54
|
+
const res = await this.twitter.addUserToList({
|
|
55
|
+
$,
|
|
56
|
+
...params,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
$.export("$summary", "User successfully added to the list");
|
|
60
|
+
return res;
|
|
61
|
+
},
|
|
62
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import twitter from "../../twitter.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "twitter-advanced-search",
|
|
5
|
+
name: "Advanced Search",
|
|
6
|
+
description: "Return Tweets that matches your search criteria. [See the docs here](https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/api-reference/get-search-tweets)",
|
|
7
|
+
version: "0.0.3",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
db: "$.service.db",
|
|
11
|
+
twitter,
|
|
12
|
+
q: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
twitter,
|
|
15
|
+
"q",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
resultType: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
twitter,
|
|
21
|
+
"resultType",
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
includeRetweets: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
twitter,
|
|
27
|
+
"includeRetweets",
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
includeReplies: {
|
|
31
|
+
propDefinition: [
|
|
32
|
+
twitter,
|
|
33
|
+
"includeReplies",
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
lang: {
|
|
37
|
+
propDefinition: [
|
|
38
|
+
twitter,
|
|
39
|
+
"lang",
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
locale: {
|
|
43
|
+
propDefinition: [
|
|
44
|
+
twitter,
|
|
45
|
+
"locale",
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
geocode: {
|
|
49
|
+
propDefinition: [
|
|
50
|
+
twitter,
|
|
51
|
+
"geocode",
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
sinceId: {
|
|
55
|
+
propDefinition: [
|
|
56
|
+
twitter,
|
|
57
|
+
"sinceId",
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
enrichTweets: {
|
|
61
|
+
propDefinition: [
|
|
62
|
+
twitter,
|
|
63
|
+
"enrichTweets",
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
count: {
|
|
67
|
+
propDefinition: [
|
|
68
|
+
twitter,
|
|
69
|
+
"count",
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
maxRequests: {
|
|
73
|
+
propDefinition: [
|
|
74
|
+
twitter,
|
|
75
|
+
"maxRequests",
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
async run({ $ }) {
|
|
80
|
+
const {
|
|
81
|
+
lang,
|
|
82
|
+
locale,
|
|
83
|
+
geocode,
|
|
84
|
+
resultType,
|
|
85
|
+
enrichTweets,
|
|
86
|
+
includeReplies,
|
|
87
|
+
includeRetweets,
|
|
88
|
+
sinceId,
|
|
89
|
+
maxRequests,
|
|
90
|
+
count,
|
|
91
|
+
q,
|
|
92
|
+
} = this;
|
|
93
|
+
|
|
94
|
+
// run paginated search
|
|
95
|
+
const res = await this.twitter.paginatedSearch({
|
|
96
|
+
$,
|
|
97
|
+
q,
|
|
98
|
+
sinceId,
|
|
99
|
+
lang,
|
|
100
|
+
locale,
|
|
101
|
+
geocode,
|
|
102
|
+
resultType,
|
|
103
|
+
enrichTweets,
|
|
104
|
+
includeReplies,
|
|
105
|
+
includeRetweets,
|
|
106
|
+
maxRequests,
|
|
107
|
+
count,
|
|
108
|
+
limitFirstPage: false,
|
|
109
|
+
});
|
|
110
|
+
$.export("$summary", "Search completed successfully");
|
|
111
|
+
return res;
|
|
112
|
+
},
|
|
113
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import twitter from "../twitter.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
props: {
|
|
5
|
+
twitter,
|
|
6
|
+
},
|
|
7
|
+
methods: {
|
|
8
|
+
async *paginate(resourceFn, params = {}, resourceType = null) {
|
|
9
|
+
const { maxRequests = 1 } = params;
|
|
10
|
+
delete params.maxResults;
|
|
11
|
+
let count = 0;
|
|
12
|
+
let cursor = true;
|
|
13
|
+
while (cursor && count < maxRequests) {
|
|
14
|
+
const results = await resourceFn(params);
|
|
15
|
+
const items = resourceType
|
|
16
|
+
? results[resourceType]
|
|
17
|
+
: results;
|
|
18
|
+
for (const item of items) {
|
|
19
|
+
yield item;
|
|
20
|
+
}
|
|
21
|
+
cursor = results.next_cursor;
|
|
22
|
+
if (cursor) {
|
|
23
|
+
params.cursor = cursor;
|
|
24
|
+
}
|
|
25
|
+
count++;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import twitter from "../../twitter.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "twitter-create-tweet",
|
|
5
|
+
name: "Create Tweet",
|
|
6
|
+
description: "Create a new tweet. [See the docs here](https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-update)",
|
|
7
|
+
version: "0.0.3",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
twitter,
|
|
11
|
+
status: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
twitter,
|
|
14
|
+
"status",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
inReplyToStatusId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
twitter,
|
|
20
|
+
"inReplyToStatusId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
autoPopulateReplyMetadata: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
twitter,
|
|
26
|
+
"autoPopulateReplyMetadata",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
excludeReplyUserIds: {
|
|
30
|
+
propDefinition: [
|
|
31
|
+
twitter,
|
|
32
|
+
"excludeReplyUserIds",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
attachmentUrl: {
|
|
36
|
+
propDefinition: [
|
|
37
|
+
twitter,
|
|
38
|
+
"attachmentUrl",
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
mediaIds: {
|
|
42
|
+
propDefinition: [
|
|
43
|
+
twitter,
|
|
44
|
+
"mediaIds",
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
possiblySensitive: {
|
|
48
|
+
propDefinition: [
|
|
49
|
+
twitter,
|
|
50
|
+
"possiblySensitive",
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
lat: {
|
|
54
|
+
propDefinition: [
|
|
55
|
+
twitter,
|
|
56
|
+
"lat",
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
long: {
|
|
60
|
+
propDefinition: [
|
|
61
|
+
twitter,
|
|
62
|
+
"long",
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
placeId: {
|
|
66
|
+
propDefinition: [
|
|
67
|
+
twitter,
|
|
68
|
+
"placeId",
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
displayCoordinates: {
|
|
72
|
+
propDefinition: [
|
|
73
|
+
twitter,
|
|
74
|
+
"displayCoordinates",
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
trimUser: {
|
|
78
|
+
propDefinition: [
|
|
79
|
+
twitter,
|
|
80
|
+
"trimUser",
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
enableDmcommands: {
|
|
84
|
+
propDefinition: [
|
|
85
|
+
twitter,
|
|
86
|
+
"enableDmcommands",
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
failDmcommands: {
|
|
90
|
+
propDefinition: [
|
|
91
|
+
twitter,
|
|
92
|
+
"failDmcommands",
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
cardUri: {
|
|
96
|
+
propDefinition: [
|
|
97
|
+
twitter,
|
|
98
|
+
"cardUri",
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
async run({ $ }) {
|
|
103
|
+
const {
|
|
104
|
+
status,
|
|
105
|
+
inReplyToStatusId,
|
|
106
|
+
autoPopulateReplyMetadata,
|
|
107
|
+
excludeReplyUserIds,
|
|
108
|
+
attachmentUrl,
|
|
109
|
+
mediaIds,
|
|
110
|
+
possiblySensitive,
|
|
111
|
+
lat,
|
|
112
|
+
long,
|
|
113
|
+
placeId,
|
|
114
|
+
displayCoordinates,
|
|
115
|
+
trimUser,
|
|
116
|
+
enableDmcommands,
|
|
117
|
+
failDmcommands,
|
|
118
|
+
cardUri,
|
|
119
|
+
} = this;
|
|
120
|
+
|
|
121
|
+
const params = {
|
|
122
|
+
status,
|
|
123
|
+
inReplyToStatusId,
|
|
124
|
+
autoPopulateReplyMetadata,
|
|
125
|
+
excludeReplyUserIds,
|
|
126
|
+
attachmentUrl,
|
|
127
|
+
media_ids: mediaIds,
|
|
128
|
+
possiblySensitive,
|
|
129
|
+
lat,
|
|
130
|
+
long,
|
|
131
|
+
placeId,
|
|
132
|
+
displayCoordinates,
|
|
133
|
+
trimUser,
|
|
134
|
+
enableDmcommands,
|
|
135
|
+
failDmcommands,
|
|
136
|
+
cardUri,
|
|
137
|
+
};
|
|
138
|
+
Object.keys(params).forEach((k) => params[k] == "" && delete params[k]);
|
|
139
|
+
const res = await this.twitter.createTweet({
|
|
140
|
+
$,
|
|
141
|
+
params,
|
|
142
|
+
});
|
|
143
|
+
$.export("$summary", "Successfully posted tweet");
|
|
144
|
+
return res;
|
|
145
|
+
},
|
|
146
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import twitter from "../../twitter.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "twitter-delete-tweet",
|
|
5
|
+
name: "Delete Tweet",
|
|
6
|
+
description: "Remove a posted tweet. [See the docs here](https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-destroy-id)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
twitter,
|
|
11
|
+
tweetID: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
twitter,
|
|
14
|
+
"tweetID",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
trimUser: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
twitter,
|
|
20
|
+
"trimUser",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
async run({ $ }) {
|
|
25
|
+
const {
|
|
26
|
+
tweetID,
|
|
27
|
+
trimUser,
|
|
28
|
+
} = this;
|
|
29
|
+
|
|
30
|
+
const params = {
|
|
31
|
+
tweetID,
|
|
32
|
+
trimUser,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const res = await this.twitter.deleteTweet({
|
|
36
|
+
$,
|
|
37
|
+
...params,
|
|
38
|
+
});
|
|
39
|
+
$.export("$summary", "Successfully deleted tweet");
|
|
40
|
+
return res;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import twitter from "../../twitter.app.mjs";
|
|
2
|
+
import { ConfigurationError } from "@pipedream/platform";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "twitter-follow-user",
|
|
6
|
+
name: "Follow User",
|
|
7
|
+
description: "Follow a user specified by ID or screen name parameter. [See the docs here](https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/post-friendships-create)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
twitter,
|
|
12
|
+
userId: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
twitter,
|
|
15
|
+
"userId",
|
|
16
|
+
],
|
|
17
|
+
optional: true,
|
|
18
|
+
},
|
|
19
|
+
screenName: {
|
|
20
|
+
propDefinition: [
|
|
21
|
+
twitter,
|
|
22
|
+
"screenName",
|
|
23
|
+
],
|
|
24
|
+
optional: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
async run({ $ }) {
|
|
28
|
+
const {
|
|
29
|
+
userId,
|
|
30
|
+
screenName,
|
|
31
|
+
} = this;
|
|
32
|
+
|
|
33
|
+
if (!userId && !screenName) {
|
|
34
|
+
throw new ConfigurationError("This action requires either User ID or Screen Name. Please enter one or the other above.");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const params = {
|
|
38
|
+
user_id: userId,
|
|
39
|
+
screen_name: screenName,
|
|
40
|
+
};
|
|
41
|
+
const response = await this.twitter.followUser({
|
|
42
|
+
params,
|
|
43
|
+
$,
|
|
44
|
+
});
|
|
45
|
+
$.export("$summary", `Successfully followed user @${response.screen_name}`);
|
|
46
|
+
return response;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import twitter from "../../twitter.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "twitter-get-tweet",
|
|
5
|
+
name: "Get Tweet",
|
|
6
|
+
description: "Return a single tweet specified by ID. [See the docs here](https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-statuses-show-id)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
twitter,
|
|
11
|
+
id: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
twitter,
|
|
14
|
+
"tweetID",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
includeEntities: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
twitter,
|
|
20
|
+
"includeEntities",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
async run({ $ }) {
|
|
25
|
+
const {
|
|
26
|
+
id,
|
|
27
|
+
includeEntities,
|
|
28
|
+
} = this;
|
|
29
|
+
|
|
30
|
+
const params = {
|
|
31
|
+
id,
|
|
32
|
+
includeEntities,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const res = await this.twitter.getTweet({
|
|
36
|
+
$,
|
|
37
|
+
...params,
|
|
38
|
+
});
|
|
39
|
+
$.export("$summary", "Successfully retrieved tweet");
|
|
40
|
+
return res;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import twitter from "../../twitter.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "twitter-get-user",
|
|
5
|
+
name: "Get User",
|
|
6
|
+
description: "Return information about the user specified by ID or screen name parameter. [See the docs here](https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
twitter,
|
|
11
|
+
userId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
twitter,
|
|
14
|
+
"userId",
|
|
15
|
+
],
|
|
16
|
+
optional: true,
|
|
17
|
+
},
|
|
18
|
+
screenName: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
twitter,
|
|
21
|
+
"screenName",
|
|
22
|
+
],
|
|
23
|
+
optional: true,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
async run({ $ }) {
|
|
27
|
+
const {
|
|
28
|
+
userId,
|
|
29
|
+
screenName,
|
|
30
|
+
} = this;
|
|
31
|
+
|
|
32
|
+
if (!userId && !screenName) {
|
|
33
|
+
throw new Error("This action requires either User ID or Screen Name. Please enter one or the other above.");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const userIdArray = [
|
|
37
|
+
userId,
|
|
38
|
+
];
|
|
39
|
+
const screenNameArray = [
|
|
40
|
+
screenName,
|
|
41
|
+
];
|
|
42
|
+
const res = await this.twitter.lookupUsers({
|
|
43
|
+
$,
|
|
44
|
+
userIdArray,
|
|
45
|
+
screenNameArray,
|
|
46
|
+
});
|
|
47
|
+
$.export("$summary", "Successfully retrieved user");
|
|
48
|
+
return res;
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import twitter from "../../twitter.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "twitter-like-tweet",
|
|
5
|
+
name: "Like Tweet",
|
|
6
|
+
description: "Like the tweet specified specified in the ID parameter. [See the docs here](https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-favorites-create)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
twitter,
|
|
11
|
+
id: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
twitter,
|
|
14
|
+
"tweetID",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
includeEntities: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
twitter,
|
|
20
|
+
"includeEntities",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
async run({ $ }) {
|
|
25
|
+
const {
|
|
26
|
+
id,
|
|
27
|
+
includeEntities,
|
|
28
|
+
} = this;
|
|
29
|
+
|
|
30
|
+
const params = {
|
|
31
|
+
id,
|
|
32
|
+
includeEntities,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const res = await this.twitter.likeTweet({
|
|
36
|
+
$,
|
|
37
|
+
...params,
|
|
38
|
+
});
|
|
39
|
+
$.export("$summary", "Successfully liked tweet");
|
|
40
|
+
return res;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import common from "../common.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "twitter-list-favorites",
|
|
6
|
+
name: "List Favorites",
|
|
7
|
+
description: "Return the most recent tweets liked by you or the specified user. [See the docs here](https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-favorites-list)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
...common.props,
|
|
12
|
+
screenName: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
common.props.twitter,
|
|
15
|
+
"screenName",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
count: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
common.props.twitter,
|
|
21
|
+
"count",
|
|
22
|
+
],
|
|
23
|
+
description: "Specifies the number of records to retrieve. Must be less than or equal to `200`; defaults to `20`.",
|
|
24
|
+
optional: true,
|
|
25
|
+
default: 20,
|
|
26
|
+
},
|
|
27
|
+
maxRequests: {
|
|
28
|
+
propDefinition: [
|
|
29
|
+
common.props.twitter,
|
|
30
|
+
"maxRequests",
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
includeEntities: {
|
|
34
|
+
propDefinition: [
|
|
35
|
+
common.props.twitter,
|
|
36
|
+
"includeEntities",
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
async run({ $ }) {
|
|
41
|
+
const {
|
|
42
|
+
screenName,
|
|
43
|
+
count,
|
|
44
|
+
maxRequests,
|
|
45
|
+
includeEntities,
|
|
46
|
+
} = this;
|
|
47
|
+
|
|
48
|
+
const params = {
|
|
49
|
+
$,
|
|
50
|
+
screenName,
|
|
51
|
+
count,
|
|
52
|
+
maxRequests,
|
|
53
|
+
include_entities: includeEntities,
|
|
54
|
+
};
|
|
55
|
+
const tweets = await this.paginate(this.twitter.getLikedTweets.bind(this), params);
|
|
56
|
+
const results = [];
|
|
57
|
+
for await (const tweet of tweets) {
|
|
58
|
+
results.push(tweet);
|
|
59
|
+
}
|
|
60
|
+
$.export("$summary", "Successfully retrieved favorites");
|
|
61
|
+
return results;
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import common from "../common.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "twitter-list-followers",
|
|
6
|
+
name: "List Followers",
|
|
7
|
+
description: "Return a collection of user objects for users following the specified user. [See the docs here](https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-followers-list)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
...common.props,
|
|
12
|
+
userId: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
common.props.twitter,
|
|
15
|
+
"userId",
|
|
16
|
+
],
|
|
17
|
+
optional: true,
|
|
18
|
+
},
|
|
19
|
+
screenName: {
|
|
20
|
+
propDefinition: [
|
|
21
|
+
common.props.twitter,
|
|
22
|
+
"screenName",
|
|
23
|
+
],
|
|
24
|
+
optional: true,
|
|
25
|
+
},
|
|
26
|
+
maxRequests: {
|
|
27
|
+
propDefinition: [
|
|
28
|
+
common.props.twitter,
|
|
29
|
+
"maxRequests",
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
includeUserEntities: {
|
|
33
|
+
propDefinition: [
|
|
34
|
+
common.props.twitter,
|
|
35
|
+
"includeUserEntities",
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
async run({ $ }) {
|
|
40
|
+
const {
|
|
41
|
+
userId,
|
|
42
|
+
screenName,
|
|
43
|
+
maxRequests,
|
|
44
|
+
includeUserEntities,
|
|
45
|
+
} = this;
|
|
46
|
+
|
|
47
|
+
if (!userId && !screenName) {
|
|
48
|
+
throw new Error("This action requires either User ID or Screen Name. Please enter one or the other above.");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const params = {
|
|
52
|
+
$,
|
|
53
|
+
userId,
|
|
54
|
+
screenName,
|
|
55
|
+
maxRequests,
|
|
56
|
+
includeUserEntities,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const followers = await this.paginate(this.twitter.getFollowers.bind(this), params, "users");
|
|
60
|
+
const results = [];
|
|
61
|
+
for await (const follower of followers) {
|
|
62
|
+
results.push(follower);
|
|
63
|
+
}
|
|
64
|
+
$.export("$summary", "Successfully retrieved followers");
|
|
65
|
+
return results;
|
|
66
|
+
},
|
|
67
|
+
};
|