Skip to content

Commit

Permalink
[lib] fetchLedFarcasterChannels method
Browse files Browse the repository at this point in the history
Summary:
similar to fetchFollowedFarcasterChannels, except we filter out channels that the user does not lead

Depends on D13293

Test Plan:
https://gist.github.com/vdhanan/fdc48cf3a29f0394ec5646f7c728cefa

confirmed that the new method returned all the channels led by that user and that the existing method returned the same results as before

Reviewers: ashoat

Reviewed By: ashoat

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D13295
  • Loading branch information
vdhanan committed Sep 11, 2024
1 parent ad10638 commit 0773972
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/types/farcaster-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,9 @@ export type NeynarChannel = {
+id: string,
+name: string,
+follower_count: number,
+lead: {
+fid: number,
...
},
...
};
7 changes: 7 additions & 0 deletions lib/utils/neynar-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ class NeynarClient {
return this.fetchFollowedFarcasterChannelsWithFilter(fid, () => true);
}

fetchLedFarcasterChannels(fid: string): Promise<NeynarChannel[]> {
return this.fetchFollowedFarcasterChannelsWithFilter(
fid,
channel => channel.lead.fid === parseInt(fid),
);
}

async fetchFarcasterChannelByName(
channelName: string,
): Promise<?NeynarChannel> {
Expand Down

0 comments on commit 0773972

Please sign in to comment.