Merge pull request #600 from automatisch/refactor/remove-search-term

refactor: Do not expose search term separately for search tweets
This commit is contained in:
Ömer Faruk Aydın
2022-10-14 23:53:52 +02:00
committed by GitHub
2 changed files with 4 additions and 12 deletions

View File

@@ -31,8 +31,6 @@ export default {
],
async run($: IGlobalVariable) {
return await searchTweets($, {
searchTerm: $.step.parameters.searchTerm as string,
});
return await searchTweets($);
},
};

View File

@@ -7,15 +7,9 @@ import qs from 'qs';
import generateRequest from '../../common/generate-request';
import { omitBy, isEmpty } from 'lodash';
type ISearchTweetsOptions = {
searchTerm: string;
lastInternalId?: string;
};
const searchTweets = async ($: IGlobalVariable) => {
const searchTerm = $.step.parameters.searchTerm as string;
const searchTweets = async (
$: IGlobalVariable,
options: ISearchTweetsOptions
) => {
let response;
const tweets: ITriggerOutput = {
@@ -24,7 +18,7 @@ const searchTweets = async (
do {
const params: IJSONObject = {
query: options.searchTerm,
query: searchTerm,
since_id: $.execution.testRun ? null : $.flow.lastInternalId,
pagination_token: response?.data?.meta?.next_token,
};