neynarxyz / nodejs-sdk

Typescript SDK for Neynar APIs
https://neynar.com
MIT License
50 stars 10 forks source link

feat: add support for `fetchPowerUsersLite` #162

Closed eurbs closed 1 month ago

eurbs commented 1 month ago

Relevant OAS change: https://github.com/neynarxyz/OAS/pull/178

Test Plan

Tested by writing a script

// Call this file testPowerUsersLite.ts

import { NeynarAPIClient } from "./src/neynar-api/neynar-api-client";
import { isApiErrorResponse } from "./src/neynar-api/utils";

// Instantiate the client
const client = new NeynarAPIClient("YOUR_API_KEY"); // Replace with your Neynar API Key.

(async () => {
  try {
    const user = await client.fetchPowerUsersLite();

    // Stringify and log the response
    console.log(JSON.stringify(user));
  } catch (error) {
    // isApiErrorResponse can be used to check for Neynar API errors
    if (isApiErrorResponse(error)) {
      console.log("API Error", error.response.data);
    } else {
      console.log("Generic Error", error);
    }
  }
})();
$ ts-node testPowerUsersLite.ts
{"result":{"fids":[2,3,8,10,12,20,24,25,34,37,43,51,53,57,72,97,99,106 /* etc */ ]}}