@follow-app/client-sdk

中文文档
0.3.98发布于 2026/10/19MITTypeScriptESM + CJS近 30 天下载 4417

TypeScript 客户端 SDK 用于跟踪 RSS 服务器 API

中文使用文档
文档目录21 节
  1. 为什么用Folo SDK?
  2. 安装
  3. 快速启动
  4. 核心特征
  5. * 饲料管理
  6. * 阅读经验
  7. * AI功率特性
  8. 分析与透视
  9. 设置配置( P)
  10. 网络应用程序
  11. 对于Node.js应用程序
  12. 原生反应
  13. 处理错误
  14. 特定错误代码
  15. 配置文件出错代码
  16. 常用案例
  17. 建立个人 RSS 阅读器
  18. 内容校正工具
  19. AI-增强阅读应用程序
  20. 许可证
  21. 捐款

Folo 客户端 SDK

Folo的官方JavaScript/TypeScript客户端 - 现代RSS阅读器. 这个SDK使得可以很容易地构建与Folo的RSS管理,读取历史,以及AI-power特性交互的应用程序.

为什么用Folo SDK?

  • 横线: 工作在浏览器, Node.js, React Introduct 和其他 JavaScript 环境中
  • 类型安全: 具有自动补全和防出错功能的完整类型脚本支持
  • 生产准备:被Folo的官方应用软件所使用,并全面处理出错

安装

pnpm add @follow-app/client-sdk

快速启动

import { FollowClient } from '@follow-app/client-sdk'

// Connect to Folo
const follow = new FollowClient({
  baseURL: 'https://api.follow.is',
  credentials: 'include', // For web apps
})

// Subscribe to an RSS feed
await follow.subscriptions.create({
  url: 'https://example.com/rss',
  category: 'Technology',
})

// Get your latest unread articles
const articles = await follow.entries.list({
  read: false,
  limit: 20,
})

// Mark articles as read
await follow.entries.batch.read({
  entryIds: articles.data.map((entry) => entry.id),
})

核心特征

* 饲料管理

易地订阅和管理 RSS 种子 :

// Subscribe to feeds
await follow.subscriptions.create({
  url: 'https://blog.example.com/rss',
  category: 'Tech Blogs',
})

// Get all your subscriptions
const subscriptions = await follow.subscriptions.get()

// Import OPML files
await follow.subscriptions.import({ opmlContent })

* 阅读经验

跟踪和管理您的读取 :

// Get unread articles
const unread = await follow.entries.list({
  read: false,
  limit: 50,
})

// Mark articles as read
await follow.entries.batch.read({
  entryIds: ['article-1', 'article-2'],
})

// Save articles to inbox
await follow.entries.inbox.add({
  entryId: 'article-123',
  note: 'Read later',
})

* AI功率特性

用人工智能增强阅读能力:

// Get article summaries
const summary = await follow.ai.summary({
  id: 'article-123',
})

// Chat with AI about your articles
const response = await follow.ai.chat({
  messages: [
    { role: 'user', content: 'What are the key trends in this article?' },
  ],
})

// Get personalized recommendations
const recommendations = await follow.ai.recommendations()

分析与透视

了解你的阅读习惯:

// Get reading statistics
const stats = await follow.reads.stats()

// Track feed performance
const feedAnalytics = await follow.feeds.analytics({
  feedId: 'feed-123',
})

设置配置( P)

网络应用程序

import { FollowClient } from '@follow-app/client-sdk'

const follow = new FollowClient({
  baseURL: 'https://api.follow.is',
  credentials: 'include', // For cookie-based authentication
})

对于Node.js应用程序

import { FollowClient } from '@follow-app/client-sdk'

const follow = new FollowClient({
  baseURL: 'https://api.follow.is',
  headers: {
    Authorization: 'Bearer your-api-token',
  },
})

// Or set the token later
follow.setAuthToken('your-api-token')

原生反应

import { FollowClient } from '@follow-app/client-sdk'

const follow = new FollowClient({
  baseURL: 'https://api.follow.is',
  credentials: 'include',
  headers: {
    'User-Agent': 'YourApp/1.0.0',
  },
})

处理错误

SDK为常见情景提供清晰的错误处理:

import { FollowAPIError, FollowAuthError } from '@follow-app/client-sdk'

try {
  const articles = await follow.entries.list()
} catch (error) {
  if (error instanceof FollowAuthError) {
    // User needs to log in
    console.log('Authentication required')
    redirectToLogin()
  } else if (error instanceof FollowAPIError) {
    // Handle API errors (network, server, etc.)
    console.log(`Error: ${error.message}`)
    showErrorMessage(error.message)
  }
}

error.message 是服务器的回答, 适合显示 。 要求的东西被分开 error.request 用于日志和报告:其方法、路径、查询和正文,其数值可认证 用户,例如密码,被替换。 它从来不持有请求的抬头.

特定错误代码

error.serverCode 是服务器答案的代码,其中之一 ExceptionCodeMap,也用于 认证错误, 其 code 实值 AUTH_REQUIRED一个不是API的答案,比如 代理错误页面, 没有 .

import { ExceptionCodeMap, FollowAPIError } from '@follow-app/client-sdk'

try {
  await follow.subscriptions.create({ feedId: '41234567890123456' })
} catch (error) {
  if (error instanceof FollowAPIError && error.serverCode === ExceptionCodeMap.FeedNoFound) {
    console.log('There is no feed with that id')
  }
}

配置文件出错代码

更好的奥特 update-user 财务报告和审定财务报表 sign-up/email 回答一个他们拒绝的配置字段 code 名称字段. 更好的 Auth 客户端解决错误而不是丢弃,所以读取 res.error.code数字 :

代码外地拒绝值
HANDLE_ALREADY_TAKENhandle另外一个用户拥有手柄,在任何信件情况下.
HANDLE_INVALIDhandle一个非 A-Z, (中文(简体) ), a-z, (中文(简体) ), 0-9 或者说 _。 。 。 .
HANDLE_INVALID_CHARACTERShandle无法看到的空间或字符, 例如 U+200B。 。 。 .
HANDLE_TOO_LONGhandle超过36个人物.
NAME_CANNOT_BE_EMPTYname一个空白的名字.
NAME_TOO_LONGname超过64个角色.
IMAGE_TOO_LONGimage超过256个字符.
BIO_TOO_LONGbio超过256个字符.
WEBSITE_TOO_LONGwebsite超过256个字符.

手柄规则只适用于新的或已更改的手柄:在它们继续保存之前保存的手柄,而保存则按原样寄回. 相邻的空间被修剪,一个空白的手柄可以清除.

常用案例

建立个人 RSS 阅读器

// Set up the client
const follow = new FollowClient({
  baseURL: 'https://api.follow.is',
  credentials: 'include',
})

// Subscribe to feeds
await follow.subscriptions.create({
  url: 'https://blog.openai.com/rss/',
  category: 'AI & Technology',
})

// Get latest articles
const latest = await follow.entries.list({
  read: false,
  limit: 20,
})

// Display articles to user, then mark as read
await follow.entries.batch.read({
  entryIds: latest.data.map((article) => article.id),
})

内容校正工具

// Import existing OPML subscription list
await follow.subscriptions.import({ opmlContent })

// Get articles from specific categories
const techNews = await follow.entries.list({
  category: 'Technology',
  limit: 100,
  read: false,
})

// Filter by keywords
const aiArticles = techNews.data.filter(
  (article) =>
    article.title.toLowerCase().includes('ai') ||
    article.content.toLowerCase().includes('artificial intelligence'),
)

// Save important articles to inbox
for (const article of aiArticles) {
  await follow.entries.inbox.add({
    entryId: article.id,
    note: 'AI trend research',
  })
}

AI-增强阅读应用程序

// Get user's reading recommendations
const recommendations = await follow.ai.chat({
  messages: [
    {
      role: 'user',
      content: 'What are the most important articles I should read today?',
    },
  ],
})

// Get summary of long articles
const longArticles = await follow.entries.list({
  read: false,
  limit: 10,
})

for (const article of longArticles.data) {
  const summary = await follow.ai.summary({
    id: article.id,
  })

  console.log(`${article.title}\nSummary: ${summary.summary}`)
}

许可证

麻省理工学院执照 - 看 自由主义 详细文件.

捐款

我们欢迎捐款! 请看我们的 贡献指南 详细情况如下:

  • 建立发展环境
  • 测试和起伏
  • 提交拉动请求
  • 代码样式准则

由美国制造 福罗 团队

版本与发布记录

@follow-app/client-sdk 共发布 112 个版本,首次发布于 2025/07/21;过去 12 个月发布了 12 个版本。

版本发布日期距今
0.3.98latest2026/10/1927 天前
0.3.972026/10/131 个月前
0.3.962026/09/171 个月前
0.3.952026/04/027 个月前
0.3.942026/04/027 个月前
0.3.932026/04/027 个月前

关于 @follow-app/client-sdk 的常见问题

@follow-app/client-sdk 是什么?

TypeScript 客户端 SDK 用于跟踪 RSS 服务器 API

如何安装 @follow-app/client-sdk?

在项目目录运行 npm install @follow-app/client-sdk,或使用 pnpm add / yarn add / bun add。

@follow-app/client-sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@follow-app/client-sdk 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@follow-app/client-sdk 可以商用吗?

@follow-app/client-sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@follow-app/client-sdk 的下载量有多少?

根据 npm 官方下载统计,@follow-app/client-sdk 在 2026/10/15 – 2026/11/13 这 30 天内被下载 4,417 次,日均约 147 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@follow-app/client-sdk 还在维护吗?

最新版本 0.3.98 发布于 2026/10/19(27 天前);至今共发布 112 个版本,其中过去 12 个月发布了 12 个;首次发布于 2025/07/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。