# @follow-app/client-sdk 中文文档

规范地址：https://npmcn.com/package/%40follow-app/client-sdk/

版本：0\.3\.98
npm 元数据更新时间：2026-10-18T22:15:45.346Z
中文译文更新时间：2026-11-15T04:08:54.704Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40follow-app/client-sdk
原文对照：https://npmcn.com/package/%40follow-app/client-sdk/?lang=original

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：890 kB，122 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：6 个
- 首次发布：2025-07-21T10:02:58.624Z
- 最新版本发布：2026-10-18T22:15:45.141Z
- 近 30 天下载量：4417（2026-10-15 至 2026-11-13，npm 官方下载统计）
- 已发布版本数：112（近 12 个月 12 个）

## 中文简介

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

## 安装

```sh
npm install @follow-app/client-sdk
```

也可以使用：`pnpm add @follow-app/client-sdk`、`yarn add @follow-app/client-sdk`、`bun add @follow-app/client-sdk`

## README

# Folo 客户端 SDK

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

## 为什么用Folo SDK?

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

## 安装

```bash
pnpm add @follow-app/client-sdk
```

## 快速启动

```typescript
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 种子 :

```typescript
// 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 })
```

### \* 阅读经验

跟踪和管理您的读取 :

```typescript
// 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功率特性

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

```typescript
// 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()
```

### 分析与透视

了解你的阅读习惯:

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

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

## 设置配置( P)

### 网络应用程序

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

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

### 对于Node.js应用程序

```typescript
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')
```

### 原生反应

```typescript
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为常见情景提供清晰的错误处理:

```typescript
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的答案,比如 代理错误页面, 没有 .

```typescript
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_TAKEN` | `handle` | 另外一个用户拥有手柄,在任何信件情况下. |
| `HANDLE_INVALID` | `handle` | 一个非 `A-Z`, (中文(简体) ), `a-z`, (中文(简体) ), `0-9` 或者说 `_`。 。 。 . |
| `HANDLE_INVALID_CHARACTERS` | `handle` | 无法看到的空间或字符, 例如 `U+200B`。 。 。 . |
| `HANDLE_TOO_LONG` | `handle` | 超过36个人物. |
| `NAME_CANNOT_BE_EMPTY` | `name` | 一个空白的名字. |
| `NAME_TOO_LONG` | `name` | 超过64个角色. |
| `IMAGE_TOO_LONG` | `image` | 超过256个字符. |
| `BIO_TOO_LONG` | `bio` | 超过256个字符. |
| `WEBSITE_TOO_LONG` | `website` | 超过256个字符. |

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

## 常用案例

### 建立个人 RSS 阅读器

```typescript
// 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),
})
```

### 内容校正工具

```typescript
// 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-增强阅读应用程序

```typescript
// 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}`)
}
```

## 许可证

麻省理工学院执照 - 看 [自由主义](https://npmcn.com/package/%40follow-app/client-sdk/LICENSE) 详细文件.

## 捐款

我们欢迎捐款! 请看我们的 [贡献指南](https://github.com/RSSNext/folo/blob/main/CONTRIBUTING.md) 详细情况如下:

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

* * *

由美国制造 [福罗](https://follow.is/) 团队

## 常见问题

### @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（28 天前）；至今共发布 112 个版本，其中过去 12 个月发布了 12 个；首次发布于 2025/07/21。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

