refactor: Use plural wording for user tweets trigger
This commit is contained in:
27
packages/backend/src/apps/twitter/triggers/user-tweets.ts
Normal file
27
packages/backend/src/apps/twitter/triggers/user-tweets.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import TwitterClient from '../client';
|
||||
|
||||
export default class UserTweets {
|
||||
client: TwitterClient;
|
||||
|
||||
constructor(client: TwitterClient) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
async run(lastInternalId: string) {
|
||||
return this.getTweets(lastInternalId);
|
||||
}
|
||||
|
||||
async testRun() {
|
||||
return this.getTweets();
|
||||
}
|
||||
|
||||
async getTweets(lastInternalId?: string) {
|
||||
const user = await this.client.getUserByUsername.run(
|
||||
this.client.step.parameters.username as string
|
||||
);
|
||||
|
||||
const tweets = await this.client.getUserTweets.run(user.id, lastInternalId);
|
||||
|
||||
return tweets;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user