网络Tipline工具
A 类 非正式 收集与失踪和被剥削儿童国家中心互动的工具 CyberTipline 报告 API。 。 。 .
安装
# Using pnpm
pnpm add cybertipline-tools
# Using npm
npm install cybertipline-tools
# Using yarn
yarn add cybertipline-tools
快速启动
import { Client, Environment, IncidentType } from 'cybertipline-tools';
// Create a new client
const client = new Client({
environment: Environment.Testing, // Use Testing for development
credentials: {
username: 'your-username',
password: 'your-password',
},
});
// Test your connection
const status = await client.getStatus();
console.log('Connected:', status.data.responseDescription);
// Submit a report
const report = await client.submitReport({
incidentSummary: {
incidentType: IncidentType.ChildSexTourism,
// ... other required fields
},
reporter: {
reportingPerson: {
email: '[email protected]',
// ... other required fields
},
},
});
console.log('Report ID:', report.data.reportId);
// Upload a file
const fileUpload = await client.uploadFile({
id: report.data.reportId,
file: new File(['...'], 'evidence.jpg'),
});
console.log('File ID:', fileUpload.data.fileId);
// Add file details
await client.submitFileDetails({
reportId: Number(report.data.reportId),
fileId: fileUpload.data.fileId,
fileName: 'evidence.jpg',
// ... other optional fields
});
// Mark report as complete
await client.finishReport({
id: report.data.reportId,
});
所需资源
- 节点.js 22.x 或后期(类型定义为TypeScript 5.x)
- 旧版本可能可行,但未经官方核实.
- 无害环境管理模块支持
- CommunityJS被导出,但没有正式测试. 我们欢迎为改善这种情况而作的贡献.
特征
✨ 类型安全
- 包含详细类型定义的完整类型脚本支持
- 包含 JSDoc 注释的内置文档
- 允许所有 API 的 IDE 自动补全
🐛 处理错误
- 请求提取所有操作的ID
- 处理详细信件出错
🛠️ API 支持
-
GET /status- 测试API连接 -
POST /submit- 提交新报告 -
POST /upload- 上传证据文件 -
POST /fileinfo- 添加文件元数据 -
POST /finish- 完整报告 -
POST /retract- 取消报告 -
你提供JSON,我们把它转换成XML和回,所以不需要担心XML!
处理错误
客户端包括内置错误处理 :
try {
await client.getStatus();
} catch (error) {
// All API errors include the Request-ID for troubleshooting
console.error('API Error:', error.message);
// Example: "Authentication failed (Request-ID: abc-123)"
}
发展状况
🚧 待办
- Schema 验证(佐德?)
- 实例和演示
- 文件改进
- 业绩优化
- 稳定开发者的经验
🔮 未来可能的计划
- E2E 针对运行的CyberTipline测试环境的测试
- 批次报告支持
- XSD 计划到 TypeScript 生成
许可证
麻省理工学院的执照 - 看 自由主义 详细文件.
资源
- CyberTipline API 文档 (NCMEC的正式文件)
- 应用 API 访问 (NCMEC团队)
- 报告问题