wsapi-sdk 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wsapi_sdk-0.1.3/PKG-INFO +1240 -0
- wsapi_sdk-0.1.3/README.md +1228 -0
- {wsapi_sdk-0.1.2 → wsapi_sdk-0.1.3}/__init__.py +1 -1
- {wsapi_sdk-0.1.2 → wsapi_sdk-0.1.3}/pyproject.toml +1 -1
- wsapi_sdk-0.1.3/wsapi_sdk.egg-info/PKG-INFO +1240 -0
- wsapi_sdk-0.1.2/PKG-INFO +0 -248
- wsapi_sdk-0.1.2/README.md +0 -236
- wsapi_sdk-0.1.2/wsapi_sdk.egg-info/PKG-INFO +0 -248
- {wsapi_sdk-0.1.2 → wsapi_sdk-0.1.3}/client.py +0 -0
- {wsapi_sdk-0.1.2 → wsapi_sdk-0.1.3}/exceptions.py +0 -0
- {wsapi_sdk-0.1.2 → wsapi_sdk-0.1.3}/setup.cfg +0 -0
- {wsapi_sdk-0.1.2 → wsapi_sdk-0.1.3}/tests/test_admin.py +0 -0
- {wsapi_sdk-0.1.2 → wsapi_sdk-0.1.3}/tests/test_auth.py +0 -0
- {wsapi_sdk-0.1.2 → wsapi_sdk-0.1.3}/tests/test_openapi.py +0 -0
- {wsapi_sdk-0.1.2 → wsapi_sdk-0.1.3}/tests/test_talents.py +0 -0
- {wsapi_sdk-0.1.2 → wsapi_sdk-0.1.3}/wsapi_sdk.egg-info/SOURCES.txt +0 -0
- {wsapi_sdk-0.1.2 → wsapi_sdk-0.1.3}/wsapi_sdk.egg-info/dependency_links.txt +0 -0
- {wsapi_sdk-0.1.2 → wsapi_sdk-0.1.3}/wsapi_sdk.egg-info/requires.txt +0 -0
- {wsapi_sdk-0.1.2 → wsapi_sdk-0.1.3}/wsapi_sdk.egg-info/top_level.txt +0 -0
wsapi_sdk-0.1.3/PKG-INFO
ADDED
|
@@ -0,0 +1,1240 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wsapi-sdk
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: WasaiTalent API Python SDK
|
|
5
|
+
Author-email: Chandler <275737875@qq.com>
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: requests>=2.28.0
|
|
9
|
+
Provides-Extra: dev
|
|
10
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
11
|
+
Requires-Dist: responses>=0.23.0; extra == "dev"
|
|
12
|
+
|
|
13
|
+
# WasaiTalent API Python SDK
|
|
14
|
+
|
|
15
|
+
WasaiTalent 人才管理系统后端 API 的 Python 客户端封装。
|
|
16
|
+
|
|
17
|
+
## 环境准备
|
|
18
|
+
|
|
19
|
+
Python >= 3.8
|
|
20
|
+
|
|
21
|
+
### 安装 SDK(开发模式)
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cd wsapi
|
|
25
|
+
pip install -e ".[dev]"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
这会将 `wsapi` 以可编辑模式安装到当前 Python 环境中,安装后即可在任意目录下 `from wsapi import ...`。
|
|
29
|
+
|
|
30
|
+
### 仅安装运行时依赖
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
cd wsapi
|
|
34
|
+
pip install -r requirements.txt
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 快速开始
|
|
38
|
+
|
|
39
|
+
### 1. JWT 认证模式(Auth / Talents / Admin)
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from wsapi import WasaiTalentClient
|
|
43
|
+
|
|
44
|
+
client = WasaiTalentClient(base_url="http://localhost:3001")
|
|
45
|
+
|
|
46
|
+
# 注册
|
|
47
|
+
client.auth.register("admin", "admin@example.com", "password123")
|
|
48
|
+
|
|
49
|
+
# 登录(token 自动保存)
|
|
50
|
+
client.auth.login("admin", "password123")
|
|
51
|
+
|
|
52
|
+
# 查看当前用户
|
|
53
|
+
me = client.auth.me()
|
|
54
|
+
print(me) # {"user": {"id": 1, "username": "admin", ...}}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 2. 人才管理(需先登录)
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
# 创建人才
|
|
61
|
+
talent = client.talents.create(
|
|
62
|
+
"张三",
|
|
63
|
+
company="OpenAI",
|
|
64
|
+
email="zhang@openai.com",
|
|
65
|
+
location="北京",
|
|
66
|
+
skills="Python,ML",
|
|
67
|
+
)
|
|
68
|
+
tid = talent["data"]["id"]
|
|
69
|
+
|
|
70
|
+
# 查询列表(支持 25+ 个筛选参数)
|
|
71
|
+
result = client.talents.list(search="张三", location="北京", page=1, limit=20)
|
|
72
|
+
print(result["pagination"])
|
|
73
|
+
|
|
74
|
+
# 查看详情(含 profiles / experiences / notes 等子资源)
|
|
75
|
+
detail = client.talents.get(tid)
|
|
76
|
+
|
|
77
|
+
# 更新
|
|
78
|
+
client.talents.update(tid, company="Anthropic", title="Research Engineer")
|
|
79
|
+
|
|
80
|
+
# 删除
|
|
81
|
+
client.talents.delete(tid)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 3. 子资源管理(备注 / 经历 / 论文 / 专利 等)
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
# 备注
|
|
88
|
+
client.talents.add_note(tid, "优秀候选人,建议跟进")
|
|
89
|
+
client.talents.list_notes(tid)
|
|
90
|
+
client.talents.update_note(tid, note_id=1, content="已完成初试")
|
|
91
|
+
client.talents.delete_note(tid, note_id=1)
|
|
92
|
+
|
|
93
|
+
# 工作经历
|
|
94
|
+
client.talents.add_experience(tid, company="Google", title="SWE", start_date="2020-01")
|
|
95
|
+
client.talents.list_experiences(tid)
|
|
96
|
+
|
|
97
|
+
# 教育经历
|
|
98
|
+
client.talents.add_education(tid, school="清华大学", degree="硕士", field="计算机科学")
|
|
99
|
+
|
|
100
|
+
# 论文
|
|
101
|
+
client.talents.add_paper(tid, "Attention Is All You Need", year=2017, venue="NeurIPS")
|
|
102
|
+
|
|
103
|
+
# 专利
|
|
104
|
+
client.talents.add_patent(tid, "AI 辅助编程方法", patent_type="发明专利")
|
|
105
|
+
|
|
106
|
+
# 行业会议
|
|
107
|
+
client.talents.add_conference(tid, "NeurIPS", role="Speaker", year=2024)
|
|
108
|
+
|
|
109
|
+
# GitHub 项目
|
|
110
|
+
client.talents.add_repo(tid, "transformer", language="Python", stars=5000)
|
|
111
|
+
|
|
112
|
+
# 平台档案
|
|
113
|
+
client.talents.create_profile(tid, "github", username="zhangsan", platform_url="https://github.com/zhangsan")
|
|
114
|
+
|
|
115
|
+
# 跟盯记录
|
|
116
|
+
client.talents.add_followup(tid, "已发送 offer", type="offer", next_action="等待回复", next_date="2025-02-01")
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 4. 人才关联/取消关联
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
# 关联两个人才
|
|
123
|
+
client.talents.merge(primary_talent_id=1, merged_talent_id=2, match_type="email")
|
|
124
|
+
|
|
125
|
+
# 取消关联
|
|
126
|
+
client.talents.unmerge(primary_talent_id=1, merged_talent_id=2)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 5. 统计查询
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
client.talents.stats_sources() # 按数据来源
|
|
133
|
+
client.talents.stats_import_methods() # 按导入方式
|
|
134
|
+
client.talents.stats_companies() # 按公司(Top 20)
|
|
135
|
+
client.talents.stats_platforms() # 按平台档案
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 6. 管理员接口(需 admin 角色)
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
# 系统概览
|
|
142
|
+
dashboard = client.admin.dashboard()
|
|
143
|
+
|
|
144
|
+
# 用户管理
|
|
145
|
+
client.admin.list_users()
|
|
146
|
+
client.admin.update_user_role(user_id=2, role="viewer")
|
|
147
|
+
client.admin.delete_user(user_id=3)
|
|
148
|
+
|
|
149
|
+
# API Key 管理
|
|
150
|
+
key = client.admin.create_api_key("数据导入 Key", permissions="read,write")
|
|
151
|
+
api_key_value = key["data"]["key"] # 仅在创建时返回一次
|
|
152
|
+
client.admin.list_api_keys()
|
|
153
|
+
client.admin.delete_api_key(key_id=1)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 7. 开放接口(API Key 认证)
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
client = WasaiTalentClient(
|
|
160
|
+
base_url="http://localhost:3001",
|
|
161
|
+
api_key="your-api-key-here",
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
# 查询人才
|
|
165
|
+
client.open.list_talents(search="李四", limit=50)
|
|
166
|
+
client.open.get_talent(1)
|
|
167
|
+
client.open.create_talent("王五", company="腾讯")
|
|
168
|
+
|
|
169
|
+
# 多平台导入
|
|
170
|
+
client.open.import_github({"login": "torvalds", "name": "Linus"})
|
|
171
|
+
client.open.import_github_batch([{"login": "user1"}, {"login": "user2"}])
|
|
172
|
+
|
|
173
|
+
client.open.import_maimai({"name": "张三", "company": "字节跳动"})
|
|
174
|
+
client.open.import_maimai_batch([{"name": "用户A"}])
|
|
175
|
+
|
|
176
|
+
client.open.import_linkedin({"name": "Alice", "company": "Google", "experience": [...]})
|
|
177
|
+
client.open.import_wechat({"name": "微信用户", "wechat_id": "wx123"})
|
|
178
|
+
client.open.import_wechat_batch([{"name": "联系人A"}])
|
|
179
|
+
|
|
180
|
+
client.open.import_arxiv({"name": "Researcher", "papers": [...]})
|
|
181
|
+
client.open.import_patent({"name": "Inventor", "patents": [...]})
|
|
182
|
+
client.open.import_conference({"name": "Speaker", "conferences": [...]})
|
|
183
|
+
|
|
184
|
+
# CSV 导入/导出
|
|
185
|
+
client.open.import_csv("./talents.csv")
|
|
186
|
+
csv_text = client.open.export_csv()
|
|
187
|
+
|
|
188
|
+
# JSON 批量导入
|
|
189
|
+
client.open.batch_import([{"name": "批量用户1"}, {"name": "批量用户2"}])
|
|
190
|
+
|
|
191
|
+
# 人才关联
|
|
192
|
+
client.open.merge(primary_talent_id=1, merged_talent_id=2)
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## API 参考文档
|
|
196
|
+
|
|
197
|
+
> 所有方法均返回 `dict`(JSON 响应)或 `str`(CSV 导出),失败时抛出对应异常(见[异常处理](#异常处理)章节)。
|
|
198
|
+
> 响应结构通常为 `{"data": ...}` 或 `{"data": [...], "pagination": {...}}`。
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### AuthAPI — 认证接口
|
|
203
|
+
|
|
204
|
+
认证相关接口,路由前缀 `/api/auth`。除 `me()` 和 `change_password()` 外,`register()` 和 `login()` 无需预先认证。
|
|
205
|
+
|
|
206
|
+
#### `register(username, email, password)`
|
|
207
|
+
|
|
208
|
+
注册新用户。成功后 **自动保存 token**,后续请求无需再手动设置。
|
|
209
|
+
|
|
210
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
211
|
+
|---|---|---|---|---|
|
|
212
|
+
| `username` | `str` | 是 | — | 用户名,不可与已有用户重复 |
|
|
213
|
+
| `email` | `str` | 是 | — | 邮箱地址,不可与已有用户重复 |
|
|
214
|
+
| `password` | `str` | 是 | — | 密码,**至少 6 位** |
|
|
215
|
+
|
|
216
|
+
**返回值**:`{"user": {"id", "username", "email", "role", "created_at"}, "token": "..."}`
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
#### `login(username, password)`
|
|
221
|
+
|
|
222
|
+
用户登录。支持用户名或邮箱登录。成功后 **自动保存 token**。
|
|
223
|
+
|
|
224
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
225
|
+
|---|---|---|---|---|
|
|
226
|
+
| `username` | `str` | 是 | — | 用户名或邮箱 |
|
|
227
|
+
| `password` | `str` | 是 | — | 密码 |
|
|
228
|
+
|
|
229
|
+
**返回值**:`{"user": {"id", "username", "email", "role"}, "token": "..."}`
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
#### `me()`
|
|
234
|
+
|
|
235
|
+
获取当前已登录用户信息。需 JWT 认证。
|
|
236
|
+
|
|
237
|
+
无参数。
|
|
238
|
+
|
|
239
|
+
**返回值**:`{"user": {"id", "username", "email", "role", "created_at", ...}}`
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
#### `change_password(old_password, new_password)`
|
|
244
|
+
|
|
245
|
+
修改当前用户密码。需 JWT 认证。
|
|
246
|
+
|
|
247
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
248
|
+
|---|---|---|---|---|
|
|
249
|
+
| `old_password` | `str` | 是 | — | 当前密码 |
|
|
250
|
+
| `new_password` | `str` | 是 | — | 新密码 |
|
|
251
|
+
|
|
252
|
+
**返回值**:`{"message": "密码修改成功"}`
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
### TalentAPI — 人才管理接口
|
|
257
|
+
|
|
258
|
+
人才管理接口,路由前缀 `/api/talents`,所有方法均需 **JWT 认证**。
|
|
259
|
+
|
|
260
|
+
#### 主资源 CRUD
|
|
261
|
+
|
|
262
|
+
##### `list(**kwargs)`
|
|
263
|
+
|
|
264
|
+
获取人才列表(分页 + 多维筛选)。
|
|
265
|
+
|
|
266
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
267
|
+
|---|---|---|---|---|
|
|
268
|
+
| `search` | `str` | 否 | — | 全局模糊搜索(匹配 name/email/company/title/skills/phone/location 等 18 个字段) |
|
|
269
|
+
| `data_source` | `str` | 否 | — | 数据来源精确匹配,如 `"github"`, `"linkedin"`, `"maimai"`, `"manual"`, `"csv"`, `"wechat"`, `"arxiv"`, `"patent"`, `"conference"` |
|
|
270
|
+
| `import_method` | `str` | 否 | — | 导入方式精确匹配,如 `"manual"`, `"api"`, `"csv_import"` |
|
|
271
|
+
| `status` | `str` | 否 | — | 状态枚举:`active` / `inactive` / `archived` |
|
|
272
|
+
| `open_to_work` | `str` | 否 | — | 是否在看机会 |
|
|
273
|
+
| `education` | `str` | 否 | — | 学历精确匹配,如 `"本科"`, `"硕士"`, `"博士"` |
|
|
274
|
+
| `gender` | `str` | 否 | — | 性别 |
|
|
275
|
+
| `location` | `str` | 否 | — | 地点模糊匹配 |
|
|
276
|
+
| `skills` | `str` | 否 | — | 技能模糊匹配,逗号分隔格式 `"Python,ML,NLP"` |
|
|
277
|
+
| `email` | `str` | 否 | — | 邮箱模糊匹配 |
|
|
278
|
+
| `phone` | `str` | 否 | — | 手机模糊匹配 |
|
|
279
|
+
| `wechat` | `str` | 否 | — | 微信号模糊匹配 |
|
|
280
|
+
| `suitable_roles` | `str` | 否 | — | 适合岗位模糊匹配 |
|
|
281
|
+
| `job_preference` | `str` | 否 | — | 求职偏好模糊匹配 |
|
|
282
|
+
| `tags` | `str` | 否 | — | 标签模糊匹配,逗号分隔格式 `"AI,Research"` |
|
|
283
|
+
| `linkedin_url` | `str` | 否 | — | LinkedIn URL 模糊匹配 |
|
|
284
|
+
| `github_url` | `str` | 否 | — | GitHub URL 模糊匹配 |
|
|
285
|
+
| `maimai_url` | `str` | 否 | — | 脉脉 URL 模糊匹配 |
|
|
286
|
+
| `homepage` | `str` | 否 | — | 个人主页 URL 模糊匹配 |
|
|
287
|
+
| `paper_title` | `str` | 否 | — | 论文标题模糊匹配(跨子表查询) |
|
|
288
|
+
| `patent_title` | `str` | 否 | — | 专利标题模糊匹配(跨子表查询) |
|
|
289
|
+
| `conference_name` | `str` | 否 | — | 会议名称模糊匹配(跨子表查询) |
|
|
290
|
+
| `experience_years_min` | `int` | 否 | — | 工作年限下限(含),非负整数 |
|
|
291
|
+
| `experience_years_max` | `int` | 否 | — | 工作年限上限(含),非负整数 |
|
|
292
|
+
| `expected_salary_min` | `float` | 否 | — | 期望薪资下限(含) |
|
|
293
|
+
| `expected_salary_max` | `float` | 否 | — | 期望薪资上限(含) |
|
|
294
|
+
| `page` | `int` | 否 | `1` | 页码,从 1 开始 |
|
|
295
|
+
| `limit` | `int` | 否 | `20` | 每页条数 |
|
|
296
|
+
| `sort` | `str` | 否 | `"created_at"` | 排序字段,可选:`name` / `created_at` / `rating` / `experience_years` / `updated_at` |
|
|
297
|
+
| `order` | `str` | 否 | `"DESC"` | 排序方向:`ASC` / `DESC` |
|
|
298
|
+
|
|
299
|
+
**返回值**:`{"data": [...], "pagination": {"page", "limit", "total", "totalPages"}}`
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
##### `get(talent_id)`
|
|
304
|
+
|
|
305
|
+
获取单个人才详情,包含所有子资源(profiles, experiences, educations, notes, followups, papers, patents, conferences, githubRepos)和关联人才(relatedTalents)。
|
|
306
|
+
|
|
307
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
308
|
+
|---|---|---|---|---|
|
|
309
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
310
|
+
|
|
311
|
+
**返回值**:`{"data": {...}, "profiles": [...], "experiences": [...], "educations": [...], "notes": [...], "followups": [...], "papers": [...], "patents": [...], "conferences": [...], "githubRepos": [...], "relatedTalents": [...]}`
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
##### `create(name, **kwargs)`
|
|
316
|
+
|
|
317
|
+
创建人才记录。
|
|
318
|
+
|
|
319
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
320
|
+
|---|---|---|---|---|
|
|
321
|
+
| `name` | `str` | 是 | — | 姓名 |
|
|
322
|
+
| `email` | `str` | 否 | `None` | 邮箱 |
|
|
323
|
+
| `phone` | `str` | 否 | `None` | 手机号 |
|
|
324
|
+
| `company` | `str` | 否 | `None` | 公司 |
|
|
325
|
+
| `title` | `str` | 否 | `None` | 职位 |
|
|
326
|
+
| `location` | `str` | 否 | `None` | 所在地 |
|
|
327
|
+
| `skills` | `str` | 否 | `None` | 技能,逗号分隔格式 `"Python,ML,NLP"` |
|
|
328
|
+
| `education` | `str` | 否 | `None` | 学历,如 `"本科"`, `"硕士"`, `"博士"` |
|
|
329
|
+
| `experience_years` | `int` | 否 | `None` | 工作年限,非负整数 |
|
|
330
|
+
| `summary` | `str` | 否 | `None` | 简介/摘要 |
|
|
331
|
+
| `data_source` | `str` | 否 | `"manual"` | 数据来源 |
|
|
332
|
+
| `import_method` | `str` | 否 | `"manual"` | 导入方式 |
|
|
333
|
+
| `tags` | `str` | 否 | `None` | 标签,逗号分隔格式 `"AI,Research"` |
|
|
334
|
+
| `rating` | `int` | 否 | `0` | 评分,范围 0–5 |
|
|
335
|
+
| `status` | `str` | 否 | `"active"` | 状态枚举:`active` / `inactive` / `archived` |
|
|
336
|
+
| `avatar_url` | `str` | 否 | `None` | 头像 URL,需为合法 URL |
|
|
337
|
+
| `raw_data` | `str` | 否 | `None` | 原始数据(JSON 字符串) |
|
|
338
|
+
| `open_to_work` | `str` | 否 | `None` | 是否在看机会 |
|
|
339
|
+
| `suitable_roles` | `str` | 否 | `None` | 适合岗位 |
|
|
340
|
+
| `homepage` | `str` | 否 | `None` | 个人主页 URL,需为合法 URL |
|
|
341
|
+
| `github_url` | `str` | 否 | `None` | GitHub 主页 URL,需为合法 URL |
|
|
342
|
+
| `google_scholar_url` | `str` | 否 | `None` | Google Scholar URL,需为合法 URL |
|
|
343
|
+
| `gender` | `str` | 否 | `None` | 性别 |
|
|
344
|
+
| `expected_salary` | `str` | 否 | `None` | 期望薪资 |
|
|
345
|
+
| `job_preference` | `str` | 否 | `None` | 求职偏好 |
|
|
346
|
+
| `wechat` | `str` | 否 | `None` | 微信号 |
|
|
347
|
+
| `linkedin_url` | `str` | 否 | `None` | LinkedIn URL,需为合法 URL |
|
|
348
|
+
| `maimai_url` | `str` | 否 | `None` | 脉脉 URL,需为合法 URL |
|
|
349
|
+
|
|
350
|
+
**返回值**:`{"data": {...}}`
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
##### `update(talent_id, **kwargs)`
|
|
355
|
+
|
|
356
|
+
更新人才信息。可更新字段与 `create()` 相同(`name` 不再是必填)。至少提供一个字段。
|
|
357
|
+
|
|
358
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
359
|
+
|---|---|---|---|---|
|
|
360
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
361
|
+
| `**kwargs` | — | 是 | — | 至少一个可更新字段(同 `create()` 中的可选参数) |
|
|
362
|
+
|
|
363
|
+
**返回值**:`{"data": {...}}`
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
##### `delete(talent_id)`
|
|
368
|
+
|
|
369
|
+
删除人才及其所有关联子资源。
|
|
370
|
+
|
|
371
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
372
|
+
|---|---|---|---|---|
|
|
373
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
374
|
+
|
|
375
|
+
**返回值**:`{"message": "删除成功"}`
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
#### 关联操作
|
|
380
|
+
|
|
381
|
+
##### `merge(primary_talent_id, merged_talent_id, match_type="manual", match_confidence=1.0)`
|
|
382
|
+
|
|
383
|
+
关联/合并两个人才记录。若已存在关联则返回 409 Conflict。
|
|
384
|
+
|
|
385
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
386
|
+
|---|---|---|---|---|
|
|
387
|
+
| `primary_talent_id` | `int` | 是 | — | 主人才 ID |
|
|
388
|
+
| `merged_talent_id` | `int` | 是 | — | 被合并人才 ID,不能与主人才 ID 相同 |
|
|
389
|
+
| `match_type` | `str` | 否 | `"manual"` | 匹配类型,如 `"manual"`, `"email"`, `"phone"`, `"api"` |
|
|
390
|
+
| `match_confidence` | `float` | 否 | `1.0` | 匹配置信度,范围 0.0–1.0 |
|
|
391
|
+
|
|
392
|
+
**返回值**:`{"data": {"id", "primary_talent_id", "merged_talent_id", "match_type"}}`
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
##### `unmerge(primary_talent_id, merged_talent_id)`
|
|
397
|
+
|
|
398
|
+
取消两个人才之间的关联。
|
|
399
|
+
|
|
400
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
401
|
+
|---|---|---|---|---|
|
|
402
|
+
| `primary_talent_id` | `int` | 是 | — | 主人才 ID |
|
|
403
|
+
| `merged_talent_id` | `int` | 是 | — | 被合并人才 ID |
|
|
404
|
+
|
|
405
|
+
**返回值**:`{"message": "关联已取消"}`
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
#### 统计接口
|
|
410
|
+
|
|
411
|
+
##### `stats_sources()`
|
|
412
|
+
|
|
413
|
+
按数据来源统计人才数量。无参数。
|
|
414
|
+
|
|
415
|
+
**返回值**:`{"data": [{"data_source": "github", "count": 10}, ...]}`
|
|
416
|
+
|
|
417
|
+
##### `stats_import_methods()`
|
|
418
|
+
|
|
419
|
+
按导入方式统计人才数量。无参数。
|
|
420
|
+
|
|
421
|
+
**返回值**:`{"data": [{"import_method": "manual", "count": 5}, ...]}`
|
|
422
|
+
|
|
423
|
+
##### `stats_companies()`
|
|
424
|
+
|
|
425
|
+
按公司统计人才数量(Top 20)。无参数。
|
|
426
|
+
|
|
427
|
+
**返回值**:`{"data": [{"company": "Google", "count": 3}, ...]}`
|
|
428
|
+
|
|
429
|
+
##### `stats_platforms()`
|
|
430
|
+
|
|
431
|
+
按平台档案统计数量。无参数。
|
|
432
|
+
|
|
433
|
+
**返回值**:`{"data": [{"platform": "github", "count": 15}, ...]}`
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
#### 子资源管理
|
|
438
|
+
|
|
439
|
+
> 所有子资源的 `_list` 方法返回 `{"data": [...]}`,`_create` 方法返回 `{"data": {...}}`,`_update` 方法返回 `{"data": {...}}`,`_delete` 方法返回 `{"message": "..."}`。
|
|
440
|
+
|
|
441
|
+
##### 备注(Notes)
|
|
442
|
+
|
|
443
|
+
###### `list_notes(talent_id)`
|
|
444
|
+
|
|
445
|
+
获取指定人才的所有备注。
|
|
446
|
+
|
|
447
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
448
|
+
|---|---|---|---|---|
|
|
449
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
450
|
+
|
|
451
|
+
###### `add_note(talent_id, content)`
|
|
452
|
+
|
|
453
|
+
添加备注。
|
|
454
|
+
|
|
455
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
456
|
+
|---|---|---|---|---|
|
|
457
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
458
|
+
| `content` | `str` | 是 | — | 备注内容 |
|
|
459
|
+
|
|
460
|
+
###### `update_note(talent_id, note_id, content)`
|
|
461
|
+
|
|
462
|
+
更新备注。
|
|
463
|
+
|
|
464
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
465
|
+
|---|---|---|---|---|
|
|
466
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
467
|
+
| `note_id` | `int` | 是 | — | 备注 ID |
|
|
468
|
+
| `content` | `str` | 是 | — | 新备注内容 |
|
|
469
|
+
|
|
470
|
+
###### `delete_note(talent_id, note_id)`
|
|
471
|
+
|
|
472
|
+
删除备注。
|
|
473
|
+
|
|
474
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
475
|
+
|---|---|---|---|---|
|
|
476
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
477
|
+
| `note_id` | `int` | 是 | — | 备注 ID |
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
##### 平台档案(Profiles)
|
|
482
|
+
|
|
483
|
+
###### `create_profile(talent_id, platform, **kwargs)`
|
|
484
|
+
|
|
485
|
+
添加平台档案。
|
|
486
|
+
|
|
487
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
488
|
+
|---|---|---|---|---|
|
|
489
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
490
|
+
| `platform` | `str` | 是 | — | 平台名称,如 `"github"`, `"linkedin"`, `"maimai"`, `"wechat"`, `"arxiv"`, `"patent"`, `"conference"` |
|
|
491
|
+
| `platform_id` | `str` | 否 | `None` | 平台用户 ID |
|
|
492
|
+
| `platform_url` | `str` | 否 | `None` | 平台主页 URL,需为合法 URL |
|
|
493
|
+
| `username` | `str` | 否 | `None` | 平台用户名 |
|
|
494
|
+
| `display_name` | `str` | 否 | `None` | 显示名称 |
|
|
495
|
+
| `avatar_url` | `str` | 否 | `None` | 头像 URL,需为合法 URL |
|
|
496
|
+
| `bio` | `str` | 否 | `None` | 个人简介 |
|
|
497
|
+
| `company` | `str` | 否 | `None` | 公司 |
|
|
498
|
+
| `location` | `str` | 否 | `None` | 所在地 |
|
|
499
|
+
| `email` | `str` | 否 | `None` | 邮箱 |
|
|
500
|
+
| `title` | `str` | 否 | `None` | 职位 |
|
|
501
|
+
| `raw_data` | `str` | 否 | `None` | 原始数据(JSON 字符串) |
|
|
502
|
+
|
|
503
|
+
###### `update_profile(talent_id, profile_id, **kwargs)`
|
|
504
|
+
|
|
505
|
+
更新平台档案。可更新字段同 `create_profile()` 中的可选参数(含 `platform`)。至少提供一个字段。
|
|
506
|
+
|
|
507
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
508
|
+
|---|---|---|---|---|
|
|
509
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
510
|
+
| `profile_id` | `int` | 是 | — | 档案 ID |
|
|
511
|
+
| `**kwargs` | — | 是 | — | 至少一个可更新字段 |
|
|
512
|
+
|
|
513
|
+
###### `delete_profile(talent_id, profile_id)`
|
|
514
|
+
|
|
515
|
+
删除平台档案。
|
|
516
|
+
|
|
517
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
518
|
+
|---|---|---|---|---|
|
|
519
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
520
|
+
| `profile_id` | `int` | 是 | — | 档案 ID |
|
|
521
|
+
|
|
522
|
+
---
|
|
523
|
+
|
|
524
|
+
##### 工作经历(Experiences)
|
|
525
|
+
|
|
526
|
+
###### `list_experiences(talent_id)`
|
|
527
|
+
|
|
528
|
+
获取指定人才的所有工作经历。
|
|
529
|
+
|
|
530
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
531
|
+
|---|---|---|---|---|
|
|
532
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
533
|
+
|
|
534
|
+
###### `add_experience(talent_id, **kwargs)`
|
|
535
|
+
|
|
536
|
+
添加工作经历。
|
|
537
|
+
|
|
538
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
539
|
+
|---|---|---|---|---|
|
|
540
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
541
|
+
| `company` | `str` | 否 | `None` | 公司名称 |
|
|
542
|
+
| `title` | `str` | 否 | `None` | 职位 |
|
|
543
|
+
| `start_date` | `str` | 否 | `None` | 开始日期,格式 `YYYY-MM` 或 `YYYY-MM-DD` |
|
|
544
|
+
| `end_date` | `str` | 否 | `None` | 结束日期,格式 `YYYY-MM` 或 `YYYY-MM-DD`;在职中可不填 |
|
|
545
|
+
| `duration` | `str` | 否 | `None` | 在职时长描述,如 `"2年3个月"` |
|
|
546
|
+
| `location` | `str` | 否 | `None` | 工作地点 |
|
|
547
|
+
| `responsibilities` | `str` | 否 | `None` | 职责描述 |
|
|
548
|
+
| `achievements` | `str` | 否 | `None` | 业绩描述 |
|
|
549
|
+
| `is_current` | `int` | 否 | `0` | 是否在职:`0` 否 / `1` 是 |
|
|
550
|
+
| `description` | `str` | 否 | `None` | 工作描述 |
|
|
551
|
+
| `company_details` | `str` | 否 | `None` | 公司详情(JSON 字符串) |
|
|
552
|
+
| `data_source` | `str` | 否 | `"manual"` | 数据来源 |
|
|
553
|
+
| `sort_order` | `int` | 否 | `0` | 排序序号 |
|
|
554
|
+
|
|
555
|
+
###### `update_experience(talent_id, exp_id, **kwargs)`
|
|
556
|
+
|
|
557
|
+
更新工作经历。可更新字段同 `add_experience()` 中的可选参数。至少提供一个字段。
|
|
558
|
+
|
|
559
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
560
|
+
|---|---|---|---|---|
|
|
561
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
562
|
+
| `exp_id` | `int` | 是 | — | 经历 ID |
|
|
563
|
+
| `**kwargs` | — | 是 | — | 至少一个可更新字段 |
|
|
564
|
+
|
|
565
|
+
###### `delete_experience(talent_id, exp_id)`
|
|
566
|
+
|
|
567
|
+
删除工作经历。
|
|
568
|
+
|
|
569
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
570
|
+
|---|---|---|---|---|
|
|
571
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
572
|
+
| `exp_id` | `int` | 是 | — | 经历 ID |
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
##### 教育经历(Educations)
|
|
577
|
+
|
|
578
|
+
###### `list_educations(talent_id)`
|
|
579
|
+
|
|
580
|
+
获取指定人才的所有教育经历。
|
|
581
|
+
|
|
582
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
583
|
+
|---|---|---|---|---|
|
|
584
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
585
|
+
|
|
586
|
+
###### `add_education(talent_id, **kwargs)`
|
|
587
|
+
|
|
588
|
+
添加教育经历。
|
|
589
|
+
|
|
590
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
591
|
+
|---|---|---|---|---|
|
|
592
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
593
|
+
| `school` | `str` | 否 | `None` | 学校名称 |
|
|
594
|
+
| `degree` | `str` | 否 | `None` | 学位/学历,如 `"本科"`, `"硕士"`, `"博士"` |
|
|
595
|
+
| `field` | `str` | 否 | `None` | 专业方向 |
|
|
596
|
+
| `start_date` | `str` | 否 | `None` | 开始日期,格式 `YYYY-MM` 或 `YYYY-MM-DD` |
|
|
597
|
+
| `end_date` | `str` | 否 | `None` | 结束日期,格式 `YYYY-MM` 或 `YYYY-MM-DD` |
|
|
598
|
+
| `dates` | `str` | 否 | `None` | 日期描述(替代 start/end_date),如 `"2018-2022"` |
|
|
599
|
+
| `location` | `str` | 否 | `None` | 学校所在地 |
|
|
600
|
+
| `ranking_info` | `str` | 否 | `None` | 排名信息(JSON 字符串) |
|
|
601
|
+
| `description` | `str` | 否 | `None` | 描述 |
|
|
602
|
+
| `data_source` | `str` | 否 | `"manual"` | 数据来源 |
|
|
603
|
+
| `sort_order` | `int` | 否 | `0` | 排序序号 |
|
|
604
|
+
|
|
605
|
+
###### `update_education(talent_id, edu_id, **kwargs)`
|
|
606
|
+
|
|
607
|
+
更新教育经历。可更新字段同 `add_education()` 中的可选参数。至少提供一个字段。
|
|
608
|
+
|
|
609
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
610
|
+
|---|---|---|---|---|
|
|
611
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
612
|
+
| `edu_id` | `int` | 是 | — | 教育经历 ID |
|
|
613
|
+
| `**kwargs` | — | 是 | — | 至少一个可更新字段 |
|
|
614
|
+
|
|
615
|
+
###### `delete_education(talent_id, edu_id)`
|
|
616
|
+
|
|
617
|
+
删除教育经历。
|
|
618
|
+
|
|
619
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
620
|
+
|---|---|---|---|---|
|
|
621
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
622
|
+
| `edu_id` | `int` | 是 | — | 教育经历 ID |
|
|
623
|
+
|
|
624
|
+
---
|
|
625
|
+
|
|
626
|
+
##### 跟盯记录(Followups)
|
|
627
|
+
|
|
628
|
+
###### `list_followups(talent_id)`
|
|
629
|
+
|
|
630
|
+
获取指定人才的所有跟盯记录。
|
|
631
|
+
|
|
632
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
633
|
+
|---|---|---|---|---|
|
|
634
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
635
|
+
|
|
636
|
+
###### `add_followup(talent_id, content, **kwargs)`
|
|
637
|
+
|
|
638
|
+
添加跟盯记录。
|
|
639
|
+
|
|
640
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
641
|
+
|---|---|---|---|---|
|
|
642
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
643
|
+
| `content` | `str` | 是 | — | 跟盯内容 |
|
|
644
|
+
| `type` | `str` | 否 | `"note"` | 记录类型,如 `"note"`, `"call"`, `"email"`, `"meeting"`, `"offer"` |
|
|
645
|
+
| `next_action` | `str` | 否 | `None` | 下一步行动 |
|
|
646
|
+
| `next_date` | `str` | 否 | `None` | 下次行动日期,格式 `YYYY-MM-DD` |
|
|
647
|
+
|
|
648
|
+
###### `update_followup(talent_id, fid, **kwargs)`
|
|
649
|
+
|
|
650
|
+
更新跟盯记录。可更新字段:`type`, `content`, `next_action`, `next_date`。至少提供一个字段。
|
|
651
|
+
|
|
652
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
653
|
+
|---|---|---|---|---|
|
|
654
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
655
|
+
| `fid` | `int` | 是 | — | 跟盯记录 ID |
|
|
656
|
+
| `**kwargs` | — | 是 | — | 至少一个可更新字段 |
|
|
657
|
+
|
|
658
|
+
###### `delete_followup(talent_id, fid)`
|
|
659
|
+
|
|
660
|
+
删除跟盯记录。
|
|
661
|
+
|
|
662
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
663
|
+
|---|---|---|---|---|
|
|
664
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
665
|
+
| `fid` | `int` | 是 | — | 跟盯记录 ID |
|
|
666
|
+
|
|
667
|
+
---
|
|
668
|
+
|
|
669
|
+
##### 论文(Papers)
|
|
670
|
+
|
|
671
|
+
###### `list_papers(talent_id)`
|
|
672
|
+
|
|
673
|
+
获取指定人才的所有论文。
|
|
674
|
+
|
|
675
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
676
|
+
|---|---|---|---|---|
|
|
677
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
678
|
+
|
|
679
|
+
###### `add_paper(talent_id, title, **kwargs)`
|
|
680
|
+
|
|
681
|
+
添加论文。
|
|
682
|
+
|
|
683
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
684
|
+
|---|---|---|---|---|
|
|
685
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
686
|
+
| `title` | `str` | 是 | — | 论文标题 |
|
|
687
|
+
| `authors` | `str` | 否 | `None` | 作者列表,逗号分隔 `"Author1, Author2"` |
|
|
688
|
+
| `abstract` | `str` | 否 | `None` | 摘要 |
|
|
689
|
+
| `venue` | `str` | 否 | `None` | 发表期刊/会议,如 `"NeurIPS"`, `"Nature"` |
|
|
690
|
+
| `year` | `int` | 否 | `None` | 发表年份,如 `2024` |
|
|
691
|
+
| `doi` | `str` | 否 | `None` | DOI 编号,如 `"10.1000/xyz123"` |
|
|
692
|
+
| `arxiv_id` | `str` | 否 | `None` | arXiv ID,如 `"2301.12345"` |
|
|
693
|
+
| `pdf_url` | `str` | 否 | `None` | PDF 链接 URL,需为合法 URL |
|
|
694
|
+
| `categories` | `str` | 否 | `None` | 分类,逗号分隔 `"cs.AI,cs.CL"` |
|
|
695
|
+
| `citation_count` | `int` | 否 | `0` | 引用次数,非负整数 |
|
|
696
|
+
| `data_source` | `str` | 否 | `"manual"` | 数据来源 |
|
|
697
|
+
| `sort_order` | `int` | 否 | `0` | 排序序号 |
|
|
698
|
+
|
|
699
|
+
###### `update_paper(talent_id, paper_id, **kwargs)`
|
|
700
|
+
|
|
701
|
+
更新论文。可更新字段同 `add_paper()` 中的可选参数(含 `title`)。至少提供一个字段。
|
|
702
|
+
|
|
703
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
704
|
+
|---|---|---|---|---|
|
|
705
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
706
|
+
| `paper_id` | `int` | 是 | — | 论文 ID |
|
|
707
|
+
| `**kwargs` | — | 是 | — | 至少一个可更新字段 |
|
|
708
|
+
|
|
709
|
+
###### `delete_paper(talent_id, paper_id)`
|
|
710
|
+
|
|
711
|
+
删除论文。
|
|
712
|
+
|
|
713
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
714
|
+
|---|---|---|---|---|
|
|
715
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
716
|
+
| `paper_id` | `int` | 是 | — | 论文 ID |
|
|
717
|
+
|
|
718
|
+
---
|
|
719
|
+
|
|
720
|
+
##### 专利(Patents)
|
|
721
|
+
|
|
722
|
+
###### `list_patents(talent_id)`
|
|
723
|
+
|
|
724
|
+
获取指定人才的所有专利。
|
|
725
|
+
|
|
726
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
727
|
+
|---|---|---|---|---|
|
|
728
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
729
|
+
|
|
730
|
+
###### `add_patent(talent_id, title, **kwargs)`
|
|
731
|
+
|
|
732
|
+
添加专利。
|
|
733
|
+
|
|
734
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
735
|
+
|---|---|---|---|---|
|
|
736
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
737
|
+
| `title` | `str` | 是 | — | 专利标题 |
|
|
738
|
+
| `patent_number` | `str` | 否 | `None` | 专利号,如 `"CN202310001234.5"` |
|
|
739
|
+
| `patent_type` | `str` | 否 | `None` | 专利类型,如 `"发明专利"`, `"实用新型"`, `"外观设计"` |
|
|
740
|
+
| `status` | `str` | 否 | `None` | 状态,如 `"已授权"`, `"申请中"`, `"已公开"` |
|
|
741
|
+
| `filing_date` | `str` | 否 | `None` | 申请日期,格式 `YYYY-MM-DD` |
|
|
742
|
+
| `grant_date` | `str` | 否 | `None` | 授权日期,格式 `YYYY-MM-DD` |
|
|
743
|
+
| `inventors` | `str` | 否 | `None` | 发明人列表,逗号分隔 `"Inventor1, Inventor2"` |
|
|
744
|
+
| `assignee` | `str` | 否 | `None` | 专利权人/受让人 |
|
|
745
|
+
| `abstract` | `str` | 否 | `None` | 专利摘要 |
|
|
746
|
+
| `data_source` | `str` | 否 | `"manual"` | 数据来源 |
|
|
747
|
+
| `sort_order` | `int` | 否 | `0` | 排序序号 |
|
|
748
|
+
|
|
749
|
+
###### `update_patent(talent_id, patent_id, **kwargs)`
|
|
750
|
+
|
|
751
|
+
更新专利。可更新字段同 `add_patent()` 中的可选参数(含 `title`)。至少提供一个字段。
|
|
752
|
+
|
|
753
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
754
|
+
|---|---|---|---|---|
|
|
755
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
756
|
+
| `patent_id` | `int` | 是 | — | 专利 ID |
|
|
757
|
+
| `**kwargs` | — | 是 | — | 至少一个可更新字段 |
|
|
758
|
+
|
|
759
|
+
###### `delete_patent(talent_id, patent_id)`
|
|
760
|
+
|
|
761
|
+
删除专利。
|
|
762
|
+
|
|
763
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
764
|
+
|---|---|---|---|---|
|
|
765
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
766
|
+
| `patent_id` | `int` | 是 | — | 专利 ID |
|
|
767
|
+
|
|
768
|
+
---
|
|
769
|
+
|
|
770
|
+
##### 行业会议(Conferences)
|
|
771
|
+
|
|
772
|
+
###### `list_conferences(talent_id)`
|
|
773
|
+
|
|
774
|
+
获取指定人才的所有会议记录。
|
|
775
|
+
|
|
776
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
777
|
+
|---|---|---|---|---|
|
|
778
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
779
|
+
|
|
780
|
+
###### `add_conference(talent_id, conference_name, **kwargs)`
|
|
781
|
+
|
|
782
|
+
添加会议记录。
|
|
783
|
+
|
|
784
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
785
|
+
|---|---|---|---|---|
|
|
786
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
787
|
+
| `conference_name` | `str` | 是 | — | 会议名称,如 `"NeurIPS 2024"` |
|
|
788
|
+
| `role` | `str` | 否 | `None` | 参会角色,如 `"Speaker"`, `"Attendee"`, `"Organizer"` |
|
|
789
|
+
| `title` | `str` | 否 | `None` | 演讲/报告标题 |
|
|
790
|
+
| `year` | `int` | 否 | `None` | 年份,如 `2024` |
|
|
791
|
+
| `location` | `str` | 否 | `None` | 会议地点 |
|
|
792
|
+
| `url` | `str` | 否 | `None` | 会议官网 URL,需为合法 URL |
|
|
793
|
+
| `data_source` | `str` | 否 | `"manual"` | 数据来源 |
|
|
794
|
+
| `sort_order` | `int` | 否 | `0` | 排序序号 |
|
|
795
|
+
|
|
796
|
+
###### `update_conference(talent_id, conf_id, **kwargs)`
|
|
797
|
+
|
|
798
|
+
更新会议记录。可更新字段同 `add_conference()` 中的可选参数(含 `conference_name`)。至少提供一个字段。
|
|
799
|
+
|
|
800
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
801
|
+
|---|---|---|---|---|
|
|
802
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
803
|
+
| `conf_id` | `int` | 是 | — | 会议记录 ID |
|
|
804
|
+
| `**kwargs` | — | 是 | — | 至少一个可更新字段 |
|
|
805
|
+
|
|
806
|
+
###### `delete_conference(talent_id, conf_id)`
|
|
807
|
+
|
|
808
|
+
删除会议记录。
|
|
809
|
+
|
|
810
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
811
|
+
|---|---|---|---|---|
|
|
812
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
813
|
+
| `conf_id` | `int` | 是 | — | 会议记录 ID |
|
|
814
|
+
|
|
815
|
+
---
|
|
816
|
+
|
|
817
|
+
##### GitHub 项目(Repos)
|
|
818
|
+
|
|
819
|
+
###### `list_repos(talent_id)`
|
|
820
|
+
|
|
821
|
+
获取指定人才的所有 GitHub 项目。
|
|
822
|
+
|
|
823
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
824
|
+
|---|---|---|---|---|
|
|
825
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
826
|
+
|
|
827
|
+
###### `add_repo(talent_id, repo_name, **kwargs)`
|
|
828
|
+
|
|
829
|
+
添加 GitHub 项目。
|
|
830
|
+
|
|
831
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
832
|
+
|---|---|---|---|---|
|
|
833
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
834
|
+
| `repo_name` | `str` | 是 | — | 仓库名称,如 `"transformer"` |
|
|
835
|
+
| `full_name` | `str` | 否 | `None` | 完整仓库名,如 `"user/transformer"` |
|
|
836
|
+
| `description` | `str` | 否 | `None` | 项目描述 |
|
|
837
|
+
| `url` | `str` | 否 | `None` | 仓库 URL,需为合法 URL |
|
|
838
|
+
| `language` | `str` | 否 | `None` | 主要编程语言,如 `"Python"`, `"JavaScript"` |
|
|
839
|
+
| `stars` | `int` | 否 | `0` | Star 数,非负整数 |
|
|
840
|
+
| `forks` | `int` | 否 | `0` | Fork 数,非负整数 |
|
|
841
|
+
| `open_issues` | `int` | 否 | `0` | 开放 Issue 数,非负整数 |
|
|
842
|
+
| `is_fork` | `int` | 否 | `0` | 是否为 Fork:`0` 否 / `1` 是 |
|
|
843
|
+
| `topics` | `str` | 否 | `None` | 项目标签,逗号分隔 `"ai,nlp,transformer"` |
|
|
844
|
+
| `license` | `str` | 否 | `None` | 开源协议,如 `"MIT"`, `"Apache-2.0"` |
|
|
845
|
+
| `last_pushed_at` | `str` | 否 | `None` | 最后推送时间,格式 `YYYY-MM-DD` 或 ISO 8601 |
|
|
846
|
+
| `data_source` | `str` | 否 | `"manual"` | 数据来源 |
|
|
847
|
+
| `sort_order` | `int` | 否 | `0` | 排序序号 |
|
|
848
|
+
|
|
849
|
+
###### `update_repo(talent_id, repo_id, **kwargs)`
|
|
850
|
+
|
|
851
|
+
更新 GitHub 项目。可更新字段同 `add_repo()` 中的可选参数(含 `repo_name`)。至少提供一个字段。
|
|
852
|
+
|
|
853
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
854
|
+
|---|---|---|---|---|
|
|
855
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
856
|
+
| `repo_id` | `int` | 是 | — | 项目 ID |
|
|
857
|
+
| `**kwargs` | — | 是 | — | 至少一个可更新字段 |
|
|
858
|
+
|
|
859
|
+
###### `delete_repo(talent_id, repo_id)`
|
|
860
|
+
|
|
861
|
+
删除 GitHub 项目。
|
|
862
|
+
|
|
863
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
864
|
+
|---|---|---|---|---|
|
|
865
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
866
|
+
| `repo_id` | `int` | 是 | — | 项目 ID |
|
|
867
|
+
|
|
868
|
+
---
|
|
869
|
+
|
|
870
|
+
### AdminAPI — 管理员接口
|
|
871
|
+
|
|
872
|
+
管理员接口,路由前缀 `/api/admin`,所有方法均需 **JWT 认证 + admin 角色**。
|
|
873
|
+
|
|
874
|
+
#### `dashboard()`
|
|
875
|
+
|
|
876
|
+
获取系统概览统计。无参数。
|
|
877
|
+
|
|
878
|
+
**返回值**:`{"data": {"totalUsers", "totalTalents", "totalNotes", "totalApiKeys", "totalProfiles", "totalMerges", "sourceStats", "importMethodStats", "platformStats", "recentTalents", "recentUsers"}}`
|
|
879
|
+
|
|
880
|
+
---
|
|
881
|
+
|
|
882
|
+
#### `list_users()`
|
|
883
|
+
|
|
884
|
+
获取所有用户列表。无参数。
|
|
885
|
+
|
|
886
|
+
**返回值**:`{"data": [{"id", "username", "email", "role", "created_at", "updated_at"}, ...]}`
|
|
887
|
+
|
|
888
|
+
---
|
|
889
|
+
|
|
890
|
+
#### `update_user_role(user_id, role)`
|
|
891
|
+
|
|
892
|
+
修改用户角色。
|
|
893
|
+
|
|
894
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
895
|
+
|---|---|---|---|---|
|
|
896
|
+
| `user_id` | `int` | 是 | — | 用户 ID |
|
|
897
|
+
| `role` | `str` | 是 | — | 角色枚举:`admin` / `user` / `viewer` |
|
|
898
|
+
|
|
899
|
+
**返回值**:`{"message": "角色更新成功"}`
|
|
900
|
+
|
|
901
|
+
---
|
|
902
|
+
|
|
903
|
+
#### `delete_user(user_id)`
|
|
904
|
+
|
|
905
|
+
删除用户(不能删除自己)。
|
|
906
|
+
|
|
907
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
908
|
+
|---|---|---|---|---|
|
|
909
|
+
| `user_id` | `int` | 是 | — | 用户 ID,不能是当前登录用户的 ID |
|
|
910
|
+
|
|
911
|
+
**返回值**:`{"message": "用户删除成功"}`
|
|
912
|
+
|
|
913
|
+
---
|
|
914
|
+
|
|
915
|
+
#### `create_api_key(name="Default Key", permissions="read")`
|
|
916
|
+
|
|
917
|
+
创建 API 密钥。**密钥值仅在创建时返回一次**。
|
|
918
|
+
|
|
919
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
920
|
+
|---|---|---|---|---|
|
|
921
|
+
| `name` | `str` | 否 | `"Default Key"` | 密钥名称/用途描述 |
|
|
922
|
+
| `permissions` | `str` | 否 | `"read"` | 权限,逗号分隔,如 `"read"`, `"read,write"` |
|
|
923
|
+
|
|
924
|
+
**返回值**:`{"data": {"id", "name", "key", "permissions"}}`
|
|
925
|
+
|
|
926
|
+
---
|
|
927
|
+
|
|
928
|
+
#### `list_api_keys()`
|
|
929
|
+
|
|
930
|
+
获取 API 密钥列表(不含密钥值)。无参数。
|
|
931
|
+
|
|
932
|
+
**返回值**:`{"data": [{"id", "name", "permissions", "last_used_at", "created_at"}, ...]}`
|
|
933
|
+
|
|
934
|
+
---
|
|
935
|
+
|
|
936
|
+
#### `delete_api_key(key_id)`
|
|
937
|
+
|
|
938
|
+
删除 API 密钥。
|
|
939
|
+
|
|
940
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
941
|
+
|---|---|---|---|---|
|
|
942
|
+
| `key_id` | `int` | 是 | — | 密钥 ID |
|
|
943
|
+
|
|
944
|
+
**返回值**:`{"message": "API密钥删除成功"}`
|
|
945
|
+
|
|
946
|
+
---
|
|
947
|
+
|
|
948
|
+
### OpenAPI — 开放接口
|
|
949
|
+
|
|
950
|
+
开放接口,路由前缀 `/api/open`,所有方法均需 **API Key 认证**(通过 `X-API-Key` 请求头传递)。
|
|
951
|
+
|
|
952
|
+
#### 通用人才操作
|
|
953
|
+
|
|
954
|
+
##### `list_talents(**kwargs)`
|
|
955
|
+
|
|
956
|
+
获取人才列表(简化版,无分页包装)。
|
|
957
|
+
|
|
958
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
959
|
+
|---|---|---|---|---|
|
|
960
|
+
| `search` | `str` | 否 | — | 全局模糊搜索(匹配 name/email/company/skills) |
|
|
961
|
+
| `data_source` | `str` | 否 | — | 数据来源精确匹配 |
|
|
962
|
+
| `import_method` | `str` | 否 | — | 导入方式精确匹配 |
|
|
963
|
+
| `limit` | `int` | 否 | `100` | 返回条数上限 |
|
|
964
|
+
| `offset` | `int` | 否 | `0` | 偏移量,用于翻页 |
|
|
965
|
+
|
|
966
|
+
**返回值**:`{"data": [...]}`
|
|
967
|
+
|
|
968
|
+
---
|
|
969
|
+
|
|
970
|
+
##### `get_talent(talent_id)`
|
|
971
|
+
|
|
972
|
+
获取单个人才详情 + profiles。
|
|
973
|
+
|
|
974
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
975
|
+
|---|---|---|---|---|
|
|
976
|
+
| `talent_id` | `int` | 是 | — | 人才 ID |
|
|
977
|
+
|
|
978
|
+
**返回值**:`{"data": {...}, "profiles": [...]}`
|
|
979
|
+
|
|
980
|
+
---
|
|
981
|
+
|
|
982
|
+
##### `create_talent(name, **kwargs)`
|
|
983
|
+
|
|
984
|
+
创建人才。
|
|
985
|
+
|
|
986
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
987
|
+
|---|---|---|---|---|
|
|
988
|
+
| `name` | `str` | 是 | — | 姓名 |
|
|
989
|
+
| `email` | `str` | 否 | `None` | 邮箱 |
|
|
990
|
+
| `phone` | `str` | 否 | `None` | 手机号 |
|
|
991
|
+
| `company` | `str` | 否 | `None` | 公司 |
|
|
992
|
+
| `title` | `str` | 否 | `None` | 职位 |
|
|
993
|
+
| `location` | `str` | 否 | `None` | 所在地 |
|
|
994
|
+
| `skills` | `str` | 否 | `None` | 技能,逗号分隔 `"Python,ML"` |
|
|
995
|
+
| `education` | `str` | 否 | `None` | 学历 |
|
|
996
|
+
| `experience_years` | `int` | 否 | `None` | 工作年限,非负整数 |
|
|
997
|
+
| `summary` | `str` | 否 | `None` | 简介 |
|
|
998
|
+
| `data_source` | `str` | 否 | `"api"` | 数据来源 |
|
|
999
|
+
| `import_method` | `str` | 否 | `"api"` | 导入方式 |
|
|
1000
|
+
| `tags` | `str` | 否 | `None` | 标签,逗号分隔 |
|
|
1001
|
+
| `rating` | `int` | 否 | `0` | 评分,范围 0–5 |
|
|
1002
|
+
| `status` | `str` | 否 | `"active"` | 状态:`active` / `inactive` / `archived` |
|
|
1003
|
+
| `avatar_url` | `str` | 否 | `None` | 头像 URL |
|
|
1004
|
+
| `raw_data` | `str` | 否 | `None` | 原始数据(JSON 字符串) |
|
|
1005
|
+
|
|
1006
|
+
**返回值**:`{"data": {...}}`
|
|
1007
|
+
|
|
1008
|
+
---
|
|
1009
|
+
|
|
1010
|
+
#### 平台导入
|
|
1011
|
+
|
|
1012
|
+
##### `import_github(data)`
|
|
1013
|
+
|
|
1014
|
+
GitHub 单条导入。
|
|
1015
|
+
|
|
1016
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
1017
|
+
|---|---|---|---|---|
|
|
1018
|
+
| `data` | `dict` | 是 | — | GitHub 用户数据。需包含 `login` 或 `name` 至少一个。可选字段:`login`, `name`, `id`, `company`, `location`, `email`, `bio`, `avatar_url`, `html_url` |
|
|
1019
|
+
|
|
1020
|
+
**返回值**:`{"data": {...}}`
|
|
1021
|
+
|
|
1022
|
+
---
|
|
1023
|
+
|
|
1024
|
+
##### `import_github_batch(users)`
|
|
1025
|
+
|
|
1026
|
+
GitHub 批量导入。
|
|
1027
|
+
|
|
1028
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
1029
|
+
|---|---|---|---|---|
|
|
1030
|
+
| `users` | `list[dict]` | 是 | — | GitHub 用户列表,每个元素需含 `login` 或 `name`。字段同 `import_github()` |
|
|
1031
|
+
|
|
1032
|
+
**返回值**:`{"data": {"imported": int, "errors": [...]}}`
|
|
1033
|
+
|
|
1034
|
+
---
|
|
1035
|
+
|
|
1036
|
+
##### `import_maimai(data)`
|
|
1037
|
+
|
|
1038
|
+
脉脉单条导入。支持两种格式:
|
|
1039
|
+
- **详细格式**:含 `basic_info` 对象(字段:`name`, `current_company`, `current_position`, `location`, `tags`, `education_level`, `total_work_experience_years`, `gender`, `expected_salary`, `job_preference`, `major`)+ 可选 `work_history` 数组 + 可选 `education_history` 数组 + `links` 对象 + `profile_id`
|
|
1040
|
+
- **简略格式**:含 `name`, `company`, `position`, `province`, `city`, `avatar`, `detail_url`, `sdegree`, `school`, `worktime`, `salary`, `tag_list`
|
|
1041
|
+
|
|
1042
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
1043
|
+
|---|---|---|---|---|
|
|
1044
|
+
| `data` | `dict` | 是 | — | 脉脉用户数据,详细格式需含 `basic_info.name`;简略格式需含 `name` |
|
|
1045
|
+
|
|
1046
|
+
**返回值**:`{"data": {...}}`
|
|
1047
|
+
|
|
1048
|
+
---
|
|
1049
|
+
|
|
1050
|
+
##### `import_maimai_batch(users)`
|
|
1051
|
+
|
|
1052
|
+
脉脉批量导入(使用简略格式)。
|
|
1053
|
+
|
|
1054
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
1055
|
+
|---|---|---|---|---|
|
|
1056
|
+
| `users` | `list[dict]` | 是 | — | 脉脉用户列表,每个元素需含 `name`。字段同简略格式 |
|
|
1057
|
+
|
|
1058
|
+
**返回值**:`{"data": {"imported": int, "errors": [...]}}`
|
|
1059
|
+
|
|
1060
|
+
---
|
|
1061
|
+
|
|
1062
|
+
##### `import_linkedin(data)`
|
|
1063
|
+
|
|
1064
|
+
LinkedIn 导入。支持两种格式:
|
|
1065
|
+
- **完整简历格式**:含 `name` + `experience` 数组 + `education` 数组 + 可选 `skills`、`open_to_work`、`suitable_job_roles`、`homepage`、`github`、`google_scholar`、`linkedin`、`bio_summary`
|
|
1066
|
+
- **简略文本格式**:含 `name` 或 `raw_text` + 可选 `email`、`company`、`title`、`location`、`linkedin_url`
|
|
1067
|
+
|
|
1068
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
1069
|
+
|---|---|---|---|---|
|
|
1070
|
+
| `data` | `dict` | 是 | — | LinkedIn 用户数据。完整格式需含 `name` 且同时含 `experience`/`education` 或 `company`/`title`/`location`;简略格式需含 `name` 或 `raw_text` |
|
|
1071
|
+
|
|
1072
|
+
**返回值**:`{"data": {...}}`
|
|
1073
|
+
|
|
1074
|
+
---
|
|
1075
|
+
|
|
1076
|
+
##### `import_wechat(data)`
|
|
1077
|
+
|
|
1078
|
+
微信单条导入。
|
|
1079
|
+
|
|
1080
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
1081
|
+
|---|---|---|---|---|
|
|
1082
|
+
| `data` | `dict` | 是 | — | 微信用户数据。需含 `name` 或 `nickname` 至少一个。可选字段:`wechat_id`/`wechat`/`username`, `company`, `title`/`position`, `location`/`city`, `phone`, `email`, `avatar_url`/`head_img_url`, `tags`, `profile_url` |
|
|
1083
|
+
|
|
1084
|
+
**返回值**:`{"data": {...}}`
|
|
1085
|
+
|
|
1086
|
+
---
|
|
1087
|
+
|
|
1088
|
+
##### `import_wechat_batch(contacts)`
|
|
1089
|
+
|
|
1090
|
+
微信批量导入。
|
|
1091
|
+
|
|
1092
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
1093
|
+
|---|---|---|---|---|
|
|
1094
|
+
| `contacts` | `list[dict]` | 是 | — | 微信联系人数组,每个元素需含 `name` 或 `nickname`。字段同 `import_wechat()` |
|
|
1095
|
+
|
|
1096
|
+
**返回值**:`{"data": {"imported": int, "errors": [...]}}`
|
|
1097
|
+
|
|
1098
|
+
---
|
|
1099
|
+
|
|
1100
|
+
##### `import_arxiv(data)`
|
|
1101
|
+
|
|
1102
|
+
arXiv 论文作者导入。
|
|
1103
|
+
|
|
1104
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
1105
|
+
|---|---|---|---|---|
|
|
1106
|
+
| `data` | `dict` | 是 | — | 作者数据。需含 `name`(作者姓名)。可选字段:`email`, `affiliation`/`institution`, `categories`(逗号或数组), `homepage`, `google_scholar`, `arxiv_profile_url`, `papers`(论文数组,每个含 `title`, `authors`, `abstract`/`summary`, `venue`/`journal`, `year`/`published_year`, `doi`, `arxiv_id`/`id`, `pdf_url`, `categories`, `citation_count`) |
|
|
1107
|
+
|
|
1108
|
+
**返回值**:`{"data": {...}}`
|
|
1109
|
+
|
|
1110
|
+
---
|
|
1111
|
+
|
|
1112
|
+
##### `import_patent(data)`
|
|
1113
|
+
|
|
1114
|
+
专利导入。
|
|
1115
|
+
|
|
1116
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
1117
|
+
|---|---|---|---|---|
|
|
1118
|
+
| `data` | `dict` | 是 | — | 发明人数据。需含 `name`。可选字段:`company`/`assignee`, `patents`(专利数组,每个含 `title`, `patent_number`/`number`, `patent_type`/`type`, `status`, `filing_date`, `grant_date`, `inventors`, `assignee`, `abstract`) |
|
|
1119
|
+
|
|
1120
|
+
**返回值**:`{"data": {...}}`
|
|
1121
|
+
|
|
1122
|
+
---
|
|
1123
|
+
|
|
1124
|
+
##### `import_conference(data)`
|
|
1125
|
+
|
|
1126
|
+
行业会议导入。
|
|
1127
|
+
|
|
1128
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
1129
|
+
|---|---|---|---|---|
|
|
1130
|
+
| `data` | `dict` | 是 | — | 参会人数据。需含 `name`。可选字段:`company`/`affiliation`, `title`, `email`, `conferences`(会议数组,每个含 `conference_name`/`name`, `role`, `title`, `year`, `location`, `url`) |
|
|
1131
|
+
|
|
1132
|
+
**返回值**:`{"data": {...}}`
|
|
1133
|
+
|
|
1134
|
+
---
|
|
1135
|
+
|
|
1136
|
+
#### CSV / 批量操作
|
|
1137
|
+
|
|
1138
|
+
##### `import_csv(file_path)`
|
|
1139
|
+
|
|
1140
|
+
CSV 文件上传导入(`multipart/form-data`)。CSV 文件需含 `name` 列(表头),可选列:`email`, `phone`, `company`, `title`, `location`, `skills`, `education`, `experience_years`, `summary`, `data_source`, `tags`, `rating`, `status`。
|
|
1141
|
+
|
|
1142
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
1143
|
+
|---|---|---|---|---|
|
|
1144
|
+
| `file_path` | `str` | 是 | — | 本地 CSV 文件路径,文件大小不超过 10MB |
|
|
1145
|
+
|
|
1146
|
+
**返回值**:`{"data": {"imported": int, "errors": [...]}}`
|
|
1147
|
+
|
|
1148
|
+
---
|
|
1149
|
+
|
|
1150
|
+
##### `export_csv()`
|
|
1151
|
+
|
|
1152
|
+
导出所有人才数据为 CSV 文件。
|
|
1153
|
+
|
|
1154
|
+
无参数。
|
|
1155
|
+
|
|
1156
|
+
**返回值**:`str` — CSV 文本内容,包含列:`id`, `name`, `email`, `phone`, `company`, `title`, `location`, `skills`, `education`, `experience_years`, `summary`, `data_source`, `import_method`, `tags`, `rating`, `status`, `created_at`
|
|
1157
|
+
|
|
1158
|
+
---
|
|
1159
|
+
|
|
1160
|
+
##### `batch_import(talents)`
|
|
1161
|
+
|
|
1162
|
+
JSON 批量导入。
|
|
1163
|
+
|
|
1164
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
1165
|
+
|---|---|---|---|---|
|
|
1166
|
+
| `talents` | `list[dict]` | 是 | — | 人才数据数组,每个元素需含 `name`。可选字段同 `create_talent()` |
|
|
1167
|
+
|
|
1168
|
+
**返回值**:`{"data": {"imported": int, "errors": [...]}}`
|
|
1169
|
+
|
|
1170
|
+
---
|
|
1171
|
+
|
|
1172
|
+
##### `merge(primary_talent_id, merged_talent_id, match_type="api", match_confidence=1.0)`
|
|
1173
|
+
|
|
1174
|
+
人才关联。
|
|
1175
|
+
|
|
1176
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
1177
|
+
|---|---|---|---|---|
|
|
1178
|
+
| `primary_talent_id` | `int` | 是 | — | 主人才 ID |
|
|
1179
|
+
| `merged_talent_id` | `int` | 是 | — | 被合并人才 ID,不能与主人才 ID 相同 |
|
|
1180
|
+
| `match_type` | `str` | 否 | `"api"` | 匹配类型 |
|
|
1181
|
+
| `match_confidence` | `float` | 否 | `1.0` | 匹配置信度,范围 0.0–1.0 |
|
|
1182
|
+
|
|
1183
|
+
**返回值**:`{"data": {"id", "primary_talent_id", "merged_talent_id"}}`
|
|
1184
|
+
|
|
1185
|
+
---
|
|
1186
|
+
|
|
1187
|
+
## 异常处理
|
|
1188
|
+
|
|
1189
|
+
```python
|
|
1190
|
+
from wsapi import (
|
|
1191
|
+
WasaiAPIError, # 基础异常
|
|
1192
|
+
AuthenticationError, # 401
|
|
1193
|
+
ForbiddenError, # 403
|
|
1194
|
+
NotFoundError, # 404
|
|
1195
|
+
ConflictError, # 409
|
|
1196
|
+
ValidationError, # 400
|
|
1197
|
+
ServerError, # 500
|
|
1198
|
+
)
|
|
1199
|
+
|
|
1200
|
+
try:
|
|
1201
|
+
client.talents.get(999)
|
|
1202
|
+
except NotFoundError as e:
|
|
1203
|
+
print(e.status_code, e.message)
|
|
1204
|
+
except WasaiAPIError as e:
|
|
1205
|
+
print(f"API 错误: {e}")
|
|
1206
|
+
```
|
|
1207
|
+
|
|
1208
|
+
## 运行测试
|
|
1209
|
+
|
|
1210
|
+
```bash
|
|
1211
|
+
# 推荐方式:在 wsapi/ 目录下执行 pytest(会自动发现 tests/ 目录)
|
|
1212
|
+
cd wsapi
|
|
1213
|
+
pytest -v
|
|
1214
|
+
|
|
1215
|
+
# 也可以从项目根目录执行
|
|
1216
|
+
cd project-root
|
|
1217
|
+
pytest wsapi/tests/ -v
|
|
1218
|
+
|
|
1219
|
+
# 运行单个测试文件
|
|
1220
|
+
cd wsapi
|
|
1221
|
+
pytest tests/test_admin.py -v
|
|
1222
|
+
```
|
|
1223
|
+
|
|
1224
|
+
## 目录结构
|
|
1225
|
+
|
|
1226
|
+
```
|
|
1227
|
+
wsapi/
|
|
1228
|
+
├── __init__.py # 包入口,导出所有公共类
|
|
1229
|
+
├── client.py # 核心实现:_BaseClient + AuthAPI/TalentAPI/AdminAPI/OpenAPI + WasaiTalentClient
|
|
1230
|
+
├── exceptions.py # 自定义异常类
|
|
1231
|
+
├── pyproject.toml # 包构建配置 & pytest 配置
|
|
1232
|
+
├── requirements.txt # 依赖声明(兼容旧方式)
|
|
1233
|
+
├── README.md # 本文档
|
|
1234
|
+
└── tests/
|
|
1235
|
+
├── conftest.py # pytest 公共 fixtures(mock_api / client)
|
|
1236
|
+
├── test_auth.py # AuthAPI 测试
|
|
1237
|
+
├── test_talents.py # TalentAPI 测试
|
|
1238
|
+
├── test_admin.py # AdminAPI 测试
|
|
1239
|
+
└── test_openapi.py # OpenAPI 测试
|
|
1240
|
+
```
|