Skip to content

Commit 4f556c6

Browse files
BretHudsonromeoscript
authored andcommitted
feat: implement user liked tweets v2 (#56)
1 parent 7503d00 commit 4f556c6

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/tweets.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,3 +1718,26 @@ export async function getQuoteTweetsV2(
17181718
...defaultOptions,
17191719
});
17201720
}
1721+
1722+
/**
1723+
* Fetch tweets liked by a specific user using the v2 API.
1724+
* @param userId The user ID whose liked tweets should be returned.
1725+
* @param maxResults The maximum number of results to return per request.
1726+
* @param auth The authentication object.
1727+
* @returns A promise that resolves to a paginator of liked tweets.
1728+
*/
1729+
export async function getUserLikedTweetsV2(
1730+
userId: string,
1731+
maxResults: number,
1732+
auth: TwitterAuth,
1733+
): Promise<TweetV2UserLikedTweetsPaginator> {
1734+
const client = auth.getV2Client();
1735+
if (!client) {
1736+
throw new Error('Twitter v2 client is not initialized.');
1737+
}
1738+
1739+
return await client.v2.userLikedTweets(userId, {
1740+
max_results: maxResults,
1741+
...defaultOptions,
1742+
});
1743+
}

0 commit comments

Comments
 (0)