neynarxyz / nodejs-sdk

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

feat: add context for viewers and authors w.r.t. channels #212

Closed valerierose closed 3 weeks ago

valerierose commented 3 weeks ago

Overview

Casts in channels now return context for the viewer and the author.

Example

# index.js
const result = await client.fetchFeed("filter", {limit: 1, filterType: "channel_id", channelId: "neynar", "viewerFid": 489795});
console.log(JSON.stringify(result));
node index.js | jq '.casts[] | {
  "text": .text,
  "username": .author.username,
  "fid": .author.fid,
  "channel": .channel,
  "author_channel_context": .author_channel_context,
}'
{
  "text": "@woj.eth has been building on Farcaster for a while, was also among the first apps to offer Farcaster signups\n\nWe added the supercast journey to our blog\n\n🪐\n\nhttps://neynar.com/blog/spotlight-supercast",
  "username": "rish",
  "fid": 194,
  "channel": {
    "object": "channel_dehydrated",
    "id": "neynar",
    "name": "Neynar",
    "image_url": "https://imagedelivery.net/BXluQx4ige9GuW0Ia56BHw/86b3a6fe-a058-442f-7590-eaacc1e8c800/original",
    "viewer_context": {
      "role": "member",
      "following": true
    }
  },
  "author_channel_context": {
    "role": "moderator",
    "following": true
  }
}