@pipedream/twitter 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -1
- package/dist/actions/add-user-to-list/add-user-to-list.d.ts +3 -3
- package/dist/actions/add-user-to-list/add-user-to-list.mjs +21 -14
- package/dist/actions/create-tweet/create-tweet.d.ts +1 -1
- package/dist/actions/create-tweet/create-tweet.mjs +35 -28
- package/dist/actions/delete-tweet/delete-tweet.d.ts +2 -2
- package/dist/actions/delete-tweet/delete-tweet.mjs +16 -9
- package/dist/actions/follow-user/follow-user.d.ts +2 -2
- package/dist/actions/follow-user/follow-user.mjs +20 -13
- package/dist/actions/get-tweet/get-tweet.d.ts +2 -2
- package/dist/actions/get-tweet/get-tweet.mjs +17 -10
- package/dist/actions/get-user/get-user.d.ts +2 -2
- package/dist/actions/get-user/get-user.mjs +20 -13
- package/dist/actions/like-tweet/like-tweet.d.ts +2 -2
- package/dist/actions/like-tweet/like-tweet.mjs +18 -11
- package/dist/actions/list-favorites/list-favorites.d.ts +4 -4
- package/dist/actions/list-favorites/list-favorites.mjs +20 -13
- package/dist/actions/list-followers/list-followers.d.ts +4 -4
- package/dist/actions/list-followers/list-followers.mjs +20 -13
- package/dist/actions/list-lists/list-lists.d.ts +4 -4
- package/dist/actions/list-lists/list-lists.mjs +20 -13
- package/dist/actions/list-mentions/list-mentions.d.ts +4 -4
- package/dist/actions/list-mentions/list-mentions.mjs +20 -13
- package/dist/actions/list-user-tweets/list-user-tweets.d.ts +4 -4
- package/dist/actions/list-user-tweets/list-user-tweets.mjs +20 -13
- package/dist/actions/retweet/retweet.d.ts +2 -2
- package/dist/actions/retweet/retweet.mjs +20 -13
- package/dist/actions/simple-search/simple-search.d.ts +4 -4
- package/dist/actions/simple-search/simple-search.mjs +21 -14
- package/dist/actions/simple-search-in-list/simple-search-in-list.d.ts +4 -4
- package/dist/actions/simple-search-in-list/simple-search-in-list.mjs +24 -17
- package/dist/actions/unfollow-user/unfollow-user.d.ts +2 -2
- package/dist/actions/unfollow-user/unfollow-user.mjs +16 -9
- package/dist/actions/unlike-tweet/unlike-tweet.d.ts +2 -2
- package/dist/actions/unlike-tweet/unlike-tweet.mjs +16 -9
- package/dist/app/twitter.app.d.ts +1 -1
- package/dist/app/twitter.app.mjs +45 -34
- package/dist/common/dataFields.mjs +6 -6
- package/dist/common/errorMessage.d.ts +2 -0
- package/dist/common/errorMessage.mjs +2 -0
- package/dist/sources/common/base.d.ts +1 -1
- package/dist/sources/common/base.mjs +10 -2
- package/dist/sources/new-follower-of-user/new-follower-of-user.d.ts +2 -2
- package/dist/sources/new-follower-of-user/new-follower-of-user.mjs +1 -1
- package/dist/sources/new-list-followed/new-list-followed.d.ts +2 -2
- package/dist/sources/new-list-followed/new-list-followed.mjs +1 -1
- package/dist/sources/new-tweet-in-list/new-tweet-in-list.d.ts +2 -2
- package/dist/sources/new-tweet-in-list/new-tweet-in-list.mjs +1 -1
- package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.d.ts +2 -2
- package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.mjs +1 -1
- package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.d.ts +2 -2
- package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.mjs +1 -1
- package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.d.ts +2 -2
- package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.mjs +1 -1
- package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.d.ts +2 -2
- package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.mjs +1 -1
- package/dist/sources/new-user-followed/new-user-followed.d.ts +2 -2
- package/dist/sources/new-user-followed/new-user-followed.mjs +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import app from "../../app/twitter.app.mjs";
|
|
2
|
+
import { ACTION_ERROR_MESSAGE } from "../../common/errorMessage.mjs";
|
|
2
3
|
import { defineAction } from "@pipedream/types";
|
|
3
4
|
import { getMultiItemSummary, getUserId, getTweetFields, } from "../../common/methods.mjs";
|
|
4
5
|
export const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/tweets/likes/api-reference/get-users-id-liked_tweets";
|
|
@@ -9,7 +10,7 @@ export default defineAction({
|
|
|
9
10
|
key: "twitter-list-favorites",
|
|
10
11
|
name: "List Liked Tweets",
|
|
11
12
|
description: `Return the most recent tweets liked by you or the specified user. [See docs here](${DOCS_LINK})`,
|
|
12
|
-
version: "1.1.
|
|
13
|
+
version: "1.1.3",
|
|
13
14
|
type: "action",
|
|
14
15
|
props: {
|
|
15
16
|
app,
|
|
@@ -25,7 +26,7 @@ export default defineAction({
|
|
|
25
26
|
"maxResults",
|
|
26
27
|
],
|
|
27
28
|
min: MIN_RESULTS,
|
|
28
|
-
|
|
29
|
+
description: `Maximum amount of items to return. Each request can return up to ${MAX_RESULTS_PER_PAGE} items.`,
|
|
29
30
|
default: DEFAULT_RESULTS,
|
|
30
31
|
},
|
|
31
32
|
},
|
|
@@ -35,16 +36,22 @@ export default defineAction({
|
|
|
35
36
|
getTweetFields,
|
|
36
37
|
},
|
|
37
38
|
async run({ $ }) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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.getUserLikedTweets(params);
|
|
49
|
+
$.export("$summary", this.getMultiItemSummary("liked tweet", response.data?.length));
|
|
50
|
+
return response;
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
$.export("error", err);
|
|
54
|
+
throw new Error(ACTION_ERROR_MESSAGE);
|
|
55
|
+
}
|
|
49
56
|
},
|
|
50
57
|
});
|
|
@@ -9,7 +9,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
9
9
|
getUserFields: typeof getUserFields;
|
|
10
10
|
}, {
|
|
11
11
|
app: import("@pipedream/types").App<{
|
|
12
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
12
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
13
13
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
14
14
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
15
15
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -71,7 +71,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
71
71
|
}>;
|
|
72
72
|
userNameOrId: {
|
|
73
73
|
propDefinition: (string | import("@pipedream/types").App<{
|
|
74
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
74
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
75
75
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
76
76
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
77
77
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -134,7 +134,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
134
134
|
};
|
|
135
135
|
maxResults: {
|
|
136
136
|
propDefinition: (string | import("@pipedream/types").App<{
|
|
137
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
137
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
138
138
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
139
139
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
140
140
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -195,7 +195,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
195
195
|
};
|
|
196
196
|
}>)[];
|
|
197
197
|
min: number;
|
|
198
|
-
|
|
198
|
+
description: string;
|
|
199
199
|
default: number;
|
|
200
200
|
};
|
|
201
201
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import app from "../../app/twitter.app.mjs";
|
|
2
|
+
import { ACTION_ERROR_MESSAGE } from "../../common/errorMessage.mjs";
|
|
2
3
|
import { defineAction } from "@pipedream/types";
|
|
3
4
|
import { getMultiItemSummary, getUserId, getUserFields, } from "../../common/methods.mjs";
|
|
4
5
|
export const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/get-users-id-followers";
|
|
@@ -9,7 +10,7 @@ export default defineAction({
|
|
|
9
10
|
key: "twitter-list-followers",
|
|
10
11
|
name: "List Followers",
|
|
11
12
|
description: `Return a collection of user objects for users following the specified user. [See docs here](${DOCS_LINK})`,
|
|
12
|
-
version: "1.1.
|
|
13
|
+
version: "1.1.3",
|
|
13
14
|
type: "action",
|
|
14
15
|
props: {
|
|
15
16
|
app,
|
|
@@ -25,7 +26,7 @@ export default defineAction({
|
|
|
25
26
|
"maxResults",
|
|
26
27
|
],
|
|
27
28
|
min: MIN_RESULTS,
|
|
28
|
-
|
|
29
|
+
description: `Maximum amount of items to return. Each request can return up to ${MAX_RESULTS_PER_PAGE} items.`,
|
|
29
30
|
default: DEFAULT_RESULTS,
|
|
30
31
|
},
|
|
31
32
|
},
|
|
@@ -35,16 +36,22 @@ export default defineAction({
|
|
|
35
36
|
getUserFields,
|
|
36
37
|
},
|
|
37
38
|
async run({ $ }) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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.getUserFields(),
|
|
46
|
+
userId,
|
|
47
|
+
};
|
|
48
|
+
const response = await this.app.getUserFollowers(params);
|
|
49
|
+
$.export("$summary", this.getMultiItemSummary("follower", response.data?.length));
|
|
50
|
+
return response;
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
$.export("error", err);
|
|
54
|
+
throw new Error(ACTION_ERROR_MESSAGE);
|
|
55
|
+
}
|
|
49
56
|
},
|
|
50
57
|
});
|
|
@@ -7,7 +7,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
7
7
|
getListFields: typeof getListFields;
|
|
8
8
|
}, {
|
|
9
9
|
app: import("@pipedream/types").App<{
|
|
10
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
10
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
11
11
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
12
12
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
13
13
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -69,7 +69,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
69
69
|
}>;
|
|
70
70
|
userNameOrId: {
|
|
71
71
|
propDefinition: (string | import("@pipedream/types").App<{
|
|
72
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
72
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
73
73
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
74
74
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
75
75
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -132,7 +132,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
132
132
|
};
|
|
133
133
|
maxResults: {
|
|
134
134
|
propDefinition: (string | import("@pipedream/types").App<{
|
|
135
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
135
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
136
136
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
137
137
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
138
138
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -193,7 +193,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
193
193
|
};
|
|
194
194
|
}>)[];
|
|
195
195
|
min: number;
|
|
196
|
-
|
|
196
|
+
description: string;
|
|
197
197
|
default: number;
|
|
198
198
|
};
|
|
199
199
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import app from "../../app/twitter.app.mjs";
|
|
2
|
+
import { ACTION_ERROR_MESSAGE } from "../../common/errorMessage.mjs";
|
|
2
3
|
import { defineAction } from "@pipedream/types";
|
|
3
4
|
import { getMultiItemSummary, getUserId, getListFields, } from "../../common/methods.mjs";
|
|
4
5
|
const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/lists/list-lookup/api-reference/get-users-id-owned_lists";
|
|
@@ -9,7 +10,7 @@ export default defineAction({
|
|
|
9
10
|
key: "twitter-list-lists",
|
|
10
11
|
name: "List Lists",
|
|
11
12
|
description: `Get all lists owned by a user. [See docs here](${DOCS_LINK})`,
|
|
12
|
-
version: "1.1.
|
|
13
|
+
version: "1.1.3",
|
|
13
14
|
type: "action",
|
|
14
15
|
props: {
|
|
15
16
|
app,
|
|
@@ -25,7 +26,7 @@ export default defineAction({
|
|
|
25
26
|
"maxResults",
|
|
26
27
|
],
|
|
27
28
|
min: MIN_RESULTS,
|
|
28
|
-
|
|
29
|
+
description: `Maximum amount of items to return. Each request can return up to ${MAX_RESULTS_PER_PAGE} items.`,
|
|
29
30
|
default: DEFAULT_RESULTS,
|
|
30
31
|
},
|
|
31
32
|
},
|
|
@@ -35,16 +36,22 @@ export default defineAction({
|
|
|
35
36
|
getListFields,
|
|
36
37
|
},
|
|
37
38
|
async run({ $ }) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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.getListFields(),
|
|
46
|
+
userId,
|
|
47
|
+
};
|
|
48
|
+
const response = await this.app.getUserOwnedLists(params);
|
|
49
|
+
$.export("$summary", this.getMultiItemSummary("list", response.data?.length));
|
|
50
|
+
return response;
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
$.export("error", err);
|
|
54
|
+
throw new Error(ACTION_ERROR_MESSAGE);
|
|
55
|
+
}
|
|
49
56
|
},
|
|
50
57
|
});
|
|
@@ -7,7 +7,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
7
7
|
getTweetFields: typeof getTweetFields;
|
|
8
8
|
}, {
|
|
9
9
|
app: import("@pipedream/types").App<{
|
|
10
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
10
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
11
11
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
12
12
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
13
13
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -69,7 +69,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
69
69
|
}>;
|
|
70
70
|
userNameOrId: {
|
|
71
71
|
propDefinition: (string | import("@pipedream/types").App<{
|
|
72
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
72
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
73
73
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
74
74
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
75
75
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -132,7 +132,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
132
132
|
};
|
|
133
133
|
maxResults: {
|
|
134
134
|
propDefinition: (string | import("@pipedream/types").App<{
|
|
135
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
135
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
136
136
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
137
137
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
138
138
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -193,7 +193,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
193
193
|
};
|
|
194
194
|
}>)[];
|
|
195
195
|
min: number;
|
|
196
|
-
|
|
196
|
+
description: string;
|
|
197
197
|
default: number;
|
|
198
198
|
};
|
|
199
199
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import app from "../../app/twitter.app.mjs";
|
|
2
|
+
import { ACTION_ERROR_MESSAGE } from "../../common/errorMessage.mjs";
|
|
2
3
|
import { defineAction } from "@pipedream/types";
|
|
3
4
|
import { getMultiItemSummary, getUserId, getTweetFields, } from "../../common/methods.mjs";
|
|
4
5
|
const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/api-reference/get-users-id-mentions";
|
|
@@ -9,7 +10,7 @@ export default defineAction({
|
|
|
9
10
|
key: "twitter-list-mentions",
|
|
10
11
|
name: "List Mentions",
|
|
11
12
|
description: `Return the most recent mentions for the specified user. [See docs here](${DOCS_LINK})`,
|
|
12
|
-
version: "1.1.
|
|
13
|
+
version: "1.1.3",
|
|
13
14
|
type: "action",
|
|
14
15
|
props: {
|
|
15
16
|
app,
|
|
@@ -25,7 +26,7 @@ export default defineAction({
|
|
|
25
26
|
"maxResults",
|
|
26
27
|
],
|
|
27
28
|
min: MIN_RESULTS,
|
|
28
|
-
|
|
29
|
+
description: `Maximum amount of items to return. Each request can return up to ${MAX_RESULTS_PER_PAGE} items.`,
|
|
29
30
|
default: DEFAULT_RESULTS,
|
|
30
31
|
},
|
|
31
32
|
},
|
|
@@ -35,16 +36,22 @@ export default defineAction({
|
|
|
35
36
|
getTweetFields,
|
|
36
37
|
},
|
|
37
38
|
async run({ $ }) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
+
}
|
|
49
56
|
},
|
|
50
57
|
});
|
|
@@ -9,7 +9,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
9
9
|
getTweetFields: typeof getTweetFields;
|
|
10
10
|
}, {
|
|
11
11
|
app: import("@pipedream/types").App<{
|
|
12
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
12
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
13
13
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
14
14
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
15
15
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -71,7 +71,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
71
71
|
}>;
|
|
72
72
|
userNameOrId: {
|
|
73
73
|
propDefinition: (string | import("@pipedream/types").App<{
|
|
74
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
74
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
75
75
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
76
76
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
77
77
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -134,7 +134,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
134
134
|
};
|
|
135
135
|
maxResults: {
|
|
136
136
|
propDefinition: (string | import("@pipedream/types").App<{
|
|
137
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
137
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
138
138
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
139
139
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
140
140
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -195,7 +195,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
195
195
|
};
|
|
196
196
|
}>)[];
|
|
197
197
|
min: number;
|
|
198
|
-
|
|
198
|
+
description: string;
|
|
199
199
|
default: number;
|
|
200
200
|
};
|
|
201
201
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import app from "../../app/twitter.app.mjs";
|
|
2
|
+
import { ACTION_ERROR_MESSAGE } from "../../common/errorMessage.mjs";
|
|
2
3
|
import { defineAction } from "@pipedream/types";
|
|
3
4
|
import { getMultiItemSummary, getUserId, getTweetFields, } from "../../common/methods.mjs";
|
|
4
5
|
export const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/api-reference/get-users-id-tweets";
|
|
@@ -9,7 +10,7 @@ export default defineAction({
|
|
|
9
10
|
key: "twitter-list-user-tweets",
|
|
10
11
|
name: "List User Tweets",
|
|
11
12
|
description: `Return a collection of the most recent tweets posted by a user. [See docs here](${DOCS_LINK})`,
|
|
12
|
-
version: "1.1.
|
|
13
|
+
version: "1.1.3",
|
|
13
14
|
type: "action",
|
|
14
15
|
props: {
|
|
15
16
|
app,
|
|
@@ -25,7 +26,7 @@ export default defineAction({
|
|
|
25
26
|
"maxResults",
|
|
26
27
|
],
|
|
27
28
|
min: MIN_RESULTS,
|
|
28
|
-
|
|
29
|
+
description: `Maximum amount of items to return. Each request can return up to ${MAX_RESULTS_PER_PAGE} items.`,
|
|
29
30
|
default: DEFAULT_RESULTS,
|
|
30
31
|
},
|
|
31
32
|
},
|
|
@@ -35,16 +36,22 @@ export default defineAction({
|
|
|
35
36
|
getTweetFields,
|
|
36
37
|
},
|
|
37
38
|
async run({ $ }) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
+
}
|
|
49
56
|
},
|
|
50
57
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const _default: import("@pipedream/types").Action<unknown, {
|
|
2
2
|
app: import("@pipedream/types").App<{
|
|
3
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
3
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
4
4
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
5
5
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
6
6
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -62,7 +62,7 @@ declare const _default: import("@pipedream/types").Action<unknown, {
|
|
|
62
62
|
}>;
|
|
63
63
|
tweetId: {
|
|
64
64
|
propDefinition: (string | import("@pipedream/types").App<{
|
|
65
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
65
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
66
66
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
67
67
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
68
68
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import app from "../../app/twitter.app.mjs";
|
|
2
|
+
import { ACTION_ERROR_MESSAGE } from "../../common/errorMessage.mjs";
|
|
2
3
|
import { defineAction } from "@pipedream/types";
|
|
3
4
|
const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/tweets/retweets/api-reference/post-users-id-retweets";
|
|
4
5
|
export default defineAction({
|
|
5
6
|
key: "twitter-retweet",
|
|
6
7
|
name: "Retweet a tweet",
|
|
7
8
|
description: `Retweet a tweet specified by ID. [See docs here](${DOCS_LINK})`,
|
|
8
|
-
version: "1.0.
|
|
9
|
+
version: "1.0.3",
|
|
9
10
|
type: "action",
|
|
10
11
|
props: {
|
|
11
12
|
app,
|
|
@@ -18,17 +19,23 @@ export default defineAction({
|
|
|
18
19
|
},
|
|
19
20
|
},
|
|
20
21
|
async run({ $ }) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
try {
|
|
23
|
+
const { tweetId } = this;
|
|
24
|
+
const params = {
|
|
25
|
+
$,
|
|
26
|
+
data: {
|
|
27
|
+
tweet_id: tweetId,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
const response = await this.app.retweet(params);
|
|
31
|
+
$.export("$summary", response.data?.retweeted !== true
|
|
32
|
+
? "Retweet failed"
|
|
33
|
+
: "Tweet successfully retweeted");
|
|
34
|
+
return response;
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
$.export("error", err);
|
|
38
|
+
throw new Error(ACTION_ERROR_MESSAGE);
|
|
39
|
+
}
|
|
33
40
|
},
|
|
34
41
|
});
|
|
@@ -8,7 +8,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
8
8
|
getTweetFields: typeof getTweetFields;
|
|
9
9
|
}, {
|
|
10
10
|
app: import("@pipedream/types").App<{
|
|
11
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
11
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
12
12
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
13
13
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
14
14
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -70,7 +70,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
70
70
|
}>;
|
|
71
71
|
query: {
|
|
72
72
|
propDefinition: (string | import("@pipedream/types").App<{
|
|
73
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
73
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
74
74
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
75
75
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
76
76
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -133,7 +133,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
133
133
|
};
|
|
134
134
|
maxResults: {
|
|
135
135
|
propDefinition: (string | import("@pipedream/types").App<{
|
|
136
|
-
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams):
|
|
136
|
+
_getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
|
|
137
137
|
_getBaseUrl(): "https://api.twitter.com/2";
|
|
138
138
|
_httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
139
139
|
_paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
|
|
@@ -194,7 +194,7 @@ declare const _default: import("@pipedream/types").Action<{
|
|
|
194
194
|
};
|
|
195
195
|
}>)[];
|
|
196
196
|
min: number;
|
|
197
|
-
|
|
197
|
+
description: string;
|
|
198
198
|
default: number;
|
|
199
199
|
};
|
|
200
200
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import app from "../../app/twitter.app.mjs";
|
|
2
|
+
import { ACTION_ERROR_MESSAGE } from "../../common/errorMessage.mjs";
|
|
2
3
|
import { defineAction } from "@pipedream/types";
|
|
3
4
|
import { getMultiItemSummary, getTweetFields, } from "../../common/methods.mjs";
|
|
4
5
|
export const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-reference/get-tweets-search-recent";
|
|
@@ -9,7 +10,7 @@ export default defineAction({
|
|
|
9
10
|
key: "twitter-simple-search",
|
|
10
11
|
name: "Search Tweets",
|
|
11
12
|
description: `Retrieve Tweets from the last seven days that match a query. [See docs here](${DOCS_LINK})`,
|
|
12
|
-
version: "1.1.
|
|
13
|
+
version: "1.1.3",
|
|
13
14
|
type: "action",
|
|
14
15
|
props: {
|
|
15
16
|
app,
|
|
@@ -25,7 +26,7 @@ export default defineAction({
|
|
|
25
26
|
"maxResults",
|
|
26
27
|
],
|
|
27
28
|
min: MIN_RESULTS,
|
|
28
|
-
|
|
29
|
+
description: `Maximum amount of items to return. Each request can return up to ${MAX_RESULTS_PER_PAGE} items.`,
|
|
29
30
|
default: DEFAULT_RESULTS,
|
|
30
31
|
},
|
|
31
32
|
},
|
|
@@ -34,17 +35,23 @@ export default defineAction({
|
|
|
34
35
|
getTweetFields,
|
|
35
36
|
},
|
|
36
37
|
async run({ $ }) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
+
}
|
|
49
56
|
},
|
|
50
57
|
});
|