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