@pipedream/twitter 2.2.0 → 2.2.2

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 +28 -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,137 +1,6 @@
1
1
  import { getUserId } from "../../common/methods.js";
2
- import { UnfollowUserParams } from "../../common/types/requestParams.js";
3
2
  declare const _default: import("@pipedream/types").Action<{
4
3
  getUserId: typeof getUserId;
5
- }, {
6
- app: import("@pipedream/types").App<{
7
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
8
- _getBaseUrl(): "https://api.twitter.com/2";
9
- _httpRequest({ $, specialAuth, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
10
- _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
11
- addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
12
- createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
13
- deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
14
- followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
15
- getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
16
- getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").Tweet>>;
17
- getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
18
- getAuthenticatedUserId(): Promise<string>;
19
- getDirectMessages(args: import("../../common/types/requestParams.js").GetDirectMessagesParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").DirectMessage>>;
20
- getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
21
- getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
22
- getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
23
- getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
24
- getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
25
- getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
26
- getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
27
- likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
28
- getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
29
- getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
30
- retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
31
- searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
32
- sendMessage({ userId, ...args }: import("../../common/types/requestParams.js").SendMessageParams): Promise<object>;
33
- unfollowUser({ userId, ...args }: UnfollowUserParams): Promise<object>;
34
- unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
35
- uploadMedia(args: import("../../common/types/requestParams.js").UploadMediaParams): Promise<object>;
36
- }, {
37
- maxResults: {
38
- type: string;
39
- label: string;
40
- description: string;
41
- optional: boolean;
42
- };
43
- listId: {
44
- type: string;
45
- label: string;
46
- description: string;
47
- options(): Promise<{
48
- label: string;
49
- value: string;
50
- }[]>;
51
- };
52
- userNameOrId: {
53
- type: string;
54
- label: string;
55
- description: string;
56
- optional: boolean;
57
- default: string;
58
- };
59
- tweetId: {
60
- type: string;
61
- label: string;
62
- description: string;
63
- };
64
- query: {
65
- type: string;
66
- label: string;
67
- description: string;
68
- };
69
- }>;
70
- userNameOrId: {
71
- propDefinition: (string | import("@pipedream/types").App<{
72
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
73
- _getBaseUrl(): "https://api.twitter.com/2";
74
- _httpRequest({ $, specialAuth, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
75
- _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
76
- addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
77
- createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
78
- deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
79
- followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
80
- getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
81
- getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").Tweet>>;
82
- getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
83
- getAuthenticatedUserId(): Promise<string>;
84
- getDirectMessages(args: import("../../common/types/requestParams.js").GetDirectMessagesParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").DirectMessage>>;
85
- getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
86
- getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
87
- getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
88
- getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
89
- getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
90
- getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
91
- getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
92
- likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
93
- getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
94
- getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
95
- retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
96
- searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
97
- sendMessage({ userId, ...args }: import("../../common/types/requestParams.js").SendMessageParams): Promise<object>;
98
- unfollowUser({ userId, ...args }: UnfollowUserParams): Promise<object>;
99
- unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
100
- uploadMedia(args: import("../../common/types/requestParams.js").UploadMediaParams): Promise<object>;
101
- }, {
102
- maxResults: {
103
- type: string;
104
- label: string;
105
- description: string;
106
- optional: boolean;
107
- };
108
- listId: {
109
- type: string;
110
- label: string;
111
- description: string;
112
- options(): Promise<{
113
- label: string;
114
- value: string;
115
- }[]>;
116
- };
117
- userNameOrId: {
118
- type: string;
119
- label: string;
120
- description: string;
121
- optional: boolean;
122
- default: string;
123
- };
124
- tweetId: {
125
- type: string;
126
- label: string;
127
- description: string;
128
- };
129
- query: {
130
- type: string;
131
- label: string;
132
- description: string;
133
- };
134
- }>)[];
135
- };
136
- }>;
4
+ getTweets(args?: {}): any;
5
+ }, any>;
137
6
  export default _default;
@@ -1,40 +1,37 @@
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 { getUserId } from "../../common/methods.mjs";
5
5
  const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/delete-users-source_id-following";
6
6
  export default defineAction({
7
+ ...common,
7
8
  key: "twitter-unfollow-user",
8
9
  name: "Unfollow User",
9
10
  description: `Unfollow a user. [See the documentation](${DOCS_LINK})`,
10
- version: "2.0.3",
11
+ version: "2.0.5",
11
12
  type: "action",
12
13
  props: {
13
- app,
14
+ ...common.props,
14
15
  userNameOrId: {
15
16
  propDefinition: [
16
- app,
17
+ common.props.app,
17
18
  "userNameOrId",
18
19
  ],
19
20
  },
20
21
  },
21
22
  methods: {
23
+ ...common.methods,
22
24
  getUserId,
23
25
  },
24
26
  async run({ $ }) {
25
- try {
26
- const userId = await this.getUserId();
27
- const params = {
28
- $,
29
- userId,
30
- };
31
- const response = await this.app.unfollowUser(params);
32
- $.export("$summary", "Successfully unfollowed user");
33
- return response;
34
- }
35
- catch (err) {
36
- $.export("error", err);
37
- throw new Error(ACTION_ERROR_MESSAGE);
38
- }
27
+ const userId = await this.getUserId();
28
+ const params = {
29
+ $,
30
+ userId,
31
+ fallbackError: ACTION_ERROR_MESSAGE,
32
+ };
33
+ const response = await this.app.unfollowUser(params);
34
+ $.export("$summary", "Successfully unfollowed user");
35
+ return response;
39
36
  },
40
37
  });
@@ -1,134 +1,4 @@
1
- import { UnlikeTweetParams } from "../../common/types/requestParams.js";
2
- declare const _default: import("@pipedream/types").Action<unknown, {
3
- app: import("@pipedream/types").App<{
4
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
5
- _getBaseUrl(): "https://api.twitter.com/2";
6
- _httpRequest({ $, specialAuth, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
7
- _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
8
- addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
9
- createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
10
- deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
11
- followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
12
- getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
13
- getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").Tweet>>;
14
- getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
15
- getAuthenticatedUserId(): Promise<string>;
16
- getDirectMessages(args: import("../../common/types/requestParams.js").GetDirectMessagesParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").DirectMessage>>;
17
- getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
18
- getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
19
- getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
20
- getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
21
- getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
22
- getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
23
- getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
24
- likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
25
- getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
26
- getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
27
- retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
28
- searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
29
- sendMessage({ userId, ...args }: import("../../common/types/requestParams.js").SendMessageParams): Promise<object>;
30
- unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
31
- unlikeTweet({ tweetId, ...args }: UnlikeTweetParams): Promise<object>;
32
- uploadMedia(args: import("../../common/types/requestParams.js").UploadMediaParams): Promise<object>;
33
- }, {
34
- maxResults: {
35
- type: string;
36
- label: string;
37
- description: string;
38
- optional: boolean;
39
- };
40
- listId: {
41
- type: string;
42
- label: string;
43
- description: string;
44
- options(): Promise<{
45
- label: string;
46
- value: string;
47
- }[]>;
48
- };
49
- userNameOrId: {
50
- type: string;
51
- label: string;
52
- description: string;
53
- optional: boolean;
54
- default: string;
55
- };
56
- tweetId: {
57
- type: string;
58
- label: string;
59
- description: string;
60
- };
61
- query: {
62
- type: string;
63
- label: string;
64
- description: string;
65
- };
66
- }>;
67
- tweetId: {
68
- propDefinition: (string | import("@pipedream/types").App<{
69
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
70
- _getBaseUrl(): "https://api.twitter.com/2";
71
- _httpRequest({ $, specialAuth, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
72
- _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
73
- addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
74
- createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
75
- deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
76
- followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
77
- getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
78
- getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").Tweet>>;
79
- getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
80
- getAuthenticatedUserId(): Promise<string>;
81
- getDirectMessages(args: import("../../common/types/requestParams.js").GetDirectMessagesParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").DirectMessage>>;
82
- getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
83
- getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
84
- getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
85
- getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
86
- getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
87
- getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
88
- getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
89
- likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
90
- getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
91
- getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
92
- retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
93
- searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
94
- sendMessage({ userId, ...args }: import("../../common/types/requestParams.js").SendMessageParams): Promise<object>;
95
- unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
96
- unlikeTweet({ tweetId, ...args }: UnlikeTweetParams): Promise<object>;
97
- uploadMedia(args: import("../../common/types/requestParams.js").UploadMediaParams): Promise<object>;
98
- }, {
99
- maxResults: {
100
- type: string;
101
- label: string;
102
- description: string;
103
- optional: boolean;
104
- };
105
- listId: {
106
- type: string;
107
- label: string;
108
- description: string;
109
- options(): Promise<{
110
- label: string;
111
- value: string;
112
- }[]>;
113
- };
114
- userNameOrId: {
115
- type: string;
116
- label: string;
117
- description: string;
118
- optional: boolean;
119
- default: string;
120
- };
121
- tweetId: {
122
- type: string;
123
- label: string;
124
- description: string;
125
- };
126
- query: {
127
- type: string;
128
- label: string;
129
- description: string;
130
- };
131
- }>)[];
132
- };
133
- }>;
1
+ declare const _default: import("@pipedream/types").Action<{
2
+ getTweets(args?: {}): any;
3
+ }, any>;
134
4
  export default _default;
@@ -1,36 +1,32 @@
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
  const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/tweets/likes/api-reference/delete-users-id-likes-tweet_id";
5
5
  export default defineAction({
6
+ ...common,
6
7
  key: "twitter-unlike-tweet",
7
8
  name: "Unlike Tweet",
8
9
  description: `Unlike a tweet specified by its ID. [See the documentation](${DOCS_LINK})`,
9
- version: "2.0.3",
10
+ version: "2.0.5",
10
11
  type: "action",
11
12
  props: {
12
- app,
13
+ ...common.props,
13
14
  tweetId: {
14
15
  propDefinition: [
15
- app,
16
+ common.props.app,
16
17
  "tweetId",
17
18
  ],
18
19
  },
19
20
  },
20
21
  async run({ $ }) {
21
- try {
22
- const { tweetId } = this;
23
- const params = {
24
- $,
25
- tweetId,
26
- };
27
- const response = await this.app.unlikeTweet(params);
28
- $.export("$summary", `Successfully unliked tweet ${tweetId}`);
29
- return response;
30
- }
31
- catch (err) {
32
- $.export("error", err);
33
- throw new Error(ACTION_ERROR_MESSAGE);
34
- }
22
+ const { tweetId } = this;
23
+ const params = {
24
+ $,
25
+ tweetId,
26
+ fallbackError: ACTION_ERROR_MESSAGE,
27
+ };
28
+ const response = await this.app.unlikeTweet(params);
29
+ $.export("$summary", `Successfully unliked tweet ${tweetId}`);
30
+ return response;
35
31
  },
36
32
  });
@@ -1,83 +1,4 @@
1
- declare const _default: import("@pipedream/types").Action<unknown, {
2
- app: import("@pipedream/types").App<{
3
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
4
- _getBaseUrl(): "https://api.twitter.com/2";
5
- _httpRequest({ $, specialAuth, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
6
- _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
7
- addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
8
- createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
9
- deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
10
- followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
11
- getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
12
- getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").Tweet>>;
13
- getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
14
- getAuthenticatedUserId(): Promise<string>;
15
- getDirectMessages(args: import("../../common/types/requestParams.js").GetDirectMessagesParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").DirectMessage>>;
16
- getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
17
- getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
18
- getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
19
- getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
20
- getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
21
- getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
22
- getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
23
- likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
24
- getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
25
- getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
26
- retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
27
- searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
28
- sendMessage({ userId, ...args }: import("../../common/types/requestParams.js").SendMessageParams): Promise<object>;
29
- unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
30
- unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
31
- uploadMedia(args: import("../../common/types/requestParams.js").UploadMediaParams): Promise<object>;
32
- }, {
33
- maxResults: {
34
- type: string;
35
- label: string;
36
- description: string;
37
- optional: boolean;
38
- };
39
- listId: {
40
- type: string;
41
- label: string;
42
- description: string;
43
- options(): Promise<{
44
- label: string;
45
- value: string;
46
- }[]>;
47
- };
48
- userNameOrId: {
49
- type: string;
50
- label: string;
51
- description: string;
52
- optional: boolean;
53
- default: string;
54
- };
55
- tweetId: {
56
- type: string;
57
- label: string;
58
- description: string;
59
- };
60
- query: {
61
- type: string;
62
- label: string;
63
- description: string;
64
- };
65
- }>;
66
- filePath: {
67
- type: string;
68
- label: string;
69
- description: string;
70
- optional: boolean;
71
- };
72
- media_category: {
73
- type: string;
74
- label: string;
75
- description: string;
76
- options: {
77
- label: string;
78
- value: string;
79
- }[];
80
- optional: boolean;
81
- };
82
- }>;
1
+ declare const _default: import("@pipedream/types").Action<{
2
+ getTweets(args?: {}): any;
3
+ }, any>;
83
4
  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 constants from "../../common/constants.mjs";
@@ -7,13 +7,14 @@ import { axios } from "@pipedream/platform";
7
7
  import FormData from "form-data";
8
8
  const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/post-media-upload";
9
9
  export default defineAction({
10
+ ...common,
10
11
  key: "twitter-upload-media",
11
12
  name: "Upload Media",
12
13
  description: `Upload new media. [See the documentation](${DOCS_LINK})`,
13
- version: "0.0.7",
14
+ version: "0.0.9",
14
15
  type: "action",
15
16
  props: {
16
- app,
17
+ ...common.props,
17
18
  filePath: {
18
19
  type: "string",
19
20
  label: "File Path",
@@ -29,9 +30,10 @@ export default defineAction({
29
30
  },
30
31
  },
31
32
  async run({ $ }) {
33
+ const isLocalFile = this.filePath?.startsWith("/tmp");
34
+ let content;
32
35
  try {
33
- const isLocalFile = this.filePath?.startsWith("/tmp");
34
- const content = isLocalFile
36
+ content = isLocalFile
35
37
  ? fs.createReadStream(this.filePath, {
36
38
  encoding: "base64",
37
39
  })
@@ -39,26 +41,27 @@ export default defineAction({
39
41
  url: this.filePath,
40
42
  responseType: "arraybuffer",
41
43
  });
42
- const data = new FormData();
43
- if (isLocalFile) {
44
- data.append("media_data", content);
45
- }
46
- else {
47
- data.append("media", content);
48
- }
49
- const response = await this.app.uploadMedia({
50
- $,
51
- data,
52
- params: {
53
- media_category: this.media_category,
54
- },
55
- });
56
- $.export("$summary", `Successfully uploaded media with ID ${response.media_id}`);
57
- return response;
58
44
  }
59
45
  catch (err) {
60
46
  $.export("error", err);
61
47
  throw new Error(ACTION_ERROR_MESSAGE);
62
48
  }
49
+ const data = new FormData();
50
+ if (isLocalFile) {
51
+ data.append("media_data", content);
52
+ }
53
+ else {
54
+ data.append("media", content);
55
+ }
56
+ const response = await this.app.uploadMedia({
57
+ $,
58
+ data,
59
+ params: {
60
+ media_category: this.media_category,
61
+ },
62
+ fallbackError: ACTION_ERROR_MESSAGE,
63
+ });
64
+ $.export("$summary", `Successfully uploaded media with ID ${response.media_id}`);
65
+ return response;
63
66
  },
64
67
  });
@@ -2,9 +2,10 @@ import OAuth from "oauth-1.0a";
2
2
  import { AddUserToListParams, CreateTweetParams, DeleteTweetParams, FollowUserParams, GetUserLikedTweetParams, GetUserOwnedListsParams, GetTweetParams, GetUserFollowedListsParams, GetUserMentionsParams, GetUserParams, GetUserTweetsParams, HttpRequestParams, LikeTweetParams, GetUserFollowersParams, GetUserFollowingParams, PaginatedRequestParams, RetweetParams, SearchTweetsParams, UnfollowUserParams, UnlikeTweetParams, GetListTweetsParams, GetAuthenticatedUserParams, SendMessageParams, GetDirectMessagesParams, UploadMediaParams } from "../common/types/requestParams.js";
3
3
  import { DirectMessage, List, PaginatedResponseObject, ResponseObject, Tweet, TwitterEntity, User } from "../common/types/responseSchemas.js";
4
4
  declare const _default: import("@pipedream/types").App<{
5
+ throwError(data: any): void;
5
6
  _getAuthHeader(config: HttpRequestParams): OAuth.Header;
6
7
  _getBaseUrl(): "https://api.twitter.com/2";
7
- _httpRequest({ $, specialAuth, ...args }: HttpRequestParams): Promise<ResponseObject<TwitterEntity>>;
8
+ _httpRequest({ $, headers, specialAuth, throwError, fallbackError, ...args }: HttpRequestParams): Promise<ResponseObject<TwitterEntity>>;
8
9
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: PaginatedRequestParams): Promise<PaginatedResponseObject<TwitterEntity>>;
9
10
  addUserToList({ listId, ...args }: AddUserToListParams): Promise<object>;
10
11
  createTweet(args: CreateTweetParams): Promise<object>;