FastComments.com

FastComments JavaScript/TypeScript SDK


这是 FastComments 的官方 JavaScript/TypeScript SDK。

FastComments API 的官方 JavaScript/TypeScript SDK

仓库

在 GitHub 上查看


安装 Internal Link

npm install fastcomments-sdk

API 文档 Internal Link


完整的 API 参考: docs/api/README.md

浏览器与服务器兼容性 Internal Link


此 SDK 使用 双入口点 以确保最佳兼容性并防止运行时错误:

  • fastcomments-sdk/browser - 浏览器安全版本,使用原生 fetch
  • fastcomments-sdk/server - 完整的 Node.js 版本,支持 SSO
  • fastcomments-sdk (默认) - 仅类型,可在任何地方安全导入

公开 API 与受保护 API Internal Link

The SDK provides three main API classes:

  • DefaultApi - 受保护的端点,要求使用 API 密钥进行身份验证。用于服务器端操作。
  • PublicApi - 公共端点,可在无需 API 密钥的情况下访问。可以直接从浏览器/移动设备等调用。
  • HiddenApi - 用于高级用例的内部/管理端点。

Example: Using Public API (browser-safe)

import { PublicApi } from 'fastcomments-sdk/browser';

const publicApi = new PublicApi();

// 获取页面的评论(不需要 API 密钥)
const response = await publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id'
});

Example: Using Default API (server-side only)

import { DefaultApi, Configuration } from 'fastcomments-sdk/server';

const config = new Configuration({
  apiKey: 'your-api-key' // 请保密!
});
const defaultApi = new DefaultApi(config);

// 使用完整的管理员访问权限获取评论
const response = await defaultApi.getComments({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id'
});

SSO(单点登录)集成 Internal Link

FastComments 支持 SSO,以与您现有的用户认证系统集成。 SSO 功能仅在服务器导出中可用,因为它需要 Node.js crypto 功能。

简单 SSO(仅服务器端)

简单 SSO 应在服务器端生成并发送到客户端:

// 服务器端代码(Node.js/后端)
import { FastCommentsSSO, PublicApi } from 'fastcomments-sdk/server';

// 使用内置辅助创建简单 SSO  
const userData = {
  username: 'john_doe',
  email: 'john@example.com',
  displayName: 'John Doe',
  avatar: 'https://example.com/avatar.jpg'
};

const sso = FastCommentsSSO.createSimple(userData, {
  loginURL: '/login',
  logoutURL: '/logout'
});

const ssoToken = sso.createToken();

// 将 ssoToken 发送到您的客户端代码
// 客户端代码然后可以使用该令牌与浏览器 SDK 一起使用

安全 SSO(服务器端,推荐)

安全 SSO 应在服务器端实现,并提供更好的安全性:

// 服务器端代码(Node.js/后端)
import { FastCommentsSSO, PublicApi } from 'fastcomments-sdk/server';

// 使用内置辅助创建安全 SSO
const userData = {
  id: 'user-123',
  email: 'john@example.com',
  username: 'john_doe',
  displayName: 'John Doe',
  avatar: 'https://example.com/avatar.jpg',
  isAdmin: false,
  isModerator: false
};

const sso = FastCommentsSSO.createSecure('your-api-key', userData, {
  loginURL: '/login',
  logoutURL: '/logout'
});

const ssoConfig = sso.prepareToSend();

// 在服务器上与 API 调用一起使用
const publicApi = new PublicApi();
const response = await publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
  sso: JSON.stringify(ssoConfig)
});

// 或将 ssoConfig 发送到客户端以供浏览器使用

在浏览器中使用 SSO(使用服务器生成的令牌)

// 客户端代码(浏览器)
import { PublicApi } from 'fastcomments-sdk/browser';

// 从您的服务器端点获取 SSO 令牌
const ssoToken = await fetch('/api/sso-token').then(r => r.json());

const publicApi = new PublicApi();
const response = await publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
  sso: ssoToken // Use the server-generated SSO token
});

带评论创建的 SSO

// 服务器端:创建 SSO 和评论
import { FastCommentsSSO, PublicApi } from 'fastcomments-sdk/server';

const sso = FastCommentsSSO.createSecure('your-api-key', userData);
const ssoConfig = sso.prepareToSend();

const response = await publicApi.createCommentPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
  broadcastId: 'unique-broadcast-id',
  commentData: {
    comment: 'This is my comment',
    date: Date.now(),
    commenterName: 'John Doe',
    url: 'https://example.com/page',
    urlId: 'page-url-id'
  },
  sso: JSON.stringify(ssoConfig)
});

常见用例 Internal Link

获取页面的评论

const comments = await sdk.publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'article-123'
});

创建评论

const newComment = await sdk.publicApi.createCommentPublic({
  createCommentParams: {
    tenantId: 'your-tenant-id',
    urlId: 'article-123',
    comment: 'Great article!',
    commenterName: 'John Doe',
    commenterEmail: 'john@example.com'
  }
});

对评论投票

const voteResponse = await sdk.publicApi.voteComment({
  voteBodyParams: {
    commentId: 'comment-id',
    direction: 1 // 1 表示赞成,-1 表示反对
  }
});

用户管理(需要 API 密钥)

// 搜索用户(需要 DefaultApi)
const users = await sdk.defaultApi.searchUsers({
  tenantId: 'your-tenant-id',
  urlId: 'page-id',
  usernameStartsWith: 'john'
});

实时事件(实时更新) Internal Link

订阅实时事件以获取有关评论、投票和其他活动的实时更新。

页面级事件

监听特定页面的实时事件(评论、投票等):

import { subscribeToChanges, LiveEvent, LiveEventType } from 'fastcomments-sdk/browser';

const config = {
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
};

// Subscribe to live events for a page
const subscription = subscribeToChanges(
  config,
  'your-tenant-id', // tenantIdWS
  'page-url-id',    // urlIdWS  
  'user-session-id', // userIdWS (get this from getComments response)
  (event: LiveEvent) => {
    console.log('Live event received:', event);

    switch (event.type) {
      case LiveEventType.new_comment:
        console.log('New comment:', event.comment);
        // Update your UI with the new comment
        break;
      case LiveEventType.new_vote:
        console.log('New vote:', event.vote);
        // Update vote counts in your UI
        break;
      case LiveEventType.updated_comment:
        console.log('Comment updated:', event.comment);
        break;
      default:
        console.log('Other event type:', event.type);
    }

    return true; // Return true if event was handled
  },
  (isConnected: boolean) => {
    console.log('Connection status:', isConnected ? 'Connected' : 'Disconnected');
  }
);

// Close the subscription when done
subscription.close();

订阅用户事件

监听特定于用户的事件(通知、提及等):

import { subscribeToUserFeed, LiveEvent, LiveEventType } from 'fastcomments-sdk/browser';

const userConfig = {
  userIdWS: 'user-session-id', // Get this from getComments response
};

// Subscribe to user's personal feed
const userSubscription = subscribeToUserFeed(
  userConfig,
  (event: LiveEvent) => {
    console.log('User event received:', event);

    switch (event.type) {
      case LiveEventType.notification:
        console.log('New notification:', event.notification);
        // Show notification in your UI
        break;
      case LiveEventType.notification_update:
        console.log('Notification updated:', event.notification);
        break;
      default:
        console.log('Other user event:', event.type);
    }

    return true;
  },
  (isConnected: boolean) => {
    console.log('User feed connection:', isConnected ? 'Connected' : 'Disconnected');
  }
);

// Close when done
userSubscription.close();

获取 userIdWS

The userIdWS parameter is required for live events and can be obtained from API responses:

const response = await sdk.publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-id'
});

// Extract userIdWS from the response
const userIdWS = response.data?.userSessionInfo?.userIdWS;

if (userIdWS) {
  // Now you can subscribe to live events
  const subscription = subscribeToChanges(config, tenantIdWS, urlIdWS, userIdWS, handleEvent);
}

广播 ID Internal Link


您会看到在某些 API 调用中需要传递 broadcastId。当您接收事件时,会拿回这个 ID,这样如果您计划在客户端乐观地应用更改(您可能会想这样做,因为它提供了最佳体验),就可以知道是否忽略该事件。在这里传入一个 UUID。该 ID 应足够唯一,以避免在同一浏览器会话中出现两次。

import { v4 as uuidv4 } from 'uuid';

const response = await sdk.publicApi.createCommentPublic({
  createCommentParams: {
    tenantId: 'your-tenant-id',
    urlId: 'page-id',
    comment: 'My comment',
    broadcastId: uuidv4() // 此操作的唯一 ID
  }
});

错误处理 Internal Link

try {
  const comments = await sdk.publicApi.getCommentsPublic({
    tenantId: 'your-tenant-id',
    urlId: 'page-id'
  });
} catch (error) {
  if (error.response?.status === 404) {
    console.log('Page not found');
  } else {
    console.error('API Error:', error.message);
  }
}

聚合 Internal Link

通过对文档进行分组(如果提供了 groupBy)并应用多个操作来聚合文档。支持不同的操作(例如 sum、countDistinct、avg 等)。

参数

名称 类型 必填 描述
tenantId string
aggregationRequest AggregationRequest
parentTenantId string
includeStats boolean

响应

返回:AggregationResponse


获取审计日志 Internal Link

参数

名称 类型 必需 描述
tenantId string Yes
limit number No
skip number No
order SORTDIR No
after number No
before number No

响应

返回:GetAuditLogs200Response

示例

getAuditLogs 示例
Copy Copy
1
2async function main(): Promise<void> {
3 const tenantId: string = 'tenant_9b8f6c';
4 const limit: number = 50;
5 const skip: number = 0;
6 const order: SORTDIR = 'desc';
7 const after: number = Date.now() - 7 * 24 * 60 * 60 * 1000;
8 const response: GetAuditLogs200Response = await getAuditLogs(tenantId, limit, skip, order, after);
9 console.log(response);
10}
11main();
12

从公开评论屏蔽 Internal Link

参数

名称 类型 必需 描述
tenantId string
commentId string
publicBlockFromCommentParams PublicBlockFromCommentParams
sso string

响应

返回: BlockFromCommentPublic200Response

示例

blockFromCommentPublic 示例
Copy Copy
1
2const tenantId: string = "site_7f9b2e";
3const commentId: string = "comment_2026-03-25_001";
4const publicBlockFromCommentParams: PublicBlockFromCommentParams = {
5 reason: "Repeated harassment and targeted abuse",
6 blockDurationDays: 90,
7 includeHistory: true,
8 notifyModeratorTeam: true
9};
10const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.fakePayload.signature";
11const result: BlockFromCommentPublic200Response = await blockFromCommentPublic(tenantId, commentId, publicBlockFromCommentParams, sso);
12

取消公开评论屏蔽 Internal Link

参数

名称 类型 必填 描述
tenantId string
commentId string
publicBlockFromCommentParams PublicBlockFromCommentParams
sso string

响应

返回: UnBlockCommentPublic200Response

示例

unBlockCommentPublic 示例
Copy Copy
1
2const tenantId: string = 'tenant_42e8a1';
3const commentId: string = 'cmt_9b3f2d';
4const publicBlockFromCommentParams: PublicBlockFromCommentParams = {
5 reason: 'abusive_language',
6 blockedByModeratorId: 'mod_17',
7 note: 'Targeted harassment; review complete',
8 unblockRequestedAt: new Date().toISOString()
9};
10const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature';
11const result: UnBlockCommentPublic200Response = await unBlockCommentPublic(tenantId, commentId, publicBlockFromCommentParams, sso);
12

检查被屏蔽的评论 Internal Link

参数

名称 类型 必填 描述
tenantId string
commentIds string
sso string

响应

返回: CheckedCommentsForBlocked200Response

示例

checkedCommentsForBlocked 示例
Copy Copy
1
2const tenantId: string = 'tenant_4f3b2a1e';
3const commentIds: string = 'c_1001,c_1002,c_1003';
4const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIn0.Sf4ke7nQP3mZx9v2';
5
6const resultWithoutSSO: CheckedCommentsForBlocked200Response = await checkedCommentsForBlocked(tenantId, commentIds);
7const resultWithSSO: CheckedCommentsForBlocked200Response = await checkedCommentsForBlocked(tenantId, commentIds, ssoToken);
8

从评论屏蔽用户 Internal Link

参数

Name Type Required Description
tenantId string
id string
blockFromCommentParams BlockFromCommentParams
userId string
anonUserId string

响应

返回: BlockFromCommentPublic200Response

示例

blockUserFromComment 示例
Copy Copy
1
2const tenantId: string = "tenant_12345";
3const id: string = "comment_67890";
4const blockFromCommentParams: BlockFromCommentParams = {
5 reason: "Repeated abusive language",
6 blockDurationHours: 168,
7 blockReplies: true,
8 notifyAuthor: true
9};
10const userId: string = "user_abc123";
11const anonUserId: string = "anon_xyz789";
12const result: BlockFromCommentPublic200Response = await blockUserFromComment(tenantId, id, blockFromCommentParams, userId, anonUserId);
13

创建公开评论 Internal Link


参数

Name Type Required Description
tenantId string
urlId string
broadcastId string
commentData CommentData
sessionId string
sso string

响应

返回:CreateCommentPublic200Response

示例

createCommentPublic 示例
Copy Copy
1
2const tenantId: string = 'tenant_prod_42';
3const urlId: string = 'article-2026-03-25-tech-deep-dive';
4const broadcastId: string = 'live-broadcast-001';
5const sessionId: string = 'sess_9f8e7d6a3b';
6const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature';
7const commentData: CommentData = {
8 content: 'Great reporting — appreciated the depth on performance tradeoffs.',
9 authorName: 'Jordan M.',
10 language: 'en-US',
11 metadata: { client: 'web' }
12};
13const result: CreateCommentPublic200Response = await createCommentPublic(tenantId, urlId, broadcastId, commentData, sessionId, sso);
14

删除评论 Internal Link

参数

Name Type Required Description
tenantId string
id string
contextUserId string
isLive boolean

响应

返回:DeleteComment200Response

示例

deleteComment 示例
Copy Copy
1
2const tenantId: string = 'tenant_7b3f2a';
3const commentId: string = 'cmt_8a1f4d2b';
4const contextUserId: string = 'user_102';
5const isLive: boolean = true;
6const result: DeleteComment200Response = await deleteComment(tenantId, commentId, contextUserId, isLive);
7

删除公开评论 Internal Link

参数

名称 类型 必需 描述
tenantId string
commentId string
broadcastId string
editKey string
sso string

响应

返回: DeleteCommentPublic200Response

示例

deleteCommentPublic 示例
Copy Copy
1
2const tenantId: string = 'tenant_4f2c9b';
3const commentId: string = 'comment-7c3a9f2d';
4const broadcastId: string = 'article-2026-03-20';
5const editKey: string | undefined = 'ek_pub_abc12345';
6const sso: string | undefined = 'sso_eyJhbGciOiJIUzI1Ni';
7
8const result: DeleteCommentPublic200Response = await deleteCommentPublic(
9 tenantId,
10 commentId,
11 broadcastId,
12 editKey,
13 sso
14);
15

删除评论投票 Internal Link

参数

名称 类型 必填 描述
tenantId string
commentId string
voteId string
urlId string
broadcastId string
editKey string
sso string

响应

返回: DeleteCommentVote200Response

示例

deleteCommentVote 示例
Copy Copy
1
2const tenantId: string = 'acme-tenant-87e4fd';
3const commentId: string = 'cmt-9a12b3f4';
4const voteId: string = 'vote-4f6d21b9';
5const urlId: string = 'https://www.acme.com/articles/2026/03/25/how-to-test';
6const broadcastId: string = 'broadcast-20260325-01';
7const editKey: string = 'editkey-6b7c8d9e';
8const sso: string = 'sso-jwt-eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
9
10const response: DeleteCommentVote200Response = await deleteCommentVote(
11 tenantId,
12 commentId,
13 voteId,
14 urlId,
15 broadcastId,
16 editKey,
17 sso
18);
19

标记评论 Internal Link

参数

名称 类型 必填 描述
tenantId string
id string
userId string
anonUserId string

响应

返回:FlagComment200Response

示例

flagComment 示例
Copy Copy
1
2const tenantId: string = 'tenant_acme_001';
3const id: string = 'comment_7f3a2b9e';
4const userId: string = 'user_jdoe_1001';
5const anonUserId: string = 'anon_3f2b_visitor';
6const result: FlagComment200Response = await flagComment(tenantId, id, userId, anonUserId);
7

获取评论 Internal Link

参数

Name Type Required Description
tenantId string
id string

响应

返回: GetComment200Response

示例

getComment 示例
Copy Copy
1
2const tenantId: string = "acme-publishing-001";
3const commentId: string = "f3b2c1d0-9a8e-4b7c-8123-6d5f0a1e2b3c";
4const result: GetComment200Response = await getComment(tenantId, commentId);
5const wrapper: GetComment200Response & { comment?: APIComment } = result;
6const comment: APIComment | undefined = wrapper.comment;
7const authorBadge: CommentUserBadgeInfo | undefined = comment?.user?.badge;
8const userHashTags: CommentUserHashTagInfo[] | undefined = comment?.user?.hashTags
9

获取评论列表 Internal Link

参数

Name Type Required Description
tenantId string
page number
limit number
skip number
asTree boolean
skipChildren number
limitChildren number
maxTreeDepth number
urlId string
userId string
anonUserId string
contextUserId string
hashTag string
parentId string
direction SortDirections

响应

返回: GetComments200Response

示例

getComments 示例
Copy Copy
1
2const tenantId: string = 'tenant_acme_42';
3const response: GetComments200Response = await getComments(
4 tenantId,
5 1, // 页码
6 20, // 每页数量
7 0, // 跳过
8 true, // 是否以树形
9 1, // 跳过子评论
10 3, // 子评论限制
11 4, // 最大树深度
12 'articles/2026/new-product-launch', // URL 标识
13 'user_7890', // 用户 ID
14 'anon_4f3b2', // 匿名用户 ID
15 undefined, // 上下文用户 ID
16 '#launch', // 话题标签
17 undefined // 父评论 ID
18);
19

获取公开评论 Internal Link

req tenantId urlId

参数

名称 类型 必填 描述
tenantId string
urlId string
page number
direction SortDirections
sso string
skip number
skipChildren number
limit number
limitChildren number
countChildren boolean
fetchPageForCommentId string
includeConfig boolean
countAll boolean
includei10n boolean
locale string
modules string
isCrawler boolean
includeNotificationCount boolean
asTree boolean
maxTreeDepth number
useFullTranslationIds boolean
parentId string
searchText string
hashTags Array
userId string
customConfigStr string
afterCommentId string
beforeCommentId string

响应

返回:GetCommentsPublic200Response

示例

getCommentsPublic 示例
Copy Copy
1
2const tenantId: string = 'tenant_eu-west_01';
3const urlId: string = 'https://www.financialtimes.com/articles/2026/market-update-q1';
4const response: GetCommentsPublic200Response = await getCommentsPublic(
5 tenantId,
6 urlId,
7 2,
8 undefined,
9 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.tokenPayload.signature',
10 undefined,
11 0,
12 50,
13 5,
14 true,
15 undefined,
16 true,
17 false,
18 true,
19 'en-US',
20 'reactions,moderation',
21 false,
22 true,
23 true,
24 3,
25 false,
26 undefined,
27 'performance',
28 ['feature','fastcomments'],
29 'user_9876',
30 undefined,
31 undefined,
32 undefined
33);
34

获取评论文本 Internal Link

参数

名称 类型 必需 描述
tenantId string
commentId string
editKey string
sso string

响应

返回:GetCommentText200Response

示例

getCommentText 示例
Copy Copy
1
2const tenantId: string = 'tenant_acme_001';
3const commentId: string = 'cmt_7890b';
4const editKey: string = 'edit_4f2d9b7c';
5const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
6
7const result: GetCommentText200Response = await getCommentText(tenantId, commentId, editKey, sso);
8

获取评论投票用户名 Internal Link

参数

名称 类型 必需 描述
tenantId string Yes
commentId string Yes
dir number Yes
sso string No

响应

返回: GetCommentVoteUserNames200Response

示例

getCommentVoteUserNames 示例
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_4f2c1e';
4 const commentId: string = 'cmt_9a7b3d';
5 const dir: number = 1;
6 const resultUpvotes: GetCommentVoteUserNames200Response = await getCommentVoteUserNames(tenantId, commentId, dir);
7 const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.fakepayload.signature';
8 const dirDown: number = -1;
9 const resultDownvotes: GetCommentVoteUserNames200Response = await getCommentVoteUserNames(tenantId, commentId, dirDown, sso);
10 console.log(resultUpvotes, resultDownvotes);
11})();
12

锁定评论 Internal Link

参数

名称 类型 必填 描述
tenantId string
commentId string
broadcastId string
sso string

响应

返回: LockComment200Response

示例

lockComment 示例
Copy Copy
1
2const tenantId: string = "tenant_prod_8f3a2b";
3const commentId: string = "cmt_5d7e9a92";
4const broadcastId: string = "broadcast_2026_03_25_1400";
5const ssoToken: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature";
6const resultWithSso: LockComment200Response = await lockComment(tenantId, commentId, broadcastId, ssoToken);
7const resultWithoutSso: LockComment200Response = await lockComment(tenantId, commentId, broadcastId);
8

置顶评论 Internal Link

参数

名称 类型 必填 描述
tenantId string
commentId string
broadcastId string
sso string

响应

返回: PinComment200Response

示例

pinComment 示例
Copy Copy
1
2const tenantId: string = "tenant_4f2b9a";
3const commentId: string = "cmt_9f8e7d6c";
4const broadcastId: string = "brd_live_concert_2026-03-25";
5const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.sso_payload_signature";
6
7const result: PinComment200Response = await pinComment(tenantId, commentId, broadcastId, sso);
8

保存评论 Internal Link

参数

名称 类型 必填 描述
tenantId string
createCommentParams CreateCommentParams
isLive boolean
doSpamCheck boolean
sendEmails boolean
populateNotifications boolean

响应

返回: SaveComment200Response

示例

saveComment 示例
Copy Copy
1
2const tenantId: string = 'tenant_acme_001';
3const createCommentParams: CreateCommentParams = {
4 content: 'Great article — helped me fix a production issue in minutes.',
5 url: 'https://app.acme.com/blog/performance-tips',
6 author: { name: 'Maya Chen', email: 'maya.chen@acme.com' },
7 metadata: { locale: 'en-US', appVersion: '4.2.1' }
8} as CreateCommentParams;
9const isLive: boolean = true;
10const doSpamCheck: boolean = true;
11const sendEmails: boolean = false;
12const populateNotifications: boolean = true;
13const result: SaveComment200Response = await saveComment(tenantId, createCommentParams, isLive, doSpamCheck, sendEmails, populateNotifications);
14

批量保存评论 Internal Link

参数

名称 类型 是否必须 描述
tenantId string
createCommentParams Array
isLive boolean
doSpamCheck boolean
sendEmails boolean
populateNotifications boolean

响应

返回: Array<SaveComment200Response

示例

saveCommentsBulk 示例
Copy Copy
1
2const tenantId: string = 'acme-corp-01';
3const mentions1: CommentUserMentionInfo[] = [{ userId: 'user-123', displayName: 'Jane Doe' }];
4const hashtags1: CommentUserHashTagInfo[] = [{ tag: 'typescript' }];
5const createCommentParams: CreateCommentParams[] = [
6 {
7 content: 'Great insights on async/await patterns.',
8 authorName: 'John Smith',
9 authorEmail: 'john.smith@acme.com',
10 externalId: 'comment-001',
11 createdAt: '2026-03-25T10:15:00Z',
12 userMentions: mentions1,
13 userHashTags: hashtags1
14 },
15 {
16 content: 'I prefer using Promise.all for bulk ops.',
17 authorName: 'Emily Turner',
18 authorEmail: 'emily.turner@acme.com',
19 externalId: 'comment-002',
20 createdAt: '2026-03-25T10:20:00Z'
21 }
22];
23const result: SaveComment200Response[] = await saveCommentsBulk(tenantId, createCommentParams, true, true, false, true);
24

设置评论文本 Internal Link

参数

Name Type Required Description
tenantId string
commentId string
broadcastId string
commentTextUpdateRequest CommentTextUpdateRequest
editKey string
sso string

响应

返回:SetCommentText200Response

示例

setCommentText 示例
Copy Copy
1
2const tenantId: string = 'tenant_6721f4';
3const commentId: string = 'cmt_9a3b2d';
4const broadcastId: string = 'live_2026_03_25';
5const editKey: string = 'edit_k_4f7b9';
6const sso: string = 'sso_tok_eyJhbGciOiJIUzI1';
7const commentTextUpdateRequest: CommentTextUpdateRequest = {
8 text: 'Updated to clarify the timeline and link the relevant docs.',
9 mentions: [{ userId: 'user_102', displayName: 'Alex Rivera' }],
10 hashtags: [{ tag: 'product-update' }]
11};
12const result: SetCommentText200Response = await setCommentText(tenantId, commentId, broadcastId, commentTextUpdateRequest, editKey, sso);
13

取消对评论的用户屏蔽 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string
unBlockFromCommentParams UnBlockFromCommentParams
userId string
anonUserId string

响应

返回: UnBlockCommentPublic200Response

示例

unBlockUserFromComment 示例
Copy Copy
1
2const tenantId: string = 'tenant_87f3e1';
3const id: string = 'comment_9b2a4f';
4const unBlockFromCommentParams: UnBlockFromCommentParams = {
5 reason: 'Reviewed by moderation team — reinstated',
6 moderatorId: 'mod_21',
7 unblockedAt: new Date().toISOString()
8};
9const userId: string = 'user_42';
10const anonUserId: string = 'anon_e7f9';
11const result: UnBlockCommentPublic200Response = await unBlockUserFromComment(tenantId, id, unBlockFromCommentParams, userId, anonUserId);
12

取消标记评论 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string
userId string
anonUserId string

响应

返回:FlagComment200Response

示例

unFlagComment 示例
Copy Copy
1
2const tenantId: string = 'acme-tenant-001';
3const commentId: string = 'cmt_9f8e7d6c';
4const userId: string = 'user_72b4a1c9';
5const anonUserId: string = 'anon_3d2c1b0a';
6const response: FlagComment200Response = await unFlagComment(tenantId, commentId, userId, anonUserId);
7

解锁评论 Internal Link

参数

Name Type Required Description
tenantId string
commentId string
broadcastId string
sso string

响应

返回:LockComment200Response

示例

unLockComment 示例
Copy Copy
1
2const tenantId: string = 'tenant_9d4f2b';
3const commentId: string = 'cmt_8a3e1f';
4const broadcastId: string = 'broadcast_2026_03_25';
5const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature';
6
7const result: LockComment200Response = await unLockComment(tenantId, commentId, broadcastId, sso);
8

取消置顶评论 Internal Link

参数

名称 类型 必需 描述
tenantId string
commentId string
broadcastId string
sso string

响应

返回:PinComment200Response

示例

unPinComment 示例
Copy Copy
1
2const tenantId: string = 'tenant_7f9d2a3b';
3const commentId: string = 'comment_842b9c1f';
4const broadcastId: string = 'bcast_frontpage_202603';
5const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.exampleSignature';
6
7const result: PinComment200Response = await unPinComment(tenantId, commentId, broadcastId, sso);
8

更新评论 Internal Link

参数

Name Type 必需 描述
tenantId string
id string
updatableCommentParams UpdatableCommentParams
contextUserId string
doSpamCheck boolean
isLive boolean

响应

返回: FlagCommentPublic200Response

示例

updateComment 示例
Copy Copy
1
2const tenantId: string = "tenant_acme_corp_01";
3const id: string = "comment_20260325_4592";
4const updatableCommentParams: UpdatableCommentParams = {
5 body: "Updated the response to include a link to the RFC and fixed a typo in the second paragraph.",
6 editedByUserId: "user_8721",
7 isVisible: true
8};
9const contextUserId: string = "user_8721";
10const doSpamCheck: boolean = true;
11const isLive: boolean = true;
12const result: FlagCommentPublic200Response = await updateComment(tenantId, id, updatableCommentParams, contextUserId, doSpamCheck, isLive);
13

对评论投票 Internal Link

参数

Name Type Required Description
tenantId string
commentId string
urlId string
broadcastId string
voteBodyParams VoteBodyParams
sessionId string
sso string

响应

返回: VoteComment200Response

示例

voteComment 示例
Copy Copy
1
2const tenantId: string = 'tenant_9f8b7c';
3const commentId: string = 'cmt_42f3a1';
4const urlId: string = 'articles/ai-trends-2026';
5const broadcastId: string = 'web';
6const voteBodyParams: VoteBodyParams = { vote: 1, reason: 'Insightful and on-topic' };
7const sessionId: string = 'sess_6d2b4c9e';
8const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
9const result: VoteComment200Response = await voteComment(tenantId, commentId, urlId, broadcastId, voteBodyParams, sessionId, sso);
10

添加域配置 Internal Link


参数

名称 类型 必需 说明
tenantId string
addDomainConfigParams AddDomainConfigParams

响应

返回: AddDomainConfig200Response


删除域配置 Internal Link

参数

名称 类型 必填 描述
tenantId string
domain string

响应

返回: DeleteDomainConfig200Response


获取域配置 Internal Link

参数

名称 类型 必填 描述
tenantId string
domain string

响应

返回: GetDomainConfig200Response


获取域配置列表 Internal Link


参数

名称 类型 必需 描述
tenantId string

响应

返回: GetDomainConfigs200Response


部分更新域配置 Internal Link

参数

名称 类型 必需 描述
tenantId string
domainToUpdate string
patchDomainConfigParams PatchDomainConfigParams

响应

返回: GetDomainConfig200Response


替换域配置 Internal Link


参数

名称 类型 必填 描述
tenantId string
domainToUpdate string
updateDomainConfigParams UpdateDomainConfigParams

响应

返回: GetDomainConfig200Response


创建邮件模板 Internal Link

参数

Name Type Required Description
tenantId string
createEmailTemplateBody CreateEmailTemplateBody

响应

返回: CreateEmailTemplate200Response

示例

createEmailTemplate 示例
Copy Copy
1
2const tenantId: string = "tenant_7a9f3c2b";
3const customConfig: CustomConfigParameters = { smtpHost: "smtp.fastmail.com", smtpPort: 587, useTLS: true };
4const createEmailTemplateBody: CreateEmailTemplateBody = {
5 name: "Account Notification",
6 subject: "Your ACME account was updated",
7 fromEmail: "no-reply@acme-corp.com",
8 replyTo: "support@acme-corp.com",
9 html: "<p>Hi {{user.firstName}}, your account settings were changed.</p>",
10 text: "Hi {{user.firstName}}, your account settings were changed.",
11 isActive: true,
12 description: "Used for transactional account update emails",
13 customConfig
14};
15const result: CreateEmailTemplate200Response = await createEmailTemplate(tenantId, createEmailTemplateBody);
16

删除邮件模板 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string

响应

返回: FlagCommentPublic200Response

示例

deleteEmailTemplate 示例
Copy Copy
1
2const tenantId: string = 'tenant_7f4c9d1e';
3const templateId: string = 'tmpl_welcome_2024-03';
4const notifyAdmin: boolean | undefined = true; // 可选参数示例
5
6const result: FlagCommentPublic200Response = await deleteEmailTemplate(tenantId, templateId);
7

删除邮件模板渲染错误 Internal Link

参数

Name Type Required Description
tenantId string
id string
errorId string

响应

返回: FlagCommentPublic200Response

示例

deleteEmailTemplateRenderError 示例
Copy Copy
1
2const tenantId: string = 'tenant_7f3b4c2a';
3const templateEnvironment: string | undefined = 'production'; // 可选的环境选择器
4const id: string = `emailTemplates/${templateEnvironment ?? 'staging'}/welcome_v2`;
5const errorId: string = 'err_5a9d2f1c';
6const result: FlagCommentPublic200Response = await deleteEmailTemplateRenderError(tenantId, id, errorId);
7console.log(result);
8

获取邮件模板 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string

响应

返回:GetEmailTemplate200Response

示例

getEmailTemplate 示例
Copy Copy
1
2const tenantId: string = "acme-marketing-042";
3const templateId: string = "tpl_welcome_2026";
4const result: GetEmailTemplate200Response = await getEmailTemplate(tenantId, templateId);
5const template: CustomEmailTemplate | undefined = result.template;
6const subject: string | undefined = template?.subject;
7const customParams: CustomConfigParameters | undefined = template?.customConfigParameters;
8

获取邮件模板定义 Internal Link

参数

名称 类型 必填 描述
tenantId string

响应

返回: GetEmailTemplateDefinitions200Response

示例

getEmailTemplateDefinitions 示例
Copy Copy
1
2const tenantId: string = 'tenant_acme_eu_01';
3const templates: GetEmailTemplateDefinitions200Response = await getEmailTemplateDefinitions(tenantId);
4console.log('Email template definitions loaded for', tenantId, templates);
5

获取邮件模板渲染错误 Internal Link

参数

Name Type Required Description
tenantId string
id string
skip number

响应

返回:GetEmailTemplateRenderErrors200Response

示例

getEmailTemplateRenderErrors 示例
Copy Copy
1
2(async () => {
3 const tenantId: string = 'acme-tenant-42';
4 const id: string = 'tmpl_3fa85f64-5717-4562-b3fc-2c963f66afa6';
5 const skip: number = 20;
6 const result: GetEmailTemplateRenderErrors200Response = await getEmailTemplateRenderErrors(tenantId, id, skip);
7 console.log(result);
8})();
9

获取邮件模板列表 Internal Link

参数

名称 类型 必填 描述
tenantId string
skip number

响应

返回: GetEmailTemplates200Response

示例

getEmailTemplates 示例
Copy Copy
1
2async function main(): Promise<void> {
3 const tenantId: string = 'tenant_5f3a9c2b';
4 const templates: GetEmailTemplates200Response = await getEmailTemplates(tenantId);
5 const skip: number = 20;
6 const pagedTemplates: GetEmailTemplates200Response = await getEmailTemplates(tenantId, skip);
7 console.log(templates, pagedTemplates);
8}
9main();
10

渲染邮件模板 Internal Link

参数

名称 类型 必填 描述
tenantId string
renderEmailTemplateBody RenderEmailTemplateBody
locale string

响应

返回:RenderEmailTemplate200Response

示例

renderEmailTemplate 示例
Copy Copy
1
2const tenantId: string = 'tenant_b6f3c2';
3const renderEmailTemplateBody: RenderEmailTemplateBody = {
4 templateId: 'comment-notification',
5 recipient: { name: 'Ava Thompson', email: 'ava.thompson@publisher.com' },
6 context: {
7 siteName: 'City Gazette',
8 commentText: 'Thanks for the in-depth coverage — very helpful.',
9 articleTitle: 'Downtown Redevelopment Plan Advances',
10 threadUrl: 'https://citygazette.example/articles/2026/redevelopment#comments'
11 }
12};
13const locale: string = 'en-US';
14const result: RenderEmailTemplate200Response = await renderEmailTemplate(tenantId, renderEmailTemplateBody, locale);
15

更新邮件模板 Internal Link


参数

名称 类型 必填 描述
tenantId string
id string
updateEmailTemplateBody UpdateEmailTemplateBody

响应

返回: FlagCommentPublic200Response

示例

updateEmailTemplate 示例
Copy Copy
1
2const tenantId: string = "tenant_76a4b2";
3const id: string = "template_9f3c1e";
4const updateEmailTemplateBody: UpdateEmailTemplateBody = {
5 name: "Comment Flag Notification",
6 subject: "A comment was flagged on your-site.com",
7 bodyHtml: "<p>Admin,</p><p>User {{commenterName}} flagged a comment: “{{commentText}}”</p>",
8 isEnabled: true,
9 description: "Email sent to moderators when a comment is flagged (optional field included)"
10};
11const result: FlagCommentPublic200Response = await updateEmailTemplate(tenantId, id, updateEmailTemplateBody);
12

获取事件日志 Internal Link

req tenantId urlId userIdWS

参数

名称 类型 必需 描述
tenantId string
urlId string
userIdWS string
startTime number
endTime number

响应

返回:GetEventLog200Response

示例

getEventLog 示例
Copy Copy
1
2const tenantId: string = 'fastcomments-tenant-01';
3const urlId: string = 'article-2026-03-25';
4const userIdWS: string | undefined = undefined; // 可选的上游值
5const startTime: number = Date.parse('2026-03-01T00:00:00Z');
6const endTime: number = Date.parse('2026-03-25T23:59:59Z');
7
8const eventLogResponse: GetEventLog200Response = await getEventLog(
9 tenantId,
10 urlId,
11 userIdWS ?? 'ws_user_8b1f',
12 startTime,
13 endTime
14);
15

获取全局事件日志 Internal Link

req tenantId urlId userIdWS

参数

Name Type Required Description
tenantId string
urlId string
userIdWS string
startTime number
endTime number

响应

返回: GetEventLog200Response

示例

getGlobalEventLog 示例
Copy Copy
1
2const tenantId: string = "tenant-84b2f1";
3const urlId: string = "article-6721";
4const userIdWS: string = "ws-conn-9a3c";
5const startTime: number = Date.now() - 7 * 24 * 60 * 60 * 1000; // 7 天前
6const endTimeOptional: number | undefined = undefined; // 可选的时间范围结束
7const endTime: number = endTimeOptional ?? Date.now();
8const eventLog: GetEventLog200Response = await getGlobalEventLog(tenantId, urlId, userIdWS, startTime, endTime);
9

创建动态帖子 Internal Link

参数

Name Type Required Description
tenantId string
createFeedPostParams CreateFeedPostParams
broadcastId string
isLive boolean
doSpamCheck boolean
skipDupCheck boolean

响应

返回: CreateFeedPost200Response

示例

createFeedPost 示例
Copy Copy
1
2const tenantId: string = "tenant_7f3b9a";
3const createFeedPostParams: CreateFeedPostParams = {
4 title: "Weekly Product Update — March 2026",
5 body: "We've shipped performance improvements and bug fixes across the web client. See the release notes for details.",
6 authorId: "user_86fa2b",
7 allowComments: true,
8 media: [
9 {
10 url: "https://cdn.example.com/images/update-march.png",
11 mimeType: "image/png",
12 caption: "Performance graph",
13 assets: [{ url: "https://cdn.example.com/images/update-march@2x.png", width: 1600, height: 900 }]
14 }
15 ],
16 links: [{ url: "https://www.example.com/release-notes/march-2026", title: "Release notes" }]
17};
18const broadcastId: string = "broadcast_prod_updates_202603";
19const isLive: boolean = false;
20const doSpamCheck: boolean = true;
21const skipDupCheck: boolean = false;
22const result: CreateFeedPost200Response = await createFeedPost(tenantId, createFeedPostParams, broadcastId, isLive, doSpamCheck, skipDupCheck);
23

创建公开动态帖子 Internal Link


参数

名称 类型 是否必需 描述
tenantId string
createFeedPostParams CreateFeedPostParams
broadcastId string
sso string

响应

返回: CreateFeedPostPublic200Response

示例

createFeedPostPublic 示例
Copy Copy
1
2const tenantId: string = "tenant_987654321";
3const asset: FeedPostMediaItemAsset = { url: "https://cdn.fastcomments.com/uploads/team-photo.jpg", mimeType: "image/jpeg", sizeBytes: 324512 };
4const mediaItem: FeedPostMediaItem = { type: "image", assets: [asset], caption: "Team launch day" };
5const link: FeedPostLink = { url: "https://www.example.com/blog/product-update-march-2026", title: "Product update — March 2026" };
6const createFeedPostParams: CreateFeedPostParams = {
7 title: "Product update — March 2026",
8 content: "<p>We shipped performance improvements and two new integrations.</p>",
9 media: [mediaItem],
10 link,
11 visibility: "public",
12 tags: ["product","release","march-2026"],
13 customConfig: { allowComments: true, requireTOS: false }
14};
15const broadcastId: string = "broadcast_2026_03_25_live";
16const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjM0NSIsImlhdCI6MTY5MDI0MDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
17const result: CreateFeedPostPublic200Response = await createFeedPostPublic(tenantId, createFeedPostParams, broadcastId, sso);
18

删除公开动态帖子 Internal Link

参数

名称 类型 必填 描述
tenantId string
postId string
broadcastId string
sso string

响应

返回: DeleteFeedPostPublic200Response

示例

deleteFeedPostPublic 示例
Copy Copy
1
2const tenantId: string = "tenant_5f8a9b3c";
3const postId: string = "post_a1b2c3d4";
4const broadcastId: string = "broadcast_2026-03-25T10:00:00Z";
5const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIiwiaWF0IjoxNjE5MjM5MjAwfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
6
7const resultWithOptional: DeleteFeedPostPublic200Response = await deleteFeedPostPublic(tenantId, postId, broadcastId, sso);
8const resultRequiredOnly: DeleteFeedPostPublic200Response = await deleteFeedPostPublic(tenantId, postId);
9

获取动态帖子 Internal Link

req tenantId afterId

参数

名称 类型 必需 描述
tenantId string
afterId string
limit number
tags Array

响应

返回: GetFeedPosts200Response

示例

getFeedPosts 示例
Copy Copy
1
2const initialPage: GetFeedPosts200Response = await getFeedPosts('tenant_9f1b3d', undefined, 20, ['sports', 'local']);
3const nextPage: GetFeedPosts200Response = await getFeedPosts('tenant_9f1b3d', 'post_abc123', 20, ['sports', 'local']);
4

获取公开动态帖子 Internal Link

请求 tenantId afterId

参数

Name Type Required Description
tenantId string
afterId string
limit number
tags Array
sso string
isCrawler boolean
includeUserInfo boolean

响应

返回: GetFeedPostsPublic200Response

示例

getFeedPostsPublic 示例
Copy Copy
1
2const tenantId: string = 'tenant_acme_01';
3const afterId: string = 'fp_20260301_042';
4const limit: number = 25;
5const tags: Array<string> = ['technology', 'announcement'];
6const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiamRvZSJ9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
7const isCrawler: boolean = false;
8const includeUserInfo: boolean = true;
9const response: GetFeedPostsPublic200Response = await getFeedPostsPublic(tenantId, afterId, limit, tags, sso, isCrawler, includeUserInfo);
10

获取动态帖子统计 Internal Link

参数

名称 类型 必需 描述
tenantId string
postIds Array
sso string

响应

返回:GetFeedPostsStats200Response

示例

getFeedPostsStats 示例
Copy Copy
1
2const tenantId: string = 'tenant_9b2f1c4a';
3const postIds: Array<string> = [
4 '8f14e45f-ea82-4c7a-b6b2-1a2b3c4d5e6f',
5 'd0e1f2a3-b4c5-6d7e-8f90-1234567890ab'
6];
7const sso: string = 'sso_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.signature';
8const statsWithoutSSO: GetFeedPostsStats200Response = await getFeedPostsStats(tenantId, postIds);
9const statsWithSSO: GetFeedPostsStats200Response = await getFeedPostsStats(tenantId, postIds, sso);
10

获取用户公开反应 Internal Link

参数

Name Type Required Description
tenantId string
postIds Array
sso string

响应

返回: GetUserReactsPublic200Response

示例

getUserReactsPublic 示例
Copy Copy
1
2const tenantId: string = "acme-tenant-8a4d2c";
3const postIds: string[] = ["post-645a2f", "post-645a30"];
4const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyXzEyMyIsImlhdCI6MTY2MTYwMDAwMH0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
5const result: GetUserReactsPublic200Response = await getUserReactsPublic(tenantId, postIds, sso);
6

对公开动态帖子做出反应 Internal Link


参数

名称 类型 必需 描述
tenantId string
postId string
reactBodyParams ReactBodyParams
isUndo boolean
broadcastId string
sso string

响应

返回: ReactFeedPostPublic200Response

示例

reactFeedPostPublic 示例
Copy Copy
1
2const tenantId: string = 'd290f1ee-6c54-4b01-90e6-d701748f0851';
3const postId: string = 'c1a2b3d4-5678-90ab-cdef-1234567890ab';
4const reactBodyParams: ReactBodyParams = { reaction: 'like', emoji: '👍', source: 'web' };
5const isUndo: boolean = false;
6const broadcastId: string = 'broadcast-2026-03-25-001';
7const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIn0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
8const result: ReactFeedPostPublic200Response = await reactFeedPostPublic(tenantId, postId, reactBodyParams, isUndo, broadcastId, sso);
9

更新动态帖子 Internal Link

参数

名称 类型 必填 描述
tenantId string
id string
feedPost FeedPost

响应

返回:FlagCommentPublic200Response

示例

updateFeedPost 示例
Copy Copy
1
2const tenantId: string = 'acme-global-tenant-42';
3const id: string = 'f47ac10b-58cc-4372-a567-0e02b2c3d479';
4
5const asset: FeedPostMediaItemAsset = {
6 url: 'https://cdn.acme.com/images/product-launch.jpg',
7 mimeType: 'image/jpeg',
8 width: 1200,
9 height: 630
10};
11
12const mediaItem: FeedPostMediaItem = {
13 id: 'media-001',
14 type: 'image',
15 asset
16};
17
18const link: FeedPostLink = {
19 url: 'https://acme.com/blog/product-launch',
20 title: 'Product Launch Details'
21};
22
23const feedPost: FeedPost = {
24 title: 'Introducing the Q3 Product Suite',
25 body: 'We are excited to unveil our new lineup for Q3, focusing on performance and security improvements.',
26 media: [mediaItem], // 包含可选数组
27 links: [link], // 包含可选链接
28 isPublished: true // 这里使用了可选的发布标志
29};
30
31const result: FlagCommentPublic200Response = await updateFeedPost(tenantId, id, feedPost);
32

更新公开动态帖子 Internal Link

参数

名称 类型 必需 描述
tenantId string
postId string
updateFeedPostParams UpdateFeedPostParams
broadcastId string
sso string

响应

返回: CreateFeedPostPublic200Response

示例

updateFeedPostPublic 示例
Copy Copy
1
2const tenantId: string = "tenant_9f4b2";
3const postId: string = "post_21a8e";
4const updateFeedPostParams: UpdateFeedPostParams = {
5 title: "Quarterly product update",
6 body: "Major performance improvements and bug fixes deployed today. See release notes and schedule.",
7 links: [{ url: "https://status.example.com/release-notes", title: "Release notes" }],
8 media: [
9 {
10 type: "image",
11 assets: [{ url: "https://cdn.example.com/updates/q2.png", mimeType: "image/png", width: 1200, height: 628 }]
12 }
13 ]
14};
15const broadcastId: string = "broadcast_live_202603";
16const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature";
17const result: CreateFeedPostPublic200Response = await updateFeedPostPublic(tenantId, postId, updateFeedPostParams, broadcastId, sso);
18

公开标记评论 Internal Link

参数

名称 类型 必填 描述
tenantId string
commentId string
isFlagged boolean
sso string

响应

返回: FlagCommentPublic200Response

示例

flagCommentPublic 示例
Copy Copy
1
2const tenantId: string = "tenant_9f8b3c";
3const commentId: string = "comment_72a1d4";
4const isFlagged: boolean = true;
5const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1Njc4OSJ9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
6const result: FlagCommentPublic200Response = await flagCommentPublic(tenantId, commentId, isFlagged, sso);
7

添加话题标签 Internal Link

参数

名称 类型 必填 描述
tenantId string
createHashTagBody CreateHashTagBody

响应

返回: AddHashTag200Response

示例

addHashTag 示例
Copy Copy
1
2const tenantId: string = 'tenant_acme_01';
3const createHashTagBody: CreateHashTagBody = {
4 name: 'feature-request',
5 label: 'Feature Request',
6 color: '#FF5722',
7 enabled: true
8};
9const response: AddHashTag200Response = await addHashTag(tenantId, createHashTagBody);
10const responseWithoutTenant: AddHashTag200Response = await addHashTag(undefined, createHashTagBody);
11

批量添加话题标签 Internal Link

参数

Name Type Required Description
tenantId string
bulkCreateHashTagsBody BulkCreateHashTagsBody

响应

返回:AddHashTagsBulk200Response

示例

addHashTagsBulk 示例
Copy Copy
1
2// 创建租户标识符(可选参数)
3const tenantId: string = "tenant_9f8c2b7a";
4
5// 准备单个标签条目
6const tag1: BulkCreateHashTagsBodyTagsInner = {
7 name: "product-feedback",
8 label: "Product Feedback",
9 color: "#1f8a70",
10 description: "User suggestions and enhancement requests",
11 isActive: true
12};
13
14const tag2: BulkCreateHashTagsBodyTagsInner = {
15 name: "bug-report",
16 label: "Bug Report",
17 color: "#d64545",
18 description: "User-reported defects and issues",
19 isActive: true
20};
21
22// 批量创建主体(可选参数)
23const bulkCreateHashTagsBody: BulkCreateHashTagsBody = {
24 tags: [tag1, tag2]
25};
26
27// 调用全局异步函数并将结果赋予类型化变量
28const result: AddHashTagsBulk200Response = await addHashTagsBulk(tenantId, bulkCreateHashTagsBody);
29

删除话题标签 Internal Link

参数

名称 类型 必需 描述
tag string
tenantId string
deleteHashTagRequest DeleteHashTagRequest

响应

返回: FlagCommentPublic200Response

示例

deleteHashTag 示例
Copy Copy
1
2const tag: string = "breaking-news";
3const tenantId: string = "tenant_12345";
4const deleteRequest: DeleteHashTagRequest = { initiatedBy: "moderator@newsorg.com", purgeAllOccurrences: true };
5const result: FlagCommentPublic200Response = await deleteHashTag(tag, tenantId, deleteRequest);
6

获取话题标签 Internal Link

参数

名称 类型 必需 描述
tenantId string
page number

响应

返回: GetHashTags200Response

示例

getHashTags 示例
Copy Copy
1
2const tenantId: string = 'acme-tenant-42';
3const pageNumber: number = 2;
4const responseWithPage: GetHashTags200Response = await getHashTags(tenantId, pageNumber);
5const responseWithoutPage: GetHashTags200Response = await getHashTags(tenantId);
6

部分更新话题标签 Internal Link

参数

名称 类型 必需 描述
tag string
tenantId string
updateHashTagBody UpdateHashTagBody

响应

返回:PatchHashTag200Response

示例

patchHashTag 示例
Copy Copy
1
2const tag: string = "feature-ux-refresh";
3const tenantId: string = "tenant_4f92c1";
4const updateHashTagBody: UpdateHashTagBody = {
5 label: "UX Refresh",
6 description: "Track comments related to the 2026 UX redesign",
7 isActive: true,
8 metadata: { owner: "product-design", rolloutPhase: "phase-2" }
9};
10const response: PatchHashTag200Response = await patchHashTag(tag, tenantId, updateHashTagBody);
11

创建版主 Internal Link

参数

Name Type Required Description
tenantId string
createModeratorBody CreateModeratorBody

响应

返回: CreateModerator200Response

示例

createModerator 示例
Copy Copy
1
2const tenantId: string = 'tenant_7d9f2b4a';
3const customConfig: CustomConfigParameters = { timezone: 'UTC', moderationQueueEnabled: true };
4const createModeratorBody: CreateModeratorBody = {
5 email: 'jane.martin@publisher.com',
6 displayName: 'Jane Martin',
7 roles: ['moderator'],
8 sendWelcomeEmail: true,
9 customConfig
10};
11const response: CreateModerator200Response = await createModerator(tenantId, createModeratorBody);
12

删除版主 Internal Link

参数

名称 类型 必填 描述
tenantId string
id string
sendEmail string

响应

返回:FlagCommentPublic200Response

示例

deleteModerator 示例
Copy Copy
1
2const tenantId: string = 'tenant_9f3b2d4a6c';
3const moderatorId: string = 'moderator_84a1b9c2';
4const sendEmail: string = 'true';
5const result: FlagCommentPublic200Response = await deleteModerator(tenantId, moderatorId, sendEmail);
6

获取版主 Internal Link

参数

名称 类型 必填 描述
tenantId string
id string

响应

返回:GetModerator200Response

示例

getModerator 示例
Copy Copy
1
2const tenantId: string = 'acme-corp-tenant-123';
3const id: string = 'mod-987654321';
4const moderatorResponse: GetModerator200Response = await getModerator(tenantId, id);
5

获取版主列表 Internal Link

参数

名称 类型 必填 描述
tenantId string
skip number

响应

返回: GetModerators200Response

示例

getModerators 示例
Copy Copy
1
2const tenantId: string = 'tenant-12345-prod';
3const moderatorsPage1: GetModerators200Response = await getModerators(tenantId);
4const moderatorsPage2: GetModerators200Response = await getModerators(tenantId, 50);
5

发送邀请 Internal Link

参数

名称 类型 必填 描述
tenantId string
id string
fromName string

响应

返回: FlagCommentPublic200Response

示例

sendInvite 示例
Copy Copy
1
2const tenantId: string = 'tenant_acme-42';
3const id: string = 'comment_8f3b21a7';
4const fromName: string = 'Elena Morales';
5const replyToEmail: string | undefined = undefined;
6
7const result: FlagCommentPublic200Response = await sendInvite(tenantId, id, fromName, replyToEmail);
8

更新版主 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string
updateModeratorBody UpdateModeratorBody

响应

返回: FlagCommentPublic200Response

示例

updateModerator 示例
Copy Copy
1
2const tenantId: string = "acme-enterprises-42";
3const id: string = "moderator_517";
4const updateModeratorBody: UpdateModeratorBody = {
5 displayName: "Sofia Martinez",
6 email: "sofia.martinez@acme.com",
7 permissions: ["approve_comments", "flag_spam", "suspend_users"],
8 active: true,
9 avatarUrl: "https://cdn.acme.com/avatars/sofia.jpg" // 可选字段示例
10};
11const result: FlagCommentPublic200Response = await updateModerator(tenantId, id, updateModeratorBody);
12

删除通知计数 Internal Link

参数

名称 类型 必填 描述
tenantId string
id string

响应

返回:FlagCommentPublic200Response

示例

deleteNotificationCount 示例
Copy Copy
1
2const tenantSuffix: string | undefined = undefined;
3const tenantId: string = tenantSuffix ? `tenant-${tenantSuffix}` : 'tenant-9142a7';
4const id: string = '3f9b2a44-1c2e-4d3b-9f6a-8e7c6d5b2a1f';
5const result: FlagCommentPublic200Response = await deleteNotificationCount(tenantId, id);
6console.log(result);
7

获取缓存的通知计数 Internal Link

参数

名称 类型 必填 描述
tenantId string
id string

响应

返回: GetCachedNotificationCount200Response

示例

getCachedNotificationCount 示例
Copy Copy
1
2const tenantId: string = 'tenant_acme_42';
3const id: string = 'user_00012345';
4const includeUnreadOnly: boolean | undefined = true; // 可选参数标志(示例)
5const result: GetCachedNotificationCount200Response = await getCachedNotificationCount(tenantId, id);
6

获取通知计数 Internal Link

参数

名称 类型 必需 描述
tenantId string Yes
userId string No
urlId string No
fromCommentId string No
viewed boolean No
type string No

响应

返回: GetNotificationCount200Response

示例

getNotificationCount 示例
Copy Copy
1
2const tenantId: string = 'tenant_abc123';
3const userId: string = 'user_987654321';
4const urlId: string = 'https://example.com/news/2026/new-features';
5const viewed: boolean = false;
6const type: string = 'reply';
7const notificationCountResponse: GetNotificationCount200Response = await getNotificationCount(tenantId, userId, urlId, undefined, viewed, type);
8

获取通知 Internal Link

参数

Name Type Required Description
tenantId string
userId string
urlId string
fromCommentId string
viewed boolean
type string
skip number

响应

返回: GetNotifications200Response

示例

getNotifications 示例
Copy Copy
1
2const tenantId: string = "tenant_84b3f2";
3const userId: string = "user_1279";
4const urlId: string = "https://www.example.com/articles/2026/03/25/new-feature";
5const fromCommentId: string = "cmt_5421";
6const viewed: boolean = false;
7const type: string = "mention";
8const skip: number = 0;
9const notifications: GetNotifications200Response = await getNotifications(tenantId, userId, urlId, fromCommentId, viewed, type, skip);
10

更新通知 Internal Link


参数

Name Type Required Description
tenantId string
id string
updateNotificationBody UpdateNotificationBody
userId string

响应

返回: FlagCommentPublic200Response

示例

updateNotification 示例
Copy Copy
1
2const tenantId: string = 'tenant_prod_8f4b2c';
3const id: string = 'notification_61a2e9';
4const userId: string = 'moderator_107';
5const updateNotificationBody: UpdateNotificationBody = {
6 name: 'Flagged Comment Notification',
7 enabled: true,
8 channels: ['email', 'inbox'],
9 templateId: 'tmpl_mod_alerts_01',
10 severity: 'high'
11};
12const result: FlagCommentPublic200Response = await updateNotification(tenantId, id, updateNotificationBody, userId);
13

添加页面 Internal Link


参数

名称 类型 必填 描述
tenantId string
createAPIPageData CreateAPIPageData

响应

返回: AddPageAPIResponse


删除页面 Internal Link


参数

名称 类型 必需 描述
tenantId string
id string

响应

返回: DeletePageAPIResponse


通过 URL ID 获取页面 Internal Link

参数

名称 类型 必需 描述
tenantId string
urlId string

响应

返回:GetPageByURLIdAPIResponse


获取页面列表 Internal Link

参数

名称 类型 必填 描述
tenantId string

响应

返回: GetPagesAPIResponse


部分更新页面 Internal Link


参数

名称 类型 必需 描述
tenantId string
id string
updateAPIPageData UpdateAPIPageData

响应

返回: PatchPageAPIResponse


删除待处理的 Webhook 事件 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string

响应

返回: FlagCommentPublic200Response

示例

deletePendingWebhookEvent 示例
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_42f7c9b1';
4 const id: string = 'pending_webhook_ev_8f3b9a2d';
5 const reason?: string = undefined; // 可选参数示例(函数不需要)
6 const result: FlagCommentPublic200Response = await deletePendingWebhookEvent(tenantId, id);
7 console.log(result);
8})();
9

获取待处理 Webhook 事件计数 Internal Link

参数

Name Type Required Description
tenantId string
commentId string
externalId string
eventType string
type string
domain string
attemptCountGT number

响应

返回: GetPendingWebhookEventCount200Response

示例

getPendingWebhookEventCount 示例
Copy Copy
1
2const tenantId: string = "tenant_8d3b7a2f";
3const commentId: string | undefined = "comment_79a2b";
4const eventType: string | undefined = "comment.created";
5const domain: string | undefined = "forum.acme-corp.com";
6const attemptCountGT: number | undefined = 1;
7const result: GetPendingWebhookEventCount200Response = await getPendingWebhookEventCount(
8 tenantId,
9 commentId,
10 undefined,
11 eventType,
12 undefined,
13 domain,
14 attemptCountGT
15);
16

获取待处理的 Webhook 事件 Internal Link

参数

名称 类型 必需 描述
tenantId string
commentId string
externalId string
eventType string
type string
domain string
attemptCountGT number
skip number

响应

返回: GetPendingWebhookEvents200Response

示例

getPendingWebhookEvents 示例
Copy Copy
1
2const tenantId: string = 'tenant_9b3f7c';
3const commentId: string | undefined = undefined;
4const externalId: string | undefined = 'external-572a';
5const eventType: string | undefined = 'comment.updated';
6const type: string | undefined = 'outbound';
7const domain: string | undefined = 'reviews.example.com';
8const attemptCountGT: number | undefined = 1;
9const skip: number | undefined = 20;
10
11const result: GetPendingWebhookEvents200Response = await getPendingWebhookEvents(
12 tenantId,
13 commentId,
14 externalId,
15 eventType,
16 type,
17 domain,
18 attemptCountGT,
19 skip
20);
21

创建问题配置 Internal Link

参数

名称 类型 必需 描述
tenantId string
createQuestionConfigBody CreateQuestionConfigBody

响应

返回: CreateQuestionConfig200Response

示例

createQuestionConfig 示例
Copy Copy
1
2const tenantId: string = "tenant_9f8b2c";
3const option: QuestionConfigCustomOptionsInner = { id: "opt_yes", label: "Yes, helpful", value: "yes" };
4const createQuestionConfigBody: CreateQuestionConfigBody = {
5 title: "Article usefulness",
6 prompt: "Was this article helpful?",
7 type: "singleChoice",
8 required: false, // 演示可选参数
9 options: [option],
10 saveBehavior: "immediate"
11};
12const result: CreateQuestionConfig200Response = await createQuestionConfig(tenantId, createQuestionConfigBody);
13

删除问题配置 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string

响应

返回: FlagCommentPublic200Response

示例

deleteQuestionConfig 示例
Copy Copy
1
2const tenantId: string = "acme-enterprises-01";
3const idOptional: string | undefined = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
4const id: string = idOptional ?? "11111111-1111-1111-1111-111111111111";
5const response: FlagCommentPublic200Response = await deleteQuestionConfig(tenantId, id);
6

获取问题配置 Internal Link

参数

Name Type Required Description
tenantId string
id string

响应

返回: GetQuestionConfig200Response

示例

getQuestionConfig 示例
Copy Copy
1
2const tenantId: string = 'acme-tenant-92';
3const id: string = 'question-2026-07-42';
4const response: GetQuestionConfig200Response = await getQuestionConfig(tenantId, id);
5
6function summarize(cfg: GetQuestionConfig200Response, includeDetails?: boolean): string {
7 return includeDetails ? 'Question config (detailed)' : 'Question config (summary)';
8}
9
10const summary: string = summarize(response);
11

获取问题配置列表 Internal Link

参数

名称 类型 是否必需 描述
tenantId string
skip number

响应

返回: GetQuestionConfigs200Response

示例

getQuestionConfigs 示例
Copy Copy
1
2const tenantId: string = "tenant_acme_9876";
3const configsWithoutSkip: GetQuestionConfigs200Response = await getQuestionConfigs(tenantId);
4const configsWithSkip: GetQuestionConfigs200Response = await getQuestionConfigs(tenantId, 20);
5

更新问题配置 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string
updateQuestionConfigBody UpdateQuestionConfigBody

响应

返回: FlagCommentPublic200Response

示例

updateQuestionConfig 示例
Copy Copy
1
2const tenantId: string = 'tenant_42e8b';
3const id: string = 'question_9f4a2';
4const updateQuestionConfigBody: UpdateQuestionConfigBody = {
5 questionText: 'How helpful was this article?',
6 description: 'Shown to users below the question (optional)',
7 required: true,
8 renderingType: 'Likert' as QuestionRenderingType,
9 customOptions: [
10 { label: 'Very helpful', value: '5' } as QuestionConfigCustomOptionsInner,
11 { label: 'Somewhat helpful', value: '3' } as QuestionConfigCustomOptionsInner,
12 { label: 'Not helpful', value: '1' } as QuestionConfigCustomOptionsInner
13 ],
14 whenSave: 'notify' as QuestionWhenSave
15};
16const result: FlagCommentPublic200Response = await updateQuestionConfig(tenantId, id, updateQuestionConfigBody);
17

创建问题结果 Internal Link

参数

名称 类型 必需 描述
tenantId string
createQuestionResultBody CreateQuestionResultBody

响应

返回: CreateQuestionResult200Response

示例

createQuestionResult 示例
Copy Copy
1
2const tenantId: string = "tenant-72b1f4";
3const meta: MetaItem[] = [{ key: "platform", value: "web" }];
4const createQuestionResultBody: CreateQuestionResultBody = {
5 questionId: "question-83472",
6 commenterId: "user-5521",
7 answers: [{ subQuestionId: "sq-1", value: "Yes" }],
8 meta, // 可选的元数据
9 note: "Follow-up requested" // 演示可选参数
10};
11const result: CreateQuestionResult200Response = await createQuestionResult(tenantId, createQuestionResultBody);
12

删除问题结果 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string

响应

返回: FlagCommentPublic200Response

示例

deleteQuestionResult 示例
Copy Copy
1
2const tenantId: string = "org-82479";
3const questionId: string = "q-6a3d2e1f";
4const includeArchived?: boolean = false; // 可选参数,演示备用目标选择
5const targetId: string = includeArchived ? "q-archived-112233" : questionId;
6const result: FlagCommentPublic200Response = await deleteQuestionResult(tenantId, targetId);
7

获取问题结果 Internal Link


参数

名称 类型 必填 描述
tenantId string
id string

响应

返回:GetQuestionResult200Response

示例

getQuestionResult 示例
Copy Copy
1
2const post: { title: string; questionId?: string } = { title: 'Product feedback' };
3const tenantId: string = 'acme-corp-tenant-01';
4const id: string = post.questionId ?? 'q-8f3a7b2c4d9e';
5const result: GetQuestionResult200Response = await getQuestionResult(tenantId, id);
6

获取问题结果列表 Internal Link

参数

名称 类型 必填 描述
tenantId string
urlId string
userId string
startDate string
questionId string
questionIds string
skip number

响应

返回:GetQuestionResults200Response

示例

getQuestionResults 示例
Copy Copy
1
2const tenantId: string = "tenant_acme_001";
3const urlId: string = "articles/product-launch-2026";
4const userId: string = "user_2048";
5const startDate: string = "2026-03-01T00:00:00Z";
6const questionId: string | undefined = undefined;
7const questionIds: string | undefined = "q_101,q_102";
8const skip: number | undefined = 0;
9
10const result: GetQuestionResults200Response = await getQuestionResults(tenantId, urlId, userId, startDate, questionId, questionIds, skip);
11

更新问题结果 Internal Link

参数

Name Type Required Description
tenantId string
id string
updateQuestionResultBody UpdateQuestionResultBody

响应

返回: FlagCommentPublic200Response

示例

updateQuestionResult 示例
Copy Copy
1
2const tenantId: string = 'tenant_7f8b3c';
3const id: string = 'questionResult_4621';
4const updateQuestionResultBody: UpdateQuestionResultBody = {
5 questionId: 'q_1024',
6 result: 'flagged',
7 score: 0.92,
8 notes: 'Automated moderation flagged for review',
9 meta: [{ key: 'source', value: 'ai-moderator' }] as MetaItem[], // 可选元数据
10 status: { code: 'review_pending' } as APIStatus
11} as UpdateQuestionResultBody;
12const result: FlagCommentPublic200Response = await updateQuestionResult(tenantId, id, updateQuestionResultBody);
13

聚合问题结果 Internal Link

参数

名称 类型 必需 描述
tenantId string
questionId string
questionIds Array
urlId string
timeBucket AggregateTimeBucket
startDate Date
forceRecalculate boolean

响应

返回: AggregateQuestionResults200Response

示例

aggregateQuestionResults 示例
Copy Copy
1
2const tenantId: string = 'tenant_acme_98765';
3const questionIds: Array<string> = ['q-102', 'q-103'];
4const urlId: string = 'url_55b3';
5const timeBucket: AggregateTimeBucket = { unit: 'day', size: 7 };
6const startDate: Date = new Date('2026-01-01T00:00:00Z');
7const forceRecalculate: boolean = true;
8
9const result: AggregateQuestionResults200Response = await aggregateQuestionResults(
10 tenantId,
11 undefined, // 省略 questionId,改用 questionIds
12 questionIds,
13 urlId,
14 timeBucket,
15 startDate,
16 forceRecalculate
17);
18

批量聚合问题结果 Internal Link

参数

名称 类型 必填 描述
tenantId string
bulkAggregateQuestionResultsRequest BulkAggregateQuestionResultsRequest
forceRecalculate boolean

响应

返回:BulkAggregateQuestionResults200Response

示例

bulkAggregateQuestionResults 示例
Copy Copy
1
2const tenantId: string = "tenant_live_7c9d";
3const bulkAggregateQuestionResultsRequest: BulkAggregateQuestionResultsRequest = {
4 items: [
5 { questionId: "q_feedback_rating", includeSubQuestions: false, filters: { locale: "en-US" } }
6 ],
7 timeBuckets: [
8 { granularity: "day", startUtc: "2026-03-01T00:00:00Z", endUtc: "2026-03-15T00:00:00Z" }
9 ]
10};
11const forceRecalculate: boolean = true;
12const result: BulkAggregateQuestionResults200Response = await bulkAggregateQuestionResults(tenantId, bulkAggregateQuestionResultsRequest, forceRecalculate);
13

将评论与问题结果合并 Internal Link

参数

名称 类型 必需 描述
tenantId string
questionId string
questionIds Array
urlId string
startDate Date
forceRecalculate boolean
minValue number
maxValue number
limit number

响应

返回: CombineCommentsWithQuestionResults200Response

示例

combineCommentsWithQuestionResults 示例
Copy Copy
1
2const tenantId: string = 'tenant_9f3a2';
3const questionIds: string[] = ['question-42', 'question-43'];
4const urlId: string = 'url_5d7b';
5const startDate: Date = new Date('2026-02-01T00:00:00Z');
6const forceRecalculate: boolean = true;
7const minValue: number = 1;
8const maxValue: number = 5;
9const limit: number = 50;
10const result: CombineCommentsWithQuestionResults200Response = await combineCommentsWithQuestionResults(
11 tenantId,
12 undefined,
13 questionIds,
14 urlId,
15 startDate,
16 forceRecalculate,
17 minValue,
18 maxValue,
19 limit
20);
21

添加 SSO 用户 Internal Link

参数

名称 类型 必需 描述
tenantId string
createAPISSOUserData CreateAPISSOUserData

响应

返回: AddSSOUserAPIResponse

删除 SSO 用户 Internal Link

参数

Name Type Required Description
tenantId string
id string
deleteComments boolean
commentDeleteMode string

响应

返回: DeleteSSOUserAPIResponse


通过邮箱获取 SSO 用户 Internal Link


参数

名称 类型 必需 描述
tenantId string
email string

响应

返回: GetSSOUserByEmailAPIResponse


通过 ID 获取 SSO 用户 Internal Link

参数

名称 类型 必填 描述
tenantId string
id string

响应

返回: GetSSOUserByIdAPIResponse


获取 SSO 用户列表 Internal Link

参数

名称 类型 必填 描述
tenantId string
skip number

响应

返回: GetSSOUsers200Response


部分更新 SSO 用户 Internal Link


参数

名称 类型 必填 描述
tenantId string
id string
updateAPISSOUserData UpdateAPISSOUserData
updateComments boolean

响应

返回:PatchSSOUserAPIResponse


替换 SSO 用户 Internal Link

参数

名称 类型 是否必需 描述
tenantId string
id string
updateAPISSOUserData UpdateAPISSOUserData
updateComments boolean

响应

返回: PutSSOUserAPIResponse

创建订阅 Internal Link

参数

Name Type Required Description
tenantId string
createAPIUserSubscriptionData CreateAPIUserSubscriptionData

响应

返回:CreateSubscriptionAPIResponse

示例

createSubscription 示例
Copy Copy
1
2const tenantId: string = "acme-corp-123";
3const createAPIUserSubscriptionData: CreateAPIUserSubscriptionData = {
4 userId: "u_987654",
5 planId: "pro_monthly",
6 startDate: new Date().toISOString(),
7 trialDays: 14, // 可选参数示例
8 metadata: { source: "marketing-email" } // 可选参数示例
9};
10const result: CreateSubscriptionAPIResponse = await createSubscription(tenantId, createAPIUserSubscriptionData);
11const subscription: APIUserSubscription = result.subscription;
12

删除订阅 Internal Link

参数

Name Type Required Description
tenantId string
id string
userId string

响应

返回: DeleteSubscriptionAPIResponse


获取订阅 Internal Link

参数

名称 类型 必需 描述
tenantId string
userId string

响应

返回: GetSubscriptionsAPIResponse

示例

getSubscriptions 示例
Copy Copy
1
2const tenantId: string = 'tenant_acme_corp_01';
3const userId: string = 'user_76a3b9f2';
4const subscriptionsForUser: GetSubscriptionsAPIResponse = await getSubscriptions(tenantId, userId);
5const subscriptionsForTenant: GetSubscriptionsAPIResponse = await getSubscriptions(tenantId);
6

更新订阅 Internal Link

参数

Name Type Required Description
tenantId string
id string
updateAPIUserSubscriptionData UpdateAPIUserSubscriptionData
userId string

响应

返回: UpdateSubscriptionAPIResponse

示例

updateSubscription 示例
Copy Copy
1
2const tenantId: string = 'tenant_9f3b2c';
3const subscriptionId: string = 'sub_7641a2b3';
4const updateData: UpdateAPIUserSubscriptionData = {
5 status: 'active',
6 planId: 'pro_annual',
7 autoRenew: true,
8 renewalDate: '2026-04-15T00:00:00Z',
9 metadata: { upgradedBy: 'billing-team' }
10};
11const userId: string = 'user_215';
12const result: UpdateSubscriptionAPIResponse = await updateSubscription(tenantId, subscriptionId, updateData, userId);
13

获取租户每日使用量 Internal Link

参数

名称 类型 必需 描述
tenantId string
yearNumber number
monthNumber number
dayNumber number
skip number

响应

返回: GetTenantDailyUsages200Response

示例

getTenantDailyUsages 示例
Copy Copy
1
2const tenantId: string = 'tenant_5f4a3b2c-1d6e-4f9a-b9d8-123456789abc';
3const yearNumber: number = 2026;
4const monthNumber: number = 3;
5const dayNumber: number = 24;
6const skip: number = 0;
7
8const result: GetTenantDailyUsages200Response = await getTenantDailyUsages(tenantId, yearNumber, monthNumber, dayNumber, skip);
9

创建租户套餐 Internal Link

参数

Name Type Required Description
tenantId string
createTenantPackageBody CreateTenantPackageBody

响应

返回: CreateTenantPackage200Response

示例

createTenantPackage 示例
Copy Copy
1
2const tenantId: string = 'tenant_acme_001';
3const createTenantPackageBody: CreateTenantPackageBody = {
4 packageName: 'Standard Moderation',
5 description: 'Suitable for small-to-medium sites: basic moderation, spam rules, and analytics',
6 maxCommentsPerMinute: 50,
7 allowAnonymousComments: false, // 提供的可选参数
8 // optional fields omitted: e.g., advanced moderation rules, custom CSS
9 customConfigParameters: {
10 enableProfanityFilter: true,
11 imageContentProfanityLevel: 'medium' // 示例值;使用 CustomConfigParameters 结构
12 }
13};
14const response: CreateTenantPackage200Response = await createTenantPackage(tenantId, createTenantPackageBody);
15console.log(response);
16

删除租户套餐 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string

响应

返回:FlagCommentPublic200Response

示例

deleteTenantPackage 示例
Copy Copy
1
2const tenantId: string = 'tenant_acme_corp_987';
3const packageId: string = 'pkg_pro_2026_01';
4type DeleteOptions = { force?: boolean; notify?: boolean };
5const options: DeleteOptions = { force: true }; // 可选参数示例
6const result: FlagCommentPublic200Response = await deleteTenantPackage(tenantId, packageId);
7

获取租户套餐 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string

响应

返回:GetTenantPackage200Response

示例

getTenantPackage 示例
Copy Copy
1
2const tenantId: string = 'tenant_7f3b2c8';
3const packageId: string = 'pkg_standard_2026';
4const requestOptions: { includeConfig?: boolean } = { includeConfig: true };
5const packageResponse: GetTenantPackage200Response = await getTenantPackage(tenantId, packageId);
6

获取租户套餐列表 Internal Link

参数

Name Type Required Description
tenantId string
skip number

响应

返回: GetTenantPackages200Response

示例

getTenantPackages 示例
Copy Copy
1
2const tenantId: string = "tenant_7f8e3b4c";
3const skip: number = 20;
4const packagesDefault: GetTenantPackages200Response = await getTenantPackages(tenantId);
5const packagesWithSkip: GetTenantPackages200Response = await getTenantPackages(tenantId, skip);
6

替换租户套餐 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string
replaceTenantPackageBody ReplaceTenantPackageBody

响应

返回: FlagCommentPublic200Response

示例

replaceTenantPackage 示例
Copy Copy
1
2const tenantId: string = "tenant-9f3c2a";
3const id: string = "pkg_4f8b21";
4const replaceTenantPackageBody: ReplaceTenantPackageBody = {
5 packageName: "Premium Moderation Pack",
6 enabled: true,
7 apiStatus: { mode: "active" } as APIStatus,
8 customConfigParameters: { maxFlagsBeforeReview: 5 } as CustomConfigParameters,
9 voteStyle: "thumbs" as VoteStyle,
10 tosConfig: { requireAcceptance: true } as TOSConfig
11};
12const result: FlagCommentPublic200Response = await replaceTenantPackage(tenantId, id, replaceTenantPackageBody);
13

更新租户套餐 Internal Link

参数

Name Type Required Description
tenantId string
id string
updateTenantPackageBody UpdateTenantPackageBody

响应

返回:FlagCommentPublic200Response

示例

updateTenantPackage 示例
Copy Copy
1
2const tenantId: string = "tenant_3b7f9d-prod";
3const id: string = "pkg_enterprise_2026";
4const updateTenantPackageBody: UpdateTenantPackageBody = {
5 name: "Enterprise Plus",
6 isActive: true,
7 // 有意省略可选字段 (例如, description, limits)
8} as UpdateTenantPackageBody;
9const result: FlagCommentPublic200Response = await updateTenantPackage(tenantId, id, updateTenantPackageBody);
10

创建租户用户 Internal Link

参数

名称 类型 必填 描述
tenantId string
createTenantUserBody CreateTenantUserBody

响应

返回: CreateTenantUser200Response

示例

createTenantUser 示例
Copy Copy
1
2const tenantId: string = 'tenant_6f4b2c';
3const createTenantUserBody: CreateTenantUserBody = {
4 email: 'sara.kim@example.com',
5 displayName: 'Sara Kim',
6 role: 'moderator',
7 notifyOnMentions: true
8};
9const result: CreateTenantUser200Response = await createTenantUser(tenantId, createTenantUserBody);
10

删除租户用户 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string
deleteComments string
commentDeleteMode string

响应

返回: FlagCommentPublic200Response

示例

deleteTenantUser 示例
Copy Copy
1
2const tenantId: string = '4f3a9b2e-1c6a-4f7b-9e2a-0b8d6f1c2a3e';
3const userId: string = '9d2f7b3a-5c4e-48a2-b1f0-6c7d8e9f0a12';
4const deleteComments: string = 'true';
5const commentDeleteMode: string = 'permanent';
6const result: FlagCommentPublic200Response = await deleteTenantUser(tenantId, userId, deleteComments, commentDeleteMode);
7

获取租户用户 Internal Link

参数

名称 类型 必填 描述
tenantId string
id string

响应

返回: GetTenantUser200Response

示例

getTenantUser 示例
Copy Copy
1
2const tenantId: string = 'tenant_fc5a9b2c';
3const userId: string = 'user_0a12b3';
4const result: GetTenantUser200Response = await getTenantUser(tenantId, userId);
5const user: User | undefined = (result as any).user; // 访问有效负载
6const userEmail: string | undefined = user?.email;
7console.log('Fetched user email:', userEmail);
8

获取租户用户列表 Internal Link

参数

名称 类型 必填 描述
tenantId string
skip number

响应

返回: GetTenantUsers200Response

示例

getTenantUsers 示例
Copy Copy
1
2const tenantId: string = 'tenant_prod_8a3f2c';
3const skip: number = 50;
4const usersWithSkip: GetTenantUsers200Response = await getTenantUsers(tenantId, skip);
5const usersNoSkip: GetTenantUsers200Response = await getTenantUsers(tenantId);
6

替换租户用户 Internal Link

参数

名称 类型 必需 说明
tenantId string
id string
replaceTenantUserBody ReplaceTenantUserBody
updateComments string

响应

返回: FlagCommentPublic200Response

示例

replaceTenantUser 示例
Copy Copy
1
2const tenantId: string = 'tenant_9d8f4b2c';
3const id: string = 'user_f47ac10b';
4const replaceTenantUserBody: ReplaceTenantUserBody = {
5 externalId: 'ext-5234',
6 email: 'jane.doe@acme.com',
7 displayName: 'Jane Doe',
8 roles: ['moderator'],
9 metadata: { department: 'product', region: 'us-east-1' }
10};
11const updateComments: string = 'propagate-display-name-to-comments';
12
13const result: FlagCommentPublic200Response = await replaceTenantUser(tenantId, id, replaceTenantUserBody, updateComments);
14

参数

Name Type Required Description
tenantId string
id string
redirectURL string

响应

返回: FlagCommentPublic200Response

示例

sendLoginLink 示例
Copy Copy
1
2const tenantId: string = "tenant_12a9f3b7";
3const id: string = "user_84b2c7d1";
4const redirectURL: string = "https://app.mycompany.com/welcome?ref=login_email";
5const resultWithoutRedirect: FlagCommentPublic200Response = await sendLoginLink(tenantId, id);
6const resultWithRedirect: FlagCommentPublic200Response = await sendLoginLink(tenantId, id, redirectURL);
7

更新租户用户 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string
updateTenantUserBody UpdateTenantUserBody
updateComments string

响应

返回:FlagCommentPublic200Response

示例

updateTenantUser 示例
Copy Copy
1
2const tenantId: string = "tenant_8f3b2a9d";
3const id: string = "user_52c9f1ab";
4const updateTenantUserBody: UpdateTenantUserBody = {
5 email: "jane.doe@example.com",
6 displayName: "Jane Doe",
7 roles: ["moderator"],
8 isActive: true,
9 metadata: { signupSource: "sso", locale: "en-US" }
10};
11const updateComments: string = "Promoted to moderator and updated display name";
12const result: FlagCommentPublic200Response = await updateTenantUser(tenantId, id, updateTenantUserBody, updateComments);
13

创建租户 Internal Link

参数

Name Type Required Description
tenantId string
createTenantBody CreateTenantBody

返回

返回: CreateTenant200Response

示例

createTenant 示例
Copy Copy
1
2const tenantId: string = "acme-corp-001";
3const createTenantBody: CreateTenantBody = {
4 name: "Acme Corporation",
5 domain: "comments.acme.com",
6 adminContact: { name: "Jane Doe", email: "jane.doe@acme.com" },
7 billingInfo: { planId: "pro-monthly", billingContactEmail: "billing@acme.com" },
8 importedSite: { siteId: "site-123", siteName: "Acme Blog" } // 可选的已导入站点
9};
10const result: CreateTenant200Response = await createTenant(tenantId, createTenantBody);
11

删除租户 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string
sure string

响应

返回:FlagCommentPublic200Response

示例

deleteTenant 示例
Copy Copy
1
2const tenantId: string = "tenant_7f3d2c";
3const id: string = "flag_8392b1a7";
4const sure: string = "confirmed";
5
6const responseWithoutSure: FlagCommentPublic200Response = await deleteTenant(tenantId, id);
7const responseWithSure: FlagCommentPublic200Response = await deleteTenant(tenantId, id, sure);
8

获取租户 Internal Link

参数

名称 类型 必填 描述
tenantId string
id string

响应

返回: GetTenant200Response

示例

getTenant 示例
Copy Copy
1
2const tenantId: string = "tenant_9f4b2c1a";
3const idOverride: string | undefined = undefined; // 可选覆盖(如果可用)
4const id: string = idOverride ?? "site_3e7a6b2f";
5const response: GetTenant200Response = await getTenant(tenantId, id);
6console.log(response);
7

获取租户列表 Internal Link

参数

名称 类型 必需 描述
tenantId string
meta string
skip number

响应

返回: GetTenants200Response

示例

getTenants 示例
Copy Copy
1
2const tenantId: string = 'tenant_8421e7';
3const meta: string = 'include=domains,billing,customConfig';
4const skip: number = 20;
5
6const tenantsBasic: GetTenants200Response = await getTenants(tenantId);
7const tenantsWithOptions: GetTenants200Response = await getTenants(tenantId, meta, skip);
8

更新租户 Internal Link

参数

Name Type Required Description
tenantId string
id string
updateTenantBody UpdateTenantBody

响应

返回: FlagCommentPublic200Response

示例

updateTenant 示例
Copy Copy
1
2const tenantId: string = "tenant_4821";
3const id: string = "flag_7b9e";
4const billingInfo: BillingInfo | undefined = undefined; // 可选,省略以保留当前计费信息
5const updateTenantBody: UpdateTenantBody = {
6 name: "Acme News Comments",
7 defaultDomain: "comments.acme.com",
8 ...(billingInfo ? { billingInfo } : {})
9};
10const result: FlagCommentPublic200Response = await updateTenant(tenantId, id, updateTenantBody);
11

更改工单状态 Internal Link

参数

Name Type Required Description
tenantId string
userId string
id string
changeTicketStateBody ChangeTicketStateBody

响应

返回: ChangeTicketState200Response

示例

changeTicketState 示例
Copy Copy
1
2const tenantId: string = 'tenant_82f9b3';
3const userId: string = 'user_9472';
4const id: string = 'ticket_550e8400-e29b-41d4-a716-446655440000';
5const changeTicketStateBody: ChangeTicketStateBody = {
6 state: 'resolved',
7 comment: 'Confirmed fix deployed to production; closing ticket.',
8 notifySubscribers: true
9};
10const result: ChangeTicketState200Response = await changeTicketState(tenantId, userId, id, changeTicketStateBody);
11

创建工单 Internal Link

参数

名称 类型 必需 描述
tenantId string
userId string
createTicketBody CreateTicketBody

响应

返回: CreateTicket200Response

示例

createTicket 示例
Copy Copy
1
2const tenantId: string = "acme-corp-001";
3const userId: string = "user_72b9f4";
4const createTicketBody: CreateTicketBody = {
5 subject: "Subscription renewal failed for card on file",
6 description: "Customer's card was declined by the payment processor during automatic renewal. Transaction ID: txn_9a8b7c. Please review gateway logs and retry.",
7 priority: "high", // 可选字段示例
8 contactEmail: "billing@acme-corp.com", // 可选联系信息
9 relatedUrl: "https://acme-corp.com/account/billing"
10};
11const ticketResponse: CreateTicket200Response = await createTicket(tenantId, userId, createTicketBody);
12

获取工单 Internal Link

参数

Name Type Required Description
tenantId string
id string
userId string

响应

返回:GetTicket200Response

示例

getTicket 示例
Copy Copy
1
2const tenantId: string = 'acme-corp-tenant-01';
3const ticketId: string = 'tkt-20260325-42';
4const userId: string = 'user-8452';
5
6const ticketResponseWithUser: GetTicket200Response = await getTicket(tenantId, ticketId, userId);
7const ticketResponseWithoutUser: GetTicket200Response = await getTicket(tenantId, ticketId);
8

获取工单列表 Internal Link

参数

名称 类型 必需 描述
tenantId string
userId string
state number
skip number
limit number

响应

返回: GetTickets200Response

示例

getTickets 示例
Copy Copy
1
2const tenantId: string = "tenant_92f3b4c1";
3const userId: string = "user_742a9f3e";
4const state: number = 1;
5const skip: number = 0;
6const limit: number = 25;
7const ticketsFull: GetTickets200Response = await getTickets(tenantId, userId, state, skip, limit);
8const ticketsMinimal: GetTickets200Response = await getTickets("tenant_92f3b4c1");
9

上传图片 Internal Link

上传并调整图像大小

参数

名称 类型 必需 描述
tenantId string
file Blob
sizePreset SizePreset
urlId string

响应

返回: UploadImageResponse


通过 ID 获取用户徽章进度 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string

响应

返回:GetUserBadgeProgressById200Response

示例

getUserBadgeProgressById 示例
Copy Copy
1
2const optionalTenantSuffix: string | undefined = undefined;
3const tenantId: string = `5f8d0d55-1234-4ab1-9e2a-3f2b5c6d7e8f${optionalTenantSuffix ?? ''}`;
4const id: string = '3a2b1c4d-5678-4ef0-9abc-def123456789';
5const result: GetUserBadgeProgressById200Response = await getUserBadgeProgressById(tenantId, id);
6

通过用户 ID 获取用户徽章进度 Internal Link

参数

名称 类型 必需 描述
tenantId string
userId string

响应

返回: GetUserBadgeProgressById200Response

示例

getUserBadgeProgressByUserId 示例
Copy Copy
1
2const tenantId: string = 'tenant_7f9c2d3b';
3const maybeUserId: string | undefined = 'user_4b8e1f9a'; // 可选来源(可能为 undefined)
4const userId: string = maybeUserId ?? 'user_fallback0001';
5const result: GetUserBadgeProgressById200Response = await getUserBadgeProgressByUserId(tenantId, userId);
6console.log(result);
7

获取用户徽章进度列表 Internal Link

参数

名称 类型 必需 描述
tenantId string
userId string
limit number
skip number

响应

返回: GetUserBadgeProgressList200Response

示例

getUserBadgeProgressList 示例
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_4f8c2b9d';
4 const userId: string = 'user_9a7e215c';
5 const limit: number = 25;
6 const skip: number = 0;
7 const resultMinimal: GetUserBadgeProgressList200Response = await getUserBadgeProgressList(tenantId);
8 const resultFull: GetUserBadgeProgressList200Response = await getUserBadgeProgressList(tenantId, userId, limit, skip);
9 console.log(resultMinimal, resultFull);
10})();
11

创建用户徽章 Internal Link

参数

名称 类型 必填 描述
tenantId string
createUserBadgeParams CreateUserBadgeParams

响应

返回: CreateUserBadge200Response

示例

createUserBadge 示例
Copy Copy
1
2const tenantId: string = 'tenant_84f3b2';
3const createUserBadgeParams: CreateUserBadgeParams = {
4 name: 'Top Contributor',
5 slug: 'top-contributor',
6 imageUrl: 'https://assets.fastcomments.com/badges/top-contributor.png',
7 description: 'Awarded for 100 helpful comments',
8 active: true,
9 criteria: { commentsCount: 100 }, // 可选条件
10 displayOrder: 10,
11 metadata: { featured: true } // 可选元数据
12};
13const result: CreateUserBadge200Response = await createUserBadge(tenantId, createUserBadgeParams);
14console.log(result);
15

删除用户徽章 Internal Link


参数

名称 类型 必需 描述
tenantId string
id string

响应

返回: UpdateUserBadge200Response

示例

deleteUserBadge 示例
Copy Copy
1
2type DeleteOptions = { notifyModerators?: boolean };
3
4const tenantId: string = 'tenant_8a3f21';
5const id: string = 'badge_71f2b';
6const options: DeleteOptions = { notifyModerators: true };
7
8const result: UpdateUserBadge200Response = await deleteUserBadge(tenantId, id);
9

获取用户徽章 Internal Link

参数

名称 类型 必需 描述
tenantId string
id string

响应

返回: GetUserBadge200Response

示例

getUserBadge 示例
Copy Copy
1
2const tenantId: string = "tenant_acme_01";
3const id: string = "badge_8c7d2f";
4const response: GetUserBadge200Response = await getUserBadge(tenantId, id);
5

获取用户徽章列表 Internal Link

参数

名称 类型 必填 描述
tenantId string
userId string
badgeId string
type number
displayedOnComments boolean
limit number
skip number

响应

返回: GetUserBadges200Response

示例

getUserBadges 示例
Copy Copy
1
2const tenantId: string = 'tenant_acme_01';
3const userId: string = 'user_5f4d3c2a';
4const badgeId: string = 'badge_top_contributor';
5const type: number = 1;
6const displayedOnComments: boolean = true;
7const limit: number = 50;
8const skip: number = 0;
9
10const result: GetUserBadges200Response = await getUserBadges(tenantId, userId, badgeId, type, displayedOnComments, limit, skip);
11

更新用户徽章 Internal Link

参数

名称 类型 必填 描述
tenantId string
id string
updateUserBadgeParams UpdateUserBadgeParams

响应

返回: UpdateUserBadge200Response

示例

updateUserBadge 示例
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_acme_987';
4 const id: string = 'badge_top_contributor_42';
5 const updateUserBadgeParams: UpdateUserBadgeParams = {
6 title: 'Top Contributor',
7 description: 'Awarded for reaching 100 high-quality comments',
8 color: '#FFD700',
9 iconUrl: 'https://cdn.acme.com/badges/top-contributor.svg',
10 active: true,
11 notifyUsers: true
12 } as UpdateUserBadgeParams;
13 const result: UpdateUserBadge200Response = await updateUserBadge(tenantId, id, updateUserBadgeParams);
14 console.log(result);
15})();
16

获取用户通知计数 Internal Link

参数

名称 类型 必填 描述
tenantId string
sso string

响应

返回: GetUserNotificationCount200Response

示例

getUserNotificationCount 示例
Copy Copy
1
2(async () => {
3 const tenantId: string = '9f1e2d3c-4b5a-6d7e-8f90-123456789abc';
4 const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI0MjMifQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
5 const resultWithSSO: GetUserNotificationCount200Response = await getUserNotificationCount(tenantId, ssoToken);
6 const resultWithoutSSO: GetUserNotificationCount200Response = await getUserNotificationCount(tenantId);
7 console.log(resultWithSSO, resultWithoutSSO);
8})();
9

获取用户通知 Internal Link

参数

Name Type Required Description
tenantId string
pageSize number
afterId string
includeContext boolean
afterCreatedAt number
unreadOnly boolean
dmOnly boolean
noDm boolean
includeTranslations boolean
sso string

响应

返回:GetUserNotifications200Response

示例

getUserNotifications 示例
Copy Copy
1
2const tenantId: string = 'tenant_7f3b1c';
3const pageSize: number = 25;
4const afterId: string = 'notif_b2f9e4';
5const includeContext: boolean = true;
6const afterCreatedAt: number = Date.now() - 24 * 60 * 60 * 1000;
7const unreadOnly: boolean = true;
8const dmOnly: boolean = false;
9const noDm: boolean = false;
10const includeTranslations: boolean = true;
11const sso: string = 'sso_tok_user_9f8d7c';
12const response: GetUserNotifications200Response = await getUserNotifications(
13 tenantId,
14 pageSize,
15 afterId,
16 includeContext,
17 afterCreatedAt,
18 unreadOnly,
19 dmOnly,
20 noDm,
21 includeTranslations,
22 sso
23);
24

重置用户通知计数 Internal Link

参数

Name Type 必填 描述
tenantId string
sso string

响应

返回: ResetUserNotifications200Response

示例

resetUserNotificationCount 示例
Copy Copy
1
2(async () => {
3 const tenantId: string = "tenant_9f3b2c4a";
4 const ssoToken: string | undefined = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9._sample_payload_.signature";
5 const responseWithSSO: ResetUserNotifications200Response = await resetUserNotificationCount(tenantId, ssoToken);
6 const responseWithoutSSO: ResetUserNotifications200Response = await resetUserNotificationCount(tenantId);
7 console.log(responseWithSSO, responseWithoutSSO);
8})();
9

重置用户通知 Internal Link

参数

名称 类型 必填 描述
tenantId string
afterId string
afterCreatedAt number
unreadOnly boolean
dmOnly boolean
noDm boolean
sso string

响应

返回:ResetUserNotifications200Response

示例

resetUserNotifications 示例
Copy Copy
1
2const tenantId: string = "tenant_prod_4a9f12";
3const afterId: string = "notification_87213";
4const afterCreatedAt: number = Math.floor(Date.now() / 1000) - 3600;
5const unreadOnly: boolean = true;
6const dmOnly: boolean = false;
7const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.payload";
8const result: ResetUserNotifications200Response = await resetUserNotifications(tenantId, afterId, afterCreatedAt, unreadOnly, dmOnly, undefined, sso);
9

更新用户评论订阅状态 Internal Link

为特定评论启用或禁用通知。

参数

名称 类型 必填 说明
tenantId string
notificationId string
optedInOrOut UpdateUserNotificationCommentSubscriptionStatusOptedInOrOutEnum
commentId string
sso string

响应

返回: UpdateUserNotificationStatus200Response

示例

updateUserNotificationCommentSubscriptionStatus 示例
Copy Copy
1
2const tenantId: string = 'acme-tenant-001';
3const notificationId: string = 'notif-2026-03-25-01';
4const commentId: string = 'cmt-8f3a2b';
5const optedInOrOut: UpdateUserNotificationCommentSubscriptionStatusOptedInOrOutEnum = UpdateUserNotificationCommentSubscriptionStatusOptedInOrOutEnum.OptIn;
6const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.sso-payload.signature';
7const result: UpdateUserNotificationStatus200Response = await updateUserNotificationCommentSubscriptionStatus(tenantId, notificationId, optedInOrOut, commentId, sso);
8

更新用户页面订阅状态 Internal Link

启用或禁用页面的通知。当用户订阅某个页面时,会为新的根评论创建通知,并且还会

参数

名称 类型 必需 描述
tenantId string
urlId string
url string
pageTitle string
subscribedOrUnsubscribed UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum
sso string

响应

返回:UpdateUserNotificationStatus200Response

示例

updateUserNotificationPageSubscriptionStatus 示例
Copy Copy
1
2const tenantId: string = 'acme-tenant-42';
3const urlId: string = 'blog-launch-2026';
4const url: string = 'https://acme.example.com/blog/launch-march-2026';
5const pageTitle: string = 'Acme Product Launch — March 2026';
6const subscribedOrUnsubscribed: UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum = UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum.Subscribed;
7const sso: string = 'sso_jwt_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
8const response: UpdateUserNotificationStatus200Response = await updateUserNotificationPageSubscriptionStatus(tenantId, urlId, url, pageTitle, subscribedOrUnsubscribed, sso);
9

更新用户通知状态 Internal Link

参数

名称 类型 必需 描述
tenantId string
notificationId string
newStatus UpdateUserNotificationStatusNewStatusEnum
sso string

响应

返回: UpdateUserNotificationStatus200Response

示例

updateUserNotificationStatus 示例
Copy Copy
1
2const tenantId: string = 'tenant_84a2c3';
3const notificationId: string = 'notif_20260325_01';
4const newStatus: UpdateUserNotificationStatusNewStatusEnum = UpdateUserNotificationStatusNewStatusEnum.Read;
5const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.sso_signature_example';
6const result: UpdateUserNotificationStatus200Response = await updateUserNotificationStatus(tenantId, notificationId, newStatus, sso);
7

获取用户在线状态 Internal Link

参数

名称 类型 必填 描述
tenantId string
urlIdWS string
userIds string

响应

返回:GetUserPresenceStatuses200Response

示例

getUserPresenceStatuses 示例
Copy Copy
1
2const tenantId: string = 'tenant_7f3a2b';
3const urlIdWS: string = 'articles/2026/03/25/fastcomments-integration';
4const maybeUserIds: string | undefined = 'user_123,user_456'; // 可选来源
5const userIds: string = maybeUserIds ?? 'user_123';
6const presence: GetUserPresenceStatuses200Response = await getUserPresenceStatuses(tenantId, urlIdWS, userIds);
7

搜索用户 Internal Link

参数

名称 类型 必填 描述
tenantId string
urlId string
usernameStartsWith string
mentionGroupIds Array
sso string
searchSection SearchUsersSearchSectionEnum

响应

返回: SearchUsers200Response

示例

searchUsers 示例
Copy Copy
1
2const tenantId: string = 'tenant_8392';
3const urlId: string = 'articles/2026/03/25/fastcomments-release';
4const usernameStartsWith: string = 'jo';
5const mentionGroupIds: Array<string> = ['editors', 'senior-writers'];
6const sso: string = 'sso_jwt_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
7const searchSection: SearchUsersSearchSectionEnum = SearchUsersSearchSectionEnum.ALL;
8const result: SearchUsers200Response = await searchUsers(tenantId, urlId, usernameStartsWith, mentionGroupIds, sso, searchSection);
9

获取用户 Internal Link

参数

名称 Type 必填 描述
tenantId string
id string

Response

返回: GetUser200Response

示例

getUser 示例
Copy Copy
1
2const tenantId: string = 'tenant_7b3f42';
3const id: string = 'user_9c4d2a';
4const userResponse: GetUser200Response = await getUser(tenantId, id);
5console.log(userResponse);
6

创建投票 Internal Link

参数

名称 类型 必填 描述
tenantId string
commentId string
direction CreateVoteDirectionEnum
userId string
anonUserId string

响应

返回: VoteComment200Response

示例

createVote 示例
Copy Copy
1
2const tenantId: string = 'tenant_9f8b6a';
3const commentId: string = 'comment_3b7d2e';
4const direction: CreateVoteDirectionEnum = CreateVoteDirectionEnum.Up;
5const anonUserId: string = 'anon_4c2a1f';
6
7const voteResult: VoteComment200Response = await createVote(tenantId, commentId, direction, undefined, anonUserId);
8

删除投票 Internal Link

参数

名称 类型 必填 描述
tenantId string
id string
editKey string

响应

返回: DeleteCommentVote200Response

示例

deleteVote 示例
Copy Copy
1
2const tenantId: string = "tenant_7c3f2b4a";
3const voteId: string = "vote_4f8d9a11";
4const editKey: string = "edit_2b9f8c";
5const resultWithoutKey: DeleteCommentVote200Response = await deleteVote(tenantId, voteId);
6const resultWithKey: DeleteCommentVote200Response = await deleteVote(tenantId, voteId, editKey);
7

获取投票 Internal Link

参数

名称 类型 必填 描述
tenantId string
urlId string

响应

返回: GetVotes200Response

示例

getVotes 示例
Copy Copy
1
2const tenantId: string = 'acme-corp-8f3b';
3const refCampaign: string | undefined = 'newsletter-march2026'; // 可选查询参数
4const urlId: string = `https://www.example.com/articles/2026/03/25/fastcomments-integration${refCampaign ? `?ref=${refCampaign}` : ''}`;
5
6const votes: GetVotes200Response = await getVotes(tenantId, urlId);
7

获取用户的投票 Internal Link

参数

名称 类型 必需 描述
tenantId string
urlId string
userId string
anonUserId string

响应

返回: GetVotesForUser200Response

示例

getVotesForUser 示例
Copy Copy
1
2(async (): Promise<void> => {
3 const tenantId: string = "local-news-ny";
4 const urlId: string = "articles/2026-03-25/ev-infrastructure-update";
5 const userId: string = "user_78b6f3d9";
6 const anonUserId: string = "anon_9c3f7a1b";
7 const result: GetVotesForUser200Response = await getVotesForUser(tenantId, urlId, userId, anonUserId);
8 console.log(result);
9})();
10

需要帮助?

如果您在使用 JavaScript/TypeScript SDK 时遇到任何问题或有疑问,请:

贡献

欢迎贡献!请访问 GitHub 仓库 获取贡献指南。