feat: Implement draft version of pagination with user tweet trigger

This commit is contained in:
Faruk AYDIN
2022-08-29 23:11:28 +03:00
parent 6271cedc25
commit 5ddb5ab6fa
8 changed files with 92 additions and 35 deletions

View File

@@ -7,24 +7,19 @@ export default class UserTweet {
this.client = client;
}
async run() {
return this.getTweets();
async run(lastInternalId: string) {
return this.getTweets(lastInternalId);
}
async testRun() {
return this.getTweets();
}
async getTweets() {
const userResponse = await this.client.getUserByUsername.run(
async getTweets(lastInternalId?: string) {
const user = await this.client.getUserByUsername.run(
this.client.step.parameters.username as string
);
const userId = userResponse.data.data.id;
const tweetsResponse = await this.client.getUserTweets.run(userId);
const tweets = tweetsResponse.data.data;
return tweets;
return await this.client.getUserTweets.run(user.id, lastInternalId);
}
}