@pipedream/twitter 1.0.0 → 1.1.0
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/README.md +1 -3
- package/dist/actions/add-user-to-list/add-user-to-list.d.ts +3 -189
- package/dist/actions/add-user-to-list/add-user-to-list.mjs +4 -2
- package/dist/actions/create-tweet/create-tweet.d.ts +1 -63
- package/dist/actions/create-tweet/create-tweet.mjs +2 -2
- package/dist/actions/delete-tweet/delete-tweet.d.ts +2 -126
- package/dist/actions/delete-tweet/delete-tweet.mjs +4 -3
- package/dist/actions/follow-user/follow-user.d.ts +2 -126
- package/dist/actions/follow-user/follow-user.mjs +2 -2
- package/dist/actions/get-tweet/get-tweet.d.ts +2 -876
- package/dist/actions/get-tweet/get-tweet.mjs +4 -5
- package/dist/actions/get-user/get-user.d.ts +2 -503
- package/dist/actions/get-user/get-user.mjs +10 -7
- package/dist/actions/like-tweet/like-tweet.d.ts +2 -126
- package/dist/actions/like-tweet/like-tweet.mjs +4 -3
- package/dist/actions/list-favorites/list-favorites.d.ts +46 -982
- package/dist/actions/list-favorites/list-favorites.mjs +1 -3
- package/dist/actions/list-followers/list-followers.d.ts +46 -609
- package/dist/actions/list-followers/list-followers.mjs +1 -3
- package/dist/actions/list-lists/list-lists.d.ts +46 -608
- package/dist/actions/list-lists/list-lists.mjs +1 -3
- package/dist/actions/list-mentions/list-mentions.d.ts +46 -982
- package/dist/actions/list-mentions/list-mentions.mjs +1 -3
- package/dist/actions/list-user-tweets/list-user-tweets.d.ts +46 -982
- package/dist/actions/list-user-tweets/list-user-tweets.mjs +1 -3
- package/dist/actions/retweet/retweet.d.ts +2 -126
- package/dist/actions/retweet/retweet.mjs +6 -3
- package/dist/actions/simple-search/simple-search.d.ts +46 -982
- package/dist/actions/simple-search/simple-search.mjs +2 -3
- package/dist/actions/simple-search-in-list/simple-search-in-list.d.ts +51 -987
- package/dist/actions/simple-search-in-list/simple-search-in-list.mjs +1 -3
- package/dist/actions/unfollow-user/unfollow-user.d.ts +2 -126
- package/dist/actions/unfollow-user/unfollow-user.mjs +1 -1
- package/dist/actions/unlike-tweet/unlike-tweet.d.ts +2 -126
- package/dist/actions/unlike-tweet/unlike-tweet.mjs +4 -3
- package/dist/app/twitter.app.d.ts +2 -64
- package/dist/app/twitter.app.mjs +19 -69
- package/dist/common/additionalProps.d.ts +0 -0
- package/dist/common/additionalProps.mjs +138 -0
- package/dist/common/methods.mjs +36 -15
- package/dist/common/types/requestParams.d.ts +3 -1
- package/dist/sources/common/base.d.ts +2 -64
- package/dist/sources/common/base.mjs +5 -7
- package/dist/sources/new-follower-of-user/new-follower-of-user.d.ts +4 -505
- package/dist/sources/new-follower-of-user/new-follower-of-user.mjs +4 -8
- package/dist/sources/new-list-followed/new-list-followed.d.ts +4 -504
- package/dist/sources/new-list-followed/new-list-followed.mjs +4 -8
- package/dist/sources/new-tweet-in-list/new-tweet-in-list.d.ts +4 -878
- package/dist/sources/new-tweet-in-list/new-tweet-in-list.mjs +4 -8
- package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.d.ts +4 -878
- package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.mjs +4 -8
- package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.d.ts +4 -878
- package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.mjs +4 -8
- package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.d.ts +4 -878
- package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.mjs +4 -11
- package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.d.ts +2 -126
- package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.mjs +1 -1
- package/dist/sources/new-user-followed/new-user-followed.d.ts +4 -505
- package/dist/sources/new-user-followed/new-user-followed.mjs +4 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/common/propGroups.d.ts +0 -1509
- package/dist/common/propGroups.mjs +0 -82
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// This is no longer being used. Requests send all the available fields by default.
|
|
2
|
+
// If it ever makes sense to allow customizing which fields are sent, this can be re-enabled
|
|
3
|
+
/*
|
|
4
|
+
import {
|
|
5
|
+
LIST_FIELD_OPTIONS,
|
|
6
|
+
MEDIA_FIELD_OPTIONS,
|
|
7
|
+
PLACE_FIELD_OPTIONS,
|
|
8
|
+
POLL_FIELD_OPTIONS,
|
|
9
|
+
TWEET_FIELD_OPTIONS,
|
|
10
|
+
USER_FIELD_OPTIONS,
|
|
11
|
+
} from "./dataFields.mjs";
|
|
12
|
+
import {
|
|
13
|
+
LIST_EXPANSION_OPTIONS,
|
|
14
|
+
TWEET_EXPANSION_OPTIONS,
|
|
15
|
+
USER_EXPANSION_OPTIONS,
|
|
16
|
+
} from "./expansions.mjs";
|
|
17
|
+
|
|
18
|
+
// These cannot be propDefinitions in the app file, because additionalProps() needs them to be primitives
|
|
19
|
+
const listExpansions = {
|
|
20
|
+
type: "string[]",
|
|
21
|
+
label: "Expansions",
|
|
22
|
+
optional: true,
|
|
23
|
+
description:
|
|
24
|
+
"Additional data objects related to the List(s) to be included in the response.",
|
|
25
|
+
options: LIST_EXPANSION_OPTIONS,
|
|
26
|
+
};
|
|
27
|
+
const tweetExpansions = {
|
|
28
|
+
type: "string[]",
|
|
29
|
+
label: "Expansions",
|
|
30
|
+
optional: true,
|
|
31
|
+
description:
|
|
32
|
+
"Additional data objects related to the Tweet(s) to be included in the response.",
|
|
33
|
+
options: TWEET_EXPANSION_OPTIONS,
|
|
34
|
+
};
|
|
35
|
+
const userExpansions = {
|
|
36
|
+
type: "string[]",
|
|
37
|
+
label: "Expansions",
|
|
38
|
+
optional: true,
|
|
39
|
+
description:
|
|
40
|
+
"Additional data objects related to the User(s) to be included in the response.",
|
|
41
|
+
options: USER_EXPANSION_OPTIONS,
|
|
42
|
+
};
|
|
43
|
+
const listFields = {
|
|
44
|
+
type: "string[]",
|
|
45
|
+
label: "List Fields",
|
|
46
|
+
description:
|
|
47
|
+
"Specific [list fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/lists) to be included in the returned list object.",
|
|
48
|
+
optional: true,
|
|
49
|
+
options: LIST_FIELD_OPTIONS,
|
|
50
|
+
};
|
|
51
|
+
const mediaFields = {
|
|
52
|
+
type: "string[]",
|
|
53
|
+
label: "Media Fields",
|
|
54
|
+
description:
|
|
55
|
+
"Specific [media fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/media) to be included in the returned Tweet(s). Only applicable if the Tweet contains media and you've requested the `attachments.media_keys` expansion.",
|
|
56
|
+
optional: true,
|
|
57
|
+
options: MEDIA_FIELD_OPTIONS,
|
|
58
|
+
};
|
|
59
|
+
const placeFields = {
|
|
60
|
+
type: "string[]",
|
|
61
|
+
label: "Place Fields",
|
|
62
|
+
description:
|
|
63
|
+
"Specific [place fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/place) to be included in the returned Tweet(s). Only applicable if the Tweet contains a place and you've requested the `geo.place_id` expansion.",
|
|
64
|
+
optional: true,
|
|
65
|
+
options: PLACE_FIELD_OPTIONS,
|
|
66
|
+
};
|
|
67
|
+
const pollFields = {
|
|
68
|
+
type: "string[]",
|
|
69
|
+
label: "Poll Fields",
|
|
70
|
+
description:
|
|
71
|
+
"Specific [poll fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/poll) to be included in the returned Tweet(s). Only applicable if the Tweet contains a poll and you've requested the `attachments.poll_ids` expansion.",
|
|
72
|
+
optional: true,
|
|
73
|
+
options: POLL_FIELD_OPTIONS,
|
|
74
|
+
};
|
|
75
|
+
const tweetFields = {
|
|
76
|
+
type: "string[]",
|
|
77
|
+
label: "Tweet Fields",
|
|
78
|
+
description:
|
|
79
|
+
"Specific [tweet fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) to be included in the returned Tweet(s). If you've requested the `referenced_tweets.id` expansion, these fields will also be returned for any included referenced Tweets.",
|
|
80
|
+
optional: true,
|
|
81
|
+
options: TWEET_FIELD_OPTIONS,
|
|
82
|
+
};
|
|
83
|
+
const userFields = {
|
|
84
|
+
type: "string[]",
|
|
85
|
+
label: "User Fields",
|
|
86
|
+
description:
|
|
87
|
+
"Specific [user fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user) to be included in the returned Tweet(s). Only applicable if you've requested one of the user expansions: `author_id`, `entities.mentions.username`, `in_reply_to_user_id`, `referenced_tweets.id.author_id`.",
|
|
88
|
+
optional: true,
|
|
89
|
+
options: USER_FIELD_OPTIONS,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// The 'any' here is needed because of the additionalProps behavior
|
|
93
|
+
|
|
94
|
+
export async function listAdditionalProps(): Promise<Record<string, any>> {
|
|
95
|
+
return this.includeAllFields === false
|
|
96
|
+
? {
|
|
97
|
+
expansions: listExpansions,
|
|
98
|
+
listFields,
|
|
99
|
+
userFields: {
|
|
100
|
+
...userFields,
|
|
101
|
+
description:
|
|
102
|
+
"Specific [user fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user) to be included in the returned user object. Only applicable if you've requested the `owner_id` expansion.",
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
: {};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export async function tweetAdditionalProps(): Promise<Record<string, any>> {
|
|
109
|
+
return this.includeAllFields === false
|
|
110
|
+
? {
|
|
111
|
+
expansions: tweetExpansions,
|
|
112
|
+
mediaFields,
|
|
113
|
+
placeFields,
|
|
114
|
+
pollFields,
|
|
115
|
+
tweetFields,
|
|
116
|
+
userFields,
|
|
117
|
+
}
|
|
118
|
+
: {};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export async function userAdditionalProps(): Promise<Record<string, any>> {
|
|
122
|
+
return this.includeAllFields === false
|
|
123
|
+
? {
|
|
124
|
+
expansions: userExpansions,
|
|
125
|
+
tweetFields: {
|
|
126
|
+
...tweetFields,
|
|
127
|
+
description:
|
|
128
|
+
"Specific [tweet fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) to be included in the returned pinned Tweet. Only applicable if the user has a pinned Tweet and you've requested the `referenced_tweets.id` expansion.",
|
|
129
|
+
},
|
|
130
|
+
userFields: {
|
|
131
|
+
...userFields,
|
|
132
|
+
description:
|
|
133
|
+
"Specific [user fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user) to be included in the returned user object.",
|
|
134
|
+
},
|
|
135
|
+
}
|
|
136
|
+
: {};
|
|
137
|
+
}
|
|
138
|
+
*/
|
package/dist/common/methods.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ConfigurationError } from "@pipedream/platform";
|
|
2
|
+
import { LIST_FIELD_OPTIONS, MEDIA_FIELD_OPTIONS, PLACE_FIELD_OPTIONS, POLL_FIELD_OPTIONS, TWEET_FIELD_OPTIONS, USER_FIELD_OPTIONS, } from "./dataFields.mjs";
|
|
3
|
+
import { LIST_EXPANSION_OPTIONS, USER_EXPANSION_OPTIONS, } from "./expansions.mjs";
|
|
2
4
|
export async function getUserId() {
|
|
3
5
|
let { userNameOrId: id } = this;
|
|
4
6
|
if (id === "me" || id === undefined) {
|
|
@@ -20,29 +22,48 @@ export function getMultiItemSummary(name, length) {
|
|
|
20
22
|
: `No ${name}s were found`;
|
|
21
23
|
}
|
|
22
24
|
export function getListFields() {
|
|
23
|
-
|
|
25
|
+
// See comment on "../common/additionalProps.ts"
|
|
26
|
+
/*
|
|
27
|
+
const {
|
|
28
|
+
includeAllFields, expansions, listFields, userFields,
|
|
29
|
+
}: Record<string, string[]> = this;
|
|
30
|
+
*/
|
|
24
31
|
return {
|
|
25
|
-
"expansions":
|
|
26
|
-
"list.fields":
|
|
27
|
-
"user.fields":
|
|
32
|
+
"expansions": LIST_EXPANSION_OPTIONS.join(),
|
|
33
|
+
"list.fields": LIST_FIELD_OPTIONS.join(),
|
|
34
|
+
"user.fields": USER_FIELD_OPTIONS.join(),
|
|
28
35
|
};
|
|
29
36
|
}
|
|
30
37
|
export function getTweetFields() {
|
|
31
|
-
|
|
38
|
+
/*
|
|
39
|
+
const {
|
|
40
|
+
includeAllFields,
|
|
41
|
+
expansions,
|
|
42
|
+
mediaFields,
|
|
43
|
+
placeFields,
|
|
44
|
+
pollFields,
|
|
45
|
+
tweetFields,
|
|
46
|
+
userFields,
|
|
47
|
+
}: Record<string, string[]> = this;
|
|
48
|
+
*/
|
|
32
49
|
return {
|
|
33
|
-
"expansions":
|
|
34
|
-
"media.fields":
|
|
35
|
-
"place.fields":
|
|
36
|
-
"poll.fields":
|
|
37
|
-
"tweet.fields":
|
|
38
|
-
"user.fields":
|
|
50
|
+
"expansions": LIST_EXPANSION_OPTIONS.join(),
|
|
51
|
+
"media.fields": MEDIA_FIELD_OPTIONS.join(),
|
|
52
|
+
"place.fields": PLACE_FIELD_OPTIONS.join(),
|
|
53
|
+
"poll.fields": POLL_FIELD_OPTIONS.join(),
|
|
54
|
+
"tweet.fields": TWEET_FIELD_OPTIONS.join(),
|
|
55
|
+
"user.fields": USER_FIELD_OPTIONS.join(),
|
|
39
56
|
};
|
|
40
57
|
}
|
|
41
58
|
export function getUserFields() {
|
|
42
|
-
|
|
59
|
+
/*
|
|
60
|
+
const {
|
|
61
|
+
includeAllFields, expansions, tweetFields, userFields,
|
|
62
|
+
}: Record<string, string[]> = this;
|
|
63
|
+
*/
|
|
43
64
|
return {
|
|
44
|
-
"expansions":
|
|
45
|
-
"tweet.fields":
|
|
46
|
-
"user.fields":
|
|
65
|
+
"expansions": USER_EXPANSION_OPTIONS.join(),
|
|
66
|
+
"tweet.fields": TWEET_FIELD_OPTIONS.join(),
|
|
67
|
+
"user.fields": USER_FIELD_OPTIONS.join(),
|
|
47
68
|
};
|
|
48
69
|
}
|
|
@@ -75,9 +75,11 @@ export interface GetUserTweetsParams extends PaginatedRequest, UserId {
|
|
|
75
75
|
export interface GetUserFollowedListsParams extends PaginatedRequest, UserId {
|
|
76
76
|
params?: ListFields;
|
|
77
77
|
}
|
|
78
|
-
export interface
|
|
78
|
+
export interface GetAuthenticatedUserParams extends PdAxiosRequest {
|
|
79
79
|
params?: UserFields;
|
|
80
80
|
}
|
|
81
|
+
export interface GetUserParams extends GetAuthenticatedUserParams, UserId {
|
|
82
|
+
}
|
|
81
83
|
export interface GetTweetParams extends PdAxiosRequest, TweetId {
|
|
82
84
|
params?: TweetFields;
|
|
83
85
|
}
|
|
@@ -12,6 +12,7 @@ declare const _default: {
|
|
|
12
12
|
followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
|
|
13
13
|
getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
|
|
14
14
|
getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").Tweet>>;
|
|
15
|
+
getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
|
|
15
16
|
getAuthenticatedUserId(): Promise<string>;
|
|
16
17
|
getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
|
|
17
18
|
getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
|
|
@@ -60,69 +61,6 @@ declare const _default: {
|
|
|
60
61
|
label: string;
|
|
61
62
|
description: string;
|
|
62
63
|
};
|
|
63
|
-
listExpansions: {
|
|
64
|
-
type: string;
|
|
65
|
-
label: string;
|
|
66
|
-
optional: boolean;
|
|
67
|
-
description: string;
|
|
68
|
-
options: string[];
|
|
69
|
-
};
|
|
70
|
-
tweetExpansions: {
|
|
71
|
-
type: string;
|
|
72
|
-
label: string;
|
|
73
|
-
optional: boolean;
|
|
74
|
-
description: string;
|
|
75
|
-
options: string[];
|
|
76
|
-
};
|
|
77
|
-
userExpansions: {
|
|
78
|
-
type: string;
|
|
79
|
-
label: string;
|
|
80
|
-
optional: boolean;
|
|
81
|
-
description: string;
|
|
82
|
-
options: string[];
|
|
83
|
-
};
|
|
84
|
-
listFields: {
|
|
85
|
-
type: string;
|
|
86
|
-
label: string;
|
|
87
|
-
description: string;
|
|
88
|
-
optional: boolean;
|
|
89
|
-
options: string[];
|
|
90
|
-
};
|
|
91
|
-
mediaFields: {
|
|
92
|
-
type: string;
|
|
93
|
-
label: string;
|
|
94
|
-
description: string;
|
|
95
|
-
optional: boolean;
|
|
96
|
-
options: string[];
|
|
97
|
-
};
|
|
98
|
-
placeFields: {
|
|
99
|
-
type: string;
|
|
100
|
-
label: string;
|
|
101
|
-
description: string;
|
|
102
|
-
optional: boolean;
|
|
103
|
-
options: string[];
|
|
104
|
-
};
|
|
105
|
-
pollFields: {
|
|
106
|
-
type: string;
|
|
107
|
-
label: string;
|
|
108
|
-
description: string;
|
|
109
|
-
optional: boolean;
|
|
110
|
-
options: string[];
|
|
111
|
-
};
|
|
112
|
-
tweetFields: {
|
|
113
|
-
type: string;
|
|
114
|
-
label: string;
|
|
115
|
-
description: string;
|
|
116
|
-
optional: boolean;
|
|
117
|
-
options: string[];
|
|
118
|
-
};
|
|
119
|
-
userFields: {
|
|
120
|
-
type: string;
|
|
121
|
-
label: string;
|
|
122
|
-
description: string;
|
|
123
|
-
optional: boolean;
|
|
124
|
-
options: string[];
|
|
125
|
-
};
|
|
126
64
|
}>;
|
|
127
65
|
db: string;
|
|
128
66
|
timer: {
|
|
@@ -141,7 +79,7 @@ declare const _default: {
|
|
|
141
79
|
getResources(): Promise<TwitterEntity[]>;
|
|
142
80
|
getSavedIds(): string[];
|
|
143
81
|
setSavedIds(data: string[]): void;
|
|
144
|
-
getAndProcessData(
|
|
82
|
+
getAndProcessData(maxResults?: number): Promise<void>;
|
|
145
83
|
emitEvent(data: TwitterEntity): void;
|
|
146
84
|
};
|
|
147
85
|
run(): Promise<void>;
|
|
@@ -32,16 +32,14 @@ export default {
|
|
|
32
32
|
setSavedIds(data) {
|
|
33
33
|
this.db.set("savedEntityIds", data);
|
|
34
34
|
},
|
|
35
|
-
async getAndProcessData(
|
|
36
|
-
const data = await this.getResources(
|
|
35
|
+
async getAndProcessData(maxResults) {
|
|
36
|
+
const data = await this.getResources(maxResults);
|
|
37
37
|
if (data) {
|
|
38
38
|
const savedIds = this.getSavedIds() ?? [];
|
|
39
39
|
data.filter(({ id }) => !savedIds.includes(id)).reverse()
|
|
40
40
|
.forEach((obj) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const { id } = obj;
|
|
44
|
-
savedIds.push(id);
|
|
41
|
+
this.emitEvent(obj);
|
|
42
|
+
savedIds.push(obj.id);
|
|
45
43
|
});
|
|
46
44
|
this.setSavedIds(savedIds);
|
|
47
45
|
}
|
|
@@ -57,6 +55,6 @@ export default {
|
|
|
57
55
|
},
|
|
58
56
|
},
|
|
59
57
|
async run() {
|
|
60
|
-
await this.getAndProcessData(
|
|
58
|
+
await this.getAndProcessData(50);
|
|
61
59
|
},
|
|
62
60
|
};
|