@pipedream/twitter 2.2.0 → 2.2.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.
Files changed (71) hide show
  1. package/dist/actions/add-user-to-list/add-user-to-list.d.ts +2 -199
  2. package/dist/actions/add-user-to-list/add-user-to-list.mjs +21 -24
  3. package/dist/actions/create-tweet/create-tweet.d.ts +17 -16
  4. package/dist/actions/create-tweet/create-tweet.mjs +29 -34
  5. package/dist/actions/delete-tweet/delete-tweet.d.ts +3 -133
  6. package/dist/actions/delete-tweet/delete-tweet.mjs +14 -18
  7. package/dist/actions/follow-user/follow-user.d.ts +2 -133
  8. package/dist/actions/follow-user/follow-user.mjs +19 -22
  9. package/dist/actions/get-tweet/get-tweet.d.ts +2 -134
  10. package/dist/actions/get-tweet/get-tweet.mjs +16 -19
  11. package/dist/actions/get-user/get-user.d.ts +2 -134
  12. package/dist/actions/get-user/get-user.mjs +19 -22
  13. package/dist/actions/like-tweet/like-tweet.d.ts +3 -133
  14. package/dist/actions/like-tweet/like-tweet.mjs +16 -20
  15. package/dist/actions/list-favorites/list-favorites.d.ts +2 -203
  16. package/dist/actions/list-favorites/list-favorites.mjs +19 -22
  17. package/dist/actions/list-followers/list-followers.d.ts +2 -203
  18. package/dist/actions/list-followers/list-followers.mjs +19 -22
  19. package/dist/actions/list-lists/list-lists.d.ts +2 -203
  20. package/dist/actions/list-lists/list-lists.mjs +19 -22
  21. package/dist/actions/list-mentions/list-mentions.d.ts +2 -203
  22. package/dist/actions/list-mentions/list-mentions.mjs +19 -22
  23. package/dist/actions/list-user-tweets/list-user-tweets.d.ts +2 -203
  24. package/dist/actions/list-user-tweets/list-user-tweets.mjs +19 -22
  25. package/dist/actions/retweet/retweet.d.ts +3 -133
  26. package/dist/actions/retweet/retweet.mjs +18 -22
  27. package/dist/actions/send-dm/send-dm.d.ts +2 -140
  28. package/dist/actions/send-dm/send-dm.mjs +18 -21
  29. package/dist/actions/simple-search/simple-search.d.ts +2 -203
  30. package/dist/actions/simple-search/simple-search.mjs +20 -23
  31. package/dist/actions/simple-search-in-list/simple-search-in-list.d.ts +2 -208
  32. package/dist/actions/simple-search-in-list/simple-search-in-list.mjs +23 -26
  33. package/dist/actions/unfollow-user/unfollow-user.d.ts +2 -133
  34. package/dist/actions/unfollow-user/unfollow-user.mjs +15 -18
  35. package/dist/actions/unlike-tweet/unlike-tweet.d.ts +3 -133
  36. package/dist/actions/unlike-tweet/unlike-tweet.mjs +14 -18
  37. package/dist/actions/upload-media/upload-media.d.ts +3 -82
  38. package/dist/actions/upload-media/upload-media.mjs +24 -21
  39. package/dist/app/twitter.app.d.ts +2 -1
  40. package/dist/app/twitter.app.mjs +40 -29
  41. package/dist/common/appValidation.d.ts +144 -0
  42. package/dist/common/appValidation.mjs +24 -0
  43. package/dist/common/errorMessage.d.ts +24 -2
  44. package/dist/common/errorMessage.mjs +25 -1
  45. package/dist/common/types/requestParams.d.ts +26 -22
  46. package/dist/sources/common/base.d.ts +137 -64
  47. package/dist/sources/common/base.mjs +8 -2
  48. package/dist/sources/new-follower-of-user/new-follower-of-user.d.ts +2 -140
  49. package/dist/sources/new-follower-of-user/new-follower-of-user.mjs +2 -3
  50. package/dist/sources/new-list-followed/new-list-followed.d.ts +2 -140
  51. package/dist/sources/new-list-followed/new-list-followed.mjs +2 -3
  52. package/dist/sources/new-mention-received-by-user/new-mention-received-by-user.d.ts +2 -140
  53. package/dist/sources/new-mention-received-by-user/new-mention-received-by-user.mjs +2 -3
  54. package/dist/sources/new-message/new-message.d.ts +2 -74
  55. package/dist/sources/new-message/new-message.mjs +1 -1
  56. package/dist/sources/new-tweet-in-list/new-tweet-in-list.d.ts +2 -140
  57. package/dist/sources/new-tweet-in-list/new-tweet-in-list.mjs +2 -3
  58. package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.d.ts +2 -140
  59. package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.mjs +2 -3
  60. package/dist/sources/new-tweet-metrics/new-tweet-metrics.d.ts +3 -148
  61. package/dist/sources/new-tweet-metrics/new-tweet-metrics.mjs +2 -3
  62. package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.d.ts +2 -140
  63. package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.mjs +2 -3
  64. package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.d.ts +2 -140
  65. package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.mjs +2 -3
  66. package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.d.ts +2 -140
  67. package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.mjs +2 -3
  68. package/dist/sources/new-user-followed/new-user-followed.d.ts +2 -139
  69. package/dist/sources/new-user-followed/new-user-followed.mjs +2 -3
  70. package/dist/tsconfig.tsbuildinfo +1 -1
  71. package/package.json +1 -1
@@ -1,210 +1,9 @@
1
1
  import { getMultiItemSummary, getTweetFields } from "../../common/methods.js";
2
- import { SearchTweetsParams } from "../../common/types/requestParams.js";
3
- import { PaginatedResponseObject, Tweet } from "../../common/types/responseSchemas.js";
4
2
  export declare const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-reference/get-tweets-search-recent";
5
3
  export declare const MAX_RESULTS_PER_PAGE = 100;
6
4
  declare const _default: import("@pipedream/types").Action<{
7
5
  getMultiItemSummary: typeof getMultiItemSummary;
8
6
  getTweetFields: typeof getTweetFields;
9
- }, {
10
- app: import("@pipedream/types").App<{
11
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
12
- _getBaseUrl(): "https://api.twitter.com/2";
13
- _httpRequest({ $, specialAuth, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
14
- _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
15
- addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
16
- createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
17
- deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
18
- followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
19
- getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
20
- getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<Tweet>>;
21
- getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
22
- getAuthenticatedUserId(): Promise<string>;
23
- getDirectMessages(args: import("../../common/types/requestParams.js").GetDirectMessagesParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").DirectMessage>>;
24
- getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<PaginatedResponseObject<Tweet>>;
25
- getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
26
- getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
27
- getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<PaginatedResponseObject<Tweet>>;
28
- getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
29
- getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
30
- getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
31
- likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
32
- getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
33
- getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
34
- retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
35
- searchTweets(args: SearchTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
36
- sendMessage({ userId, ...args }: import("../../common/types/requestParams.js").SendMessageParams): Promise<object>;
37
- unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
38
- unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
39
- uploadMedia(args: import("../../common/types/requestParams.js").UploadMediaParams): Promise<object>;
40
- }, {
41
- maxResults: {
42
- type: string;
43
- label: string;
44
- description: string;
45
- optional: boolean;
46
- };
47
- listId: {
48
- type: string;
49
- label: string;
50
- description: string;
51
- options(): Promise<{
52
- label: string;
53
- value: string;
54
- }[]>;
55
- };
56
- userNameOrId: {
57
- type: string;
58
- label: string;
59
- description: string;
60
- optional: boolean;
61
- default: string;
62
- };
63
- tweetId: {
64
- type: string;
65
- label: string;
66
- description: string;
67
- };
68
- query: {
69
- type: string;
70
- label: string;
71
- description: string;
72
- };
73
- }>;
74
- query: {
75
- propDefinition: (string | import("@pipedream/types").App<{
76
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
77
- _getBaseUrl(): "https://api.twitter.com/2";
78
- _httpRequest({ $, specialAuth, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
79
- _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
80
- addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
81
- createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
82
- deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
83
- followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
84
- getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
85
- getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<Tweet>>;
86
- getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
87
- getAuthenticatedUserId(): Promise<string>;
88
- getDirectMessages(args: import("../../common/types/requestParams.js").GetDirectMessagesParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").DirectMessage>>;
89
- getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<PaginatedResponseObject<Tweet>>;
90
- getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
91
- getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
92
- getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<PaginatedResponseObject<Tweet>>;
93
- getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
94
- getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
95
- getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
96
- likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
97
- getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
98
- getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
99
- retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
100
- searchTweets(args: SearchTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
101
- sendMessage({ userId, ...args }: import("../../common/types/requestParams.js").SendMessageParams): Promise<object>;
102
- unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
103
- unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
104
- uploadMedia(args: import("../../common/types/requestParams.js").UploadMediaParams): Promise<object>;
105
- }, {
106
- maxResults: {
107
- type: string;
108
- label: string;
109
- description: string;
110
- optional: boolean;
111
- };
112
- listId: {
113
- type: string;
114
- label: string;
115
- description: string;
116
- options(): Promise<{
117
- label: string;
118
- value: string;
119
- }[]>;
120
- };
121
- userNameOrId: {
122
- type: string;
123
- label: string;
124
- description: string;
125
- optional: boolean;
126
- default: string;
127
- };
128
- tweetId: {
129
- type: string;
130
- label: string;
131
- description: string;
132
- };
133
- query: {
134
- type: string;
135
- label: string;
136
- description: string;
137
- };
138
- }>)[];
139
- };
140
- maxResults: {
141
- propDefinition: (string | import("@pipedream/types").App<{
142
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
143
- _getBaseUrl(): "https://api.twitter.com/2";
144
- _httpRequest({ $, specialAuth, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
145
- _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
146
- addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
147
- createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
148
- deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
149
- followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
150
- getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
151
- getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<Tweet>>;
152
- getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
153
- getAuthenticatedUserId(): Promise<string>;
154
- getDirectMessages(args: import("../../common/types/requestParams.js").GetDirectMessagesParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").DirectMessage>>;
155
- getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<PaginatedResponseObject<Tweet>>;
156
- getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
157
- getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
158
- getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<PaginatedResponseObject<Tweet>>;
159
- getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
160
- getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
161
- getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
162
- likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
163
- getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
164
- getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
165
- retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
166
- searchTweets(args: SearchTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
167
- sendMessage({ userId, ...args }: import("../../common/types/requestParams.js").SendMessageParams): Promise<object>;
168
- unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
169
- unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
170
- uploadMedia(args: import("../../common/types/requestParams.js").UploadMediaParams): Promise<object>;
171
- }, {
172
- maxResults: {
173
- type: string;
174
- label: string;
175
- description: string;
176
- optional: boolean;
177
- };
178
- listId: {
179
- type: string;
180
- label: string;
181
- description: string;
182
- options(): Promise<{
183
- label: string;
184
- value: string;
185
- }[]>;
186
- };
187
- userNameOrId: {
188
- type: string;
189
- label: string;
190
- description: string;
191
- optional: boolean;
192
- default: string;
193
- };
194
- tweetId: {
195
- type: string;
196
- label: string;
197
- description: string;
198
- };
199
- query: {
200
- type: string;
201
- label: string;
202
- description: string;
203
- };
204
- }>)[];
205
- min: number;
206
- description: string;
207
- default: number;
208
- };
209
- }>;
7
+ getTweets(args?: {}): any;
8
+ }, any>;
210
9
  export default _default;
@@ -1,4 +1,4 @@
1
- import app from "../../app/twitter.app.mjs";
1
+ import common from "../../common/appValidation.mjs";
2
2
  import { ACTION_ERROR_MESSAGE } from "../../common/errorMessage.mjs";
3
3
  import { defineAction } from "@pipedream/types";
4
4
  import { getMultiItemSummary, getTweetFields, } from "../../common/methods.mjs";
@@ -7,22 +7,23 @@ const MIN_RESULTS = 10;
7
7
  const DEFAULT_RESULTS = 10;
8
8
  export const MAX_RESULTS_PER_PAGE = 100;
9
9
  export default defineAction({
10
+ ...common,
10
11
  key: "twitter-simple-search",
11
12
  name: "Search Tweets",
12
13
  description: `Retrieve Tweets from the last seven days that match a query. [See the documentation](${DOCS_LINK})`,
13
- version: "2.0.3",
14
+ version: "2.0.4",
14
15
  type: "action",
15
16
  props: {
16
- app,
17
+ ...common.props,
17
18
  query: {
18
19
  propDefinition: [
19
- app,
20
+ common.props.app,
20
21
  "query",
21
22
  ],
22
23
  },
23
24
  maxResults: {
24
25
  propDefinition: [
25
- app,
26
+ common.props.app,
26
27
  "maxResults",
27
28
  ],
28
29
  min: MIN_RESULTS,
@@ -31,27 +32,23 @@ export default defineAction({
31
32
  },
32
33
  },
33
34
  methods: {
35
+ ...common.methods,
34
36
  getMultiItemSummary,
35
37
  getTweetFields,
36
38
  },
37
39
  async run({ $ }) {
38
- try {
39
- const params = {
40
- $,
41
- maxPerPage: MAX_RESULTS_PER_PAGE,
42
- maxResults: this.maxResults,
43
- params: {
44
- query: this.query,
45
- ...this.getTweetFields(),
46
- },
47
- };
48
- const response = await this.app.searchTweets(params);
49
- $.export("$summary", this.getMultiItemSummary("tweet", response.data?.length));
50
- return response;
51
- }
52
- catch (err) {
53
- $.export("error", err);
54
- throw new Error(ACTION_ERROR_MESSAGE);
55
- }
40
+ const params = {
41
+ $,
42
+ maxPerPage: MAX_RESULTS_PER_PAGE,
43
+ maxResults: this.maxResults,
44
+ params: {
45
+ query: this.query,
46
+ ...this.getTweetFields(),
47
+ },
48
+ fallbackError: ACTION_ERROR_MESSAGE,
49
+ };
50
+ const response = await this.app.searchTweets(params);
51
+ $.export("$summary", this.getMultiItemSummary("tweet", response.data?.length));
52
+ return response;
56
53
  },
57
54
  });
@@ -1,215 +1,9 @@
1
1
  import { getMultiItemSummary, getTweetFields } from "../../common/methods.js";
2
- import { GetListTweetsParams } from "../../common/types/requestParams.js";
3
- import { PaginatedResponseObject, Tweet } from "../../common/types/responseSchemas.js";
4
2
  export declare const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/lists/list-tweets/api-reference/get-lists-id-tweets";
5
3
  export declare const MAX_RESULTS_PER_PAGE = 100;
6
4
  declare const _default: import("@pipedream/types").Action<{
7
5
  getMultiItemSummary: typeof getMultiItemSummary;
8
6
  getTweetFields: typeof getTweetFields;
9
- }, {
10
- app: import("@pipedream/types").App<{
11
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
12
- _getBaseUrl(): "https://api.twitter.com/2";
13
- _httpRequest({ $, specialAuth, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
14
- _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
15
- addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
16
- createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
17
- deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
18
- followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
19
- getListTweets({ listId, ...args }: GetListTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
20
- getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<Tweet>>;
21
- getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
22
- getAuthenticatedUserId(): Promise<string>;
23
- getDirectMessages(args: import("../../common/types/requestParams.js").GetDirectMessagesParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").DirectMessage>>;
24
- getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<PaginatedResponseObject<Tweet>>;
25
- getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
26
- getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
27
- getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<PaginatedResponseObject<Tweet>>;
28
- getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
29
- getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
30
- getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
31
- likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
32
- getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
33
- getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
34
- retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
35
- searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
36
- sendMessage({ userId, ...args }: import("../../common/types/requestParams.js").SendMessageParams): Promise<object>;
37
- unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
38
- unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
39
- uploadMedia(args: import("../../common/types/requestParams.js").UploadMediaParams): Promise<object>;
40
- }, {
41
- maxResults: {
42
- type: string;
43
- label: string;
44
- description: string;
45
- optional: boolean;
46
- };
47
- listId: {
48
- type: string;
49
- label: string;
50
- description: string;
51
- options(): Promise<{
52
- label: string;
53
- value: string;
54
- }[]>;
55
- };
56
- userNameOrId: {
57
- type: string;
58
- label: string;
59
- description: string;
60
- optional: boolean;
61
- default: string;
62
- };
63
- tweetId: {
64
- type: string;
65
- label: string;
66
- description: string;
67
- };
68
- query: {
69
- type: string;
70
- label: string;
71
- description: string;
72
- };
73
- }>;
74
- listId: {
75
- propDefinition: (string | import("@pipedream/types").App<{
76
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
77
- _getBaseUrl(): "https://api.twitter.com/2";
78
- _httpRequest({ $, specialAuth, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
79
- _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
80
- addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
81
- createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
82
- deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
83
- followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
84
- getListTweets({ listId, ...args }: GetListTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
85
- getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<Tweet>>;
86
- getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
87
- getAuthenticatedUserId(): Promise<string>;
88
- getDirectMessages(args: import("../../common/types/requestParams.js").GetDirectMessagesParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").DirectMessage>>;
89
- getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<PaginatedResponseObject<Tweet>>;
90
- getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
91
- getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
92
- getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<PaginatedResponseObject<Tweet>>;
93
- getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
94
- getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
95
- getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
96
- likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
97
- getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
98
- getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
99
- retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
100
- searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
101
- sendMessage({ userId, ...args }: import("../../common/types/requestParams.js").SendMessageParams): Promise<object>;
102
- unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
103
- unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
104
- uploadMedia(args: import("../../common/types/requestParams.js").UploadMediaParams): Promise<object>;
105
- }, {
106
- maxResults: {
107
- type: string;
108
- label: string;
109
- description: string;
110
- optional: boolean;
111
- };
112
- listId: {
113
- type: string;
114
- label: string;
115
- description: string;
116
- options(): Promise<{
117
- label: string;
118
- value: string;
119
- }[]>;
120
- };
121
- userNameOrId: {
122
- type: string;
123
- label: string;
124
- description: string;
125
- optional: boolean;
126
- default: string;
127
- };
128
- tweetId: {
129
- type: string;
130
- label: string;
131
- description: string;
132
- };
133
- query: {
134
- type: string;
135
- label: string;
136
- description: string;
137
- };
138
- }>)[];
139
- };
140
- searchTerms: {
141
- label: string;
142
- type: string;
143
- description: string;
144
- };
145
- maxResults: {
146
- propDefinition: (string | import("@pipedream/types").App<{
147
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
148
- _getBaseUrl(): "https://api.twitter.com/2";
149
- _httpRequest({ $, specialAuth, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
150
- _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
151
- addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
152
- createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
153
- deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
154
- followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
155
- getListTweets({ listId, ...args }: GetListTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
156
- getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<Tweet>>;
157
- getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
158
- getAuthenticatedUserId(): Promise<string>;
159
- getDirectMessages(args: import("../../common/types/requestParams.js").GetDirectMessagesParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").DirectMessage>>;
160
- getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<PaginatedResponseObject<Tweet>>;
161
- getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
162
- getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
163
- getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<PaginatedResponseObject<Tweet>>;
164
- getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
165
- getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
166
- getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
167
- likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
168
- getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
169
- getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
170
- retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
171
- searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<PaginatedResponseObject<Tweet>>;
172
- sendMessage({ userId, ...args }: import("../../common/types/requestParams.js").SendMessageParams): Promise<object>;
173
- unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
174
- unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
175
- uploadMedia(args: import("../../common/types/requestParams.js").UploadMediaParams): Promise<object>;
176
- }, {
177
- maxResults: {
178
- type: string;
179
- label: string;
180
- description: string;
181
- optional: boolean;
182
- };
183
- listId: {
184
- type: string;
185
- label: string;
186
- description: string;
187
- options(): Promise<{
188
- label: string;
189
- value: string;
190
- }[]>;
191
- };
192
- userNameOrId: {
193
- type: string;
194
- label: string;
195
- description: string;
196
- optional: boolean;
197
- default: string;
198
- };
199
- tweetId: {
200
- type: string;
201
- label: string;
202
- description: string;
203
- };
204
- query: {
205
- type: string;
206
- label: string;
207
- description: string;
208
- };
209
- }>)[];
210
- min: number;
211
- description: string;
212
- default: number;
213
- };
214
- }>;
7
+ getTweets(args?: {}): any;
8
+ }, any>;
215
9
  export default _default;
@@ -1,4 +1,4 @@
1
- import app from "../../app/twitter.app.mjs";
1
+ import common from "../../common/appValidation.mjs";
2
2
  import { ACTION_ERROR_MESSAGE } from "../../common/errorMessage.mjs";
3
3
  import { defineAction } from "@pipedream/types";
4
4
  import { getMultiItemSummary, getTweetFields, } from "../../common/methods.mjs";
@@ -7,16 +7,17 @@ const MIN_RESULTS = 1;
7
7
  const DEFAULT_RESULTS = 100;
8
8
  export const MAX_RESULTS_PER_PAGE = 100;
9
9
  export default defineAction({
10
+ ...common,
10
11
  key: "twitter-simple-search-in-list",
11
12
  name: "Search Tweets in List",
12
13
  description: `Search Tweets by text in a list. [See the documentation](${DOCS_LINK})`,
13
- version: "2.0.3",
14
+ version: "2.0.4",
14
15
  type: "action",
15
16
  props: {
16
- app,
17
+ ...common.props,
17
18
  listId: {
18
19
  propDefinition: [
19
- app,
20
+ common.props.app,
20
21
  "listId",
21
22
  ],
22
23
  },
@@ -27,7 +28,7 @@ export default defineAction({
27
28
  },
28
29
  maxResults: {
29
30
  propDefinition: [
30
- app,
31
+ common.props.app,
31
32
  "maxResults",
32
33
  ],
33
34
  min: MIN_RESULTS,
@@ -36,30 +37,26 @@ export default defineAction({
36
37
  },
37
38
  },
38
39
  methods: {
40
+ ...common.methods,
39
41
  getMultiItemSummary,
40
42
  getTweetFields,
41
43
  },
42
44
  async run({ $ }) {
43
- try {
44
- const { listId, searchTerms, } = this;
45
- const params = {
46
- $,
47
- listId,
48
- maxPerPage: MAX_RESULTS_PER_PAGE,
49
- maxResults: this.maxResults,
50
- params: this.getTweetFields(),
51
- };
52
- const response = await this.app.getListTweets(params);
53
- const { data } = response;
54
- const filteredTweets = data.filter(({ text }) => searchTerms.every((term) => term.split("|").some((splitTerm) => text.includes(splitTerm))));
55
- $.export("$summary", this.getMultiItemSummary("tweet", filteredTweets.length));
56
- return {
57
- data: filteredTweets,
58
- };
59
- }
60
- catch (err) {
61
- $.export("error", err);
62
- throw new Error(ACTION_ERROR_MESSAGE);
63
- }
45
+ const { listId, searchTerms, } = this;
46
+ const params = {
47
+ $,
48
+ listId,
49
+ maxPerPage: MAX_RESULTS_PER_PAGE,
50
+ maxResults: this.maxResults,
51
+ params: this.getTweetFields(),
52
+ fallbackError: ACTION_ERROR_MESSAGE,
53
+ };
54
+ const response = await this.app.getListTweets(params);
55
+ const { data } = response;
56
+ const filteredTweets = data.filter(({ text }) => searchTerms.every((term) => term.split("|").some((splitTerm) => text.includes(splitTerm))));
57
+ $.export("$summary", this.getMultiItemSummary("tweet", filteredTweets.length));
58
+ return {
59
+ data: filteredTweets,
60
+ };
64
61
  },
65
62
  });