Skip to content

Commit

Permalink
yield entire response rather than single value and rename fetchFeed t…
Browse files Browse the repository at this point in the history
…o fetchFeedPage

yield entire response rather than single value and rename fetchFeed to fetchFeedPage
  • Loading branch information
Shreyaschorge authored Nov 1, 2023
2 parents ae1f2cd + 4555867 commit b9056ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neynar/nodejs-sdk",
"version": "0.6.0",
"version": "0.6.1",
"description": "SDK to interact with Neynar APIs (https://docs.neynar.com/)",
"main": "./build/index.js",
"types": "./build/index.d.ts",
Expand Down
10 changes: 6 additions & 4 deletions src/neynar-api/neynar-v2-api/neynar-api-v2-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,11 @@ export class NeynarV2APIClient {
// ------------ Feed ------------

/**
* Get reverse chronological feed for a user based on their follow graph. See [Neynar documentation](https://docs.neynar.com/reference/get-feed)
* Get reverse chronological feed page for a user based on their follow graph.
* See [Neynar documentation](https://docs.neynar.com/reference/feed)
*
*/
public async *fetchFeed(
public async *fetchFeedPage(
fid: number,
options?: {
feedType?: FeedType;
Expand All @@ -266,7 +268,7 @@ export class NeynarV2APIClient {
parentUrl?: string;
pageSize?: number;
}
): AsyncGenerator<CastWithInteractions, void, undefined> {
): AsyncGenerator<CastWithInteractions[], void, undefined> {
let cursor: string | undefined;

while (true) {
Expand All @@ -281,7 +283,7 @@ export class NeynarV2APIClient {
});

// yield current page of casts
yield* response.data.casts;
yield response.data.casts;

// prep for next page
if (response.data.next.cursor === null) {
Expand Down

0 comments on commit b9056ea

Please sign in to comment.