# @infogata/socialgata-plugin-typings 中文文档

规范地址：https://npmcn.com/package/%40infogata/socialgata-plugin-typings/

版本：0\.20\.0
npm 元数据更新时间：2026-11-01T05:58:34.508Z
中文译文更新时间：2026-11-01T12:23:51.299Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40infogata/socialgata-plugin-typings
原文对照：https://npmcn.com/package/%40infogata/socialgata-plugin-typings/?lang=original
项目主页：https://github.com/InfoGata/socialgata-plugin-typings
源码仓库：https://github.com/InfoGata/socialgata-plugin-typings

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

- 包体积（解压后）：36.1 kB，8 个文件
- TypeScript 类型：包内自带
- Node.js 要求：\>=12
- 运行依赖：0 个
- 首次发布：2025-11-25T06:39:43.202Z
- 最新版本发布：2026-11-01T05:58:34.188Z
- 已发布版本数：20（近 12 个月 20 个）

## 中文简介

SocialGata插件API的类型

## 安装

```sh
npm install @infogata/socialgata-plugin-typings
```

也可以使用：`pnpm add @infogata/socialgata-plugin-typings`、`yarn add @infogata/socialgata-plugin-typings`、`bun add @infogata/socialgata-plugin-typings`

## README

# socialgata-plugin-typings

[![npm (scoped)](https://img.shields.io/npm/v/@infogata/socialgata-plugin-typings)](https://www.npmjs.com/package/@infogata/socialgata-plugin-typings)

类型 [socialgata](https://github.com/InfoGata/socialgata) 插件。

## 安装

```sh
npm i --save-dev @infogata/socialgata-plugin-typings
```

## 使用

配置 _tsconfig.json_

```json
{
  "compilerOptions": {
    "types": ["@infogata/socialgata-plugin-typings"]
  }
}
```

或者

脚本导入

```js
import "@infogata/socialgata-plugin-typings";
```

## 插件的方法

SocialGata插件可以实现以下回调方法：

### 饲料的方法

-   `onGetFeed(request?: GetFeedRequest)` -获取主feed/时间轴
-   `onGetCommunity(request: GetCommunityRequest)` -从特定社区获取帖子
-   `onGetCommunities(request: GetCommunitiesRequest)` -获取社区列表
-   `onSearch(request: SearchRequest)` -搜寻职位
-   `onSearchCommunity(request: SearchCommunityRequest)` -搜索帖子在一个单一的社区

### 注释的方法

-   `onGetComments(request: GetCommentsRequest)` -获得帖子的评论
-   `onGetCommentReplies(request: GetCommentRepliesRequest)` -获取评论的回复

### 用户的方法

-   `onGetUser(request: GetUserRequest)` -获取用户的个人资料和帖子

### 实例方法（联邦平台）

-   `onGetInstances(request?: GetInstancesRequest)` -获取可用的实例

### 趋势的方法

-   `onGetTrendingTopics(request?: GetTrendingTopicsRequest)` -获取热门话题/标签
-   `onGetTrendingTopicFeed(request: GetTrendingTopicFeedRequest)` -获取热门话题的帖子

### 身份验证方法

-   `onLogin(request: LoginRequest)` -处理登入
-   `onLogout()` -处理注销
-   `onIsLoggedIn()` -检查登录状态
-   `onPostLogin()` —登录成功后调用
-   `onPostLogout()` -登出后调用

### 用户界面的方法

-   `onUiMessage(message: any)` -接收来自UI帧的消息
-   `onChangeTheme(theme: Theme)` -当主题改变时调用
-   `onGetPlatformType()` -返回平台类型（论坛、微博、图板）

## 常见问题

### @infogata/socialgata-plugin-typings 是什么？

SocialGata插件API的类型

### 如何安装 @infogata/socialgata-plugin-typings？

在项目目录运行 npm install @infogata/socialgata-plugin-typings，或使用 pnpm add / yarn add / bun add。

### @infogata/socialgata-plugin-typings 支持 TypeScript 吗？

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

### @infogata/socialgata-plugin-typings 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=12。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @infogata/socialgata-plugin-typings 可以商用吗？

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

### @infogata/socialgata-plugin-typings 还在维护吗？

最新版本 0\.20\.0 发布于 2026/11/01（2 天前）；至今共发布 20 个版本，其中过去 12 个月发布了 20 个；首次发布于 2025/11/25。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

