Skip to content

Commit dff3191

Browse files
amishlerromeoscript
authored andcommitted
feat: expose follow and unfollow v2 in Scraper class (#50)
1 parent 477bcaa commit dff3191

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/scraper.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ import {
3333
followUser,
3434
muteUser,
3535
unmuteUser,
36+
followUserV2,
37+
unfollowUserV2,
3638
} from './relationships';
3739
import { QueryProfilesResponse, QueryTweetsResponse } from './timeline-v1';
3840
import { getTrends } from './trends';
@@ -411,6 +413,24 @@ export class Scraper {
411413
return getFollowersV2(userId, maxResults, this.auth);
412414
}
413415

416+
/**
417+
* Follow a user using the v2 API.
418+
* @param userId The user ID to follow.
419+
* @returns A promise that resolves to the follow response.
420+
*/
421+
public followUserV2(userId: string) {
422+
return followUserV2(userId, this.auth);
423+
}
424+
425+
/**
426+
* Unfollow a user using the v2 API.
427+
* @param userId The user ID to unfollow.
428+
* @returns A promise that resolves to the unfollow response.
429+
*/
430+
public unfollowUserV2(userId: string) {
431+
return unfollowUserV2(userId, this.auth);
432+
}
433+
414434
/**
415435
* Fetches following profiles from Twitter.
416436
* @param userId The user whose following should be returned

0 commit comments

Comments
 (0)