@vitex/tcm-cli 0.0.0-stage → 0.2.0
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.
- package/LICENSE +29 -0
- package/README.md +206 -2
- package/bin/tcm.js +15 -0
- package/package.json +33 -4
- package/src/args.js +107 -0
- package/src/auth.js +46 -0
- package/src/commands/account.js +96 -0
- package/src/commands/agent-artifact.js +48 -0
- package/src/commands/auth.js +93 -0
- package/src/commands/author.js +71 -0
- package/src/commands/aweme.js +33 -0
- package/src/commands/comment-candidate.js +39 -0
- package/src/commands/comment-strategy.js +65 -0
- package/src/commands/comment.js +66 -0
- package/src/commands/common.js +36 -0
- package/src/commands/draft.js +69 -0
- package/src/commands/extension-artifact.js +47 -0
- package/src/commands/extension-task.js +57 -0
- package/src/commands/hot-comment.js +19 -0
- package/src/commands/index.js +42 -0
- package/src/commands/item.js +20 -0
- package/src/commands/machine-job.js +33 -0
- package/src/commands/machine-task.js +39 -0
- package/src/commands/machine.js +83 -0
- package/src/commands/material.js +60 -0
- package/src/commands/user.js +55 -0
- package/src/commands/workbench.js +43 -0
- package/src/config.js +8 -0
- package/src/http.js +97 -0
- package/src/index.js +293 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { pick, post, string, number, array, pageNum, pageSize, id } from './common.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
summary: '达人',
|
|
5
|
+
commands: {
|
|
6
|
+
list: {
|
|
7
|
+
summary: '分页查询达人',
|
|
8
|
+
params: {
|
|
9
|
+
keyword: string('关键词'),
|
|
10
|
+
statuses: array('状态多选:NORMAL / HIDDEN'),
|
|
11
|
+
pageNum: pageNum(1),
|
|
12
|
+
pageSize: pageSize(20),
|
|
13
|
+
},
|
|
14
|
+
build: (p) => post('/api/comment/author/page', pick(p, ['keyword', 'statuses', 'pageNum', 'pageSize'])),
|
|
15
|
+
},
|
|
16
|
+
get: {
|
|
17
|
+
summary: '达人详情',
|
|
18
|
+
params: { id: id('达人 ID') },
|
|
19
|
+
build: (p) => post('/api/comment/author/detail', pick(p, ['id'])),
|
|
20
|
+
},
|
|
21
|
+
create: {
|
|
22
|
+
summary: '创建达人',
|
|
23
|
+
params: {
|
|
24
|
+
secUid: string('抖音 secUid', { required: true }),
|
|
25
|
+
nickname: string('昵称'),
|
|
26
|
+
description: string('描述'),
|
|
27
|
+
avatar: string('头像 URL'),
|
|
28
|
+
awemeCount: number('作品数'),
|
|
29
|
+
followerCount: number('粉丝数'),
|
|
30
|
+
totalFavorited: number('获赞数'),
|
|
31
|
+
tags: array('标签'),
|
|
32
|
+
},
|
|
33
|
+
build: (p) =>
|
|
34
|
+
post(
|
|
35
|
+
'/api/comment/author/create',
|
|
36
|
+
pick(p, [
|
|
37
|
+
'secUid',
|
|
38
|
+
'nickname',
|
|
39
|
+
'description',
|
|
40
|
+
'avatar',
|
|
41
|
+
'awemeCount',
|
|
42
|
+
'followerCount',
|
|
43
|
+
'totalFavorited',
|
|
44
|
+
'tags',
|
|
45
|
+
]),
|
|
46
|
+
),
|
|
47
|
+
},
|
|
48
|
+
update: {
|
|
49
|
+
summary: '编辑达人',
|
|
50
|
+
params: {
|
|
51
|
+
id: id('达人 ID'),
|
|
52
|
+
tags: array('标签'),
|
|
53
|
+
status: string('状态:NORMAL / HIDDEN'),
|
|
54
|
+
},
|
|
55
|
+
build: (p) => post('/api/comment/author/update', pick(p, ['id', 'tags', 'status'])),
|
|
56
|
+
},
|
|
57
|
+
status: {
|
|
58
|
+
summary: '切换达人状态',
|
|
59
|
+
params: {
|
|
60
|
+
id: id('达人 ID'),
|
|
61
|
+
status: string('状态:NORMAL / HIDDEN', { required: true }),
|
|
62
|
+
},
|
|
63
|
+
build: (p) => post('/api/comment/author/status', pick(p, ['id', 'status'])),
|
|
64
|
+
},
|
|
65
|
+
profile: {
|
|
66
|
+
summary: '抓取抖音达人主页',
|
|
67
|
+
params: { secUid: string('抖音 secUid', { required: true }) },
|
|
68
|
+
build: (p) => post('/api/comment/author/profile', pick(p, ['secUid'])),
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { pick, post, string, date, pageNum, pageSize, id } from './common.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
summary: '作品',
|
|
5
|
+
commands: {
|
|
6
|
+
list: {
|
|
7
|
+
summary: '分页查询作品',
|
|
8
|
+
params: {
|
|
9
|
+
authorSecUid: string('达人 secUid'),
|
|
10
|
+
keyword: string('关键词'),
|
|
11
|
+
startDate: date('开始日期'),
|
|
12
|
+
endDate: date('结束日期'),
|
|
13
|
+
pageNum: pageNum(1),
|
|
14
|
+
pageSize: pageSize(20),
|
|
15
|
+
},
|
|
16
|
+
build: (p) =>
|
|
17
|
+
post(
|
|
18
|
+
'/api/comment/aweme/page',
|
|
19
|
+
pick(p, ['authorSecUid', 'keyword', 'startDate', 'endDate', 'pageNum', 'pageSize']),
|
|
20
|
+
),
|
|
21
|
+
},
|
|
22
|
+
get: {
|
|
23
|
+
summary: '作品详情',
|
|
24
|
+
params: { id: id('作品 ID') },
|
|
25
|
+
build: (p) => post('/api/comment/aweme/detail', pick(p, ['id'])),
|
|
26
|
+
},
|
|
27
|
+
analysis: {
|
|
28
|
+
summary: '作品视频分析',
|
|
29
|
+
params: { id: id('作品 ID') },
|
|
30
|
+
build: (p) => post('/api/comment/aweme/analysis', pick(p, ['id'])),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { pick, post, string, date, pageNum, pageSize, id } from './common.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
summary: '评论候选',
|
|
5
|
+
commands: {
|
|
6
|
+
list: {
|
|
7
|
+
summary: '分页查询评论候选',
|
|
8
|
+
params: {
|
|
9
|
+
authorSecUid: string('达人 secUid'),
|
|
10
|
+
platformAwemeId: string('平台作品 ID'),
|
|
11
|
+
status: string('状态:DRAFT / SUBMITTED / PUBLISHED / FAILED / DISCARDED'),
|
|
12
|
+
keyword: string('关键词'),
|
|
13
|
+
startDate: date('开始日期'),
|
|
14
|
+
endDate: date('结束日期'),
|
|
15
|
+
pageNum: pageNum(1),
|
|
16
|
+
pageSize: pageSize(20),
|
|
17
|
+
},
|
|
18
|
+
build: (p) =>
|
|
19
|
+
post(
|
|
20
|
+
'/api/comment/candidate/page',
|
|
21
|
+
pick(p, [
|
|
22
|
+
'authorSecUid',
|
|
23
|
+
'platformAwemeId',
|
|
24
|
+
'status',
|
|
25
|
+
'keyword',
|
|
26
|
+
'startDate',
|
|
27
|
+
'endDate',
|
|
28
|
+
'pageNum',
|
|
29
|
+
'pageSize',
|
|
30
|
+
]),
|
|
31
|
+
),
|
|
32
|
+
},
|
|
33
|
+
discard: {
|
|
34
|
+
summary: '丢弃评论候选',
|
|
35
|
+
params: { id: id('候选 ID') },
|
|
36
|
+
build: (p) => post('/api/comment/candidate/discard', pick(p, ['id'])),
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { pick, post, string, number, flag, array, json, pageNum, pageSize, id } from './common.js'
|
|
2
|
+
|
|
3
|
+
/** 创建 / 编辑共用的请求体:windows 是 [{begin,end,limit}] 的 JSON 数组,不传的字段按覆盖语义处理。 */
|
|
4
|
+
const strategyBody = (p) =>
|
|
5
|
+
pick(p, ['id', 'name', 'description', 'tags', 'windows', 'interval', 'weight', 'enabled'])
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
summary: '评论策略(仅管理员)',
|
|
9
|
+
commands: {
|
|
10
|
+
list: {
|
|
11
|
+
summary: '分页查询评论策略',
|
|
12
|
+
params: {
|
|
13
|
+
keyword: string('关键词(策略名称)'),
|
|
14
|
+
enabled: flag('只看启用 / 停用:true / false'),
|
|
15
|
+
pageNum: pageNum(1),
|
|
16
|
+
pageSize: pageSize(20),
|
|
17
|
+
},
|
|
18
|
+
build: (p) =>
|
|
19
|
+
post('/api/comment/strategy/page', pick(p, ['keyword', 'enabled', 'pageNum', 'pageSize'])),
|
|
20
|
+
},
|
|
21
|
+
get: {
|
|
22
|
+
summary: '评论策略详情',
|
|
23
|
+
params: { id: id('策略 ID') },
|
|
24
|
+
build: (p) => post('/api/comment/strategy/detail', pick(p, ['id'])),
|
|
25
|
+
},
|
|
26
|
+
create: {
|
|
27
|
+
summary: '创建评论策略',
|
|
28
|
+
params: {
|
|
29
|
+
name: string('策略名称', { required: true }),
|
|
30
|
+
description: string('策略描述'),
|
|
31
|
+
tags: array('命中哪些账号标签,可重复/逗号分隔;不传表示不限账号'),
|
|
32
|
+
windows: json(
|
|
33
|
+
'时间窗口 JSON 数组,如 \'[{"begin":9,"end":12,"limit":5}]\'(小时整点,0≤begin<end≤24,limit 0~30)',
|
|
34
|
+
{ required: true },
|
|
35
|
+
),
|
|
36
|
+
interval: number('评论间隔(分钟,1~240)', { required: true }),
|
|
37
|
+
weight: number('策略权重(0~100,必填;同账号命中多条时取最大)', { required: true }),
|
|
38
|
+
enabled: flag('是否启用,true / false(不传默认启用)'),
|
|
39
|
+
},
|
|
40
|
+
build: (p) => post('/api/comment/strategy/create', strategyBody(p)),
|
|
41
|
+
},
|
|
42
|
+
update: {
|
|
43
|
+
summary: '编辑评论策略(整体覆盖)',
|
|
44
|
+
params: {
|
|
45
|
+
id: id('策略 ID'),
|
|
46
|
+
name: string('策略名称', { required: true }),
|
|
47
|
+
description: string('策略描述'),
|
|
48
|
+
tags: array('命中哪些账号标签,可重复/逗号分隔;不传会清空'),
|
|
49
|
+
windows: json(
|
|
50
|
+
'时间窗口 JSON 数组,如 \'[{"begin":9,"end":12,"limit":5}]\'(小时整点,0≤begin<end≤24,limit 0~30)',
|
|
51
|
+
{ required: true },
|
|
52
|
+
),
|
|
53
|
+
interval: number('评论间隔(分钟,1~240)', { required: true }),
|
|
54
|
+
weight: number('策略权重(0~100)', { required: true }),
|
|
55
|
+
enabled: flag('是否启用,true / false(不传默认启用)'),
|
|
56
|
+
},
|
|
57
|
+
build: (p) => post('/api/comment/strategy/update', strategyBody(p)),
|
|
58
|
+
},
|
|
59
|
+
delete: {
|
|
60
|
+
summary: '删除评论策略',
|
|
61
|
+
params: { id: id('策略 ID') },
|
|
62
|
+
build: (p) => post('/api/comment/strategy/delete', pick(p, ['id'])),
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { pick, post, string, date, pageNum, pageSize, id, number, flag } from './common.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
summary: '评论',
|
|
5
|
+
commands: {
|
|
6
|
+
list: {
|
|
7
|
+
summary: '分页查询评论',
|
|
8
|
+
params: {
|
|
9
|
+
authorSecUid: string('达人 secUid'),
|
|
10
|
+
platformAwemeId: string('平台作品 ID'),
|
|
11
|
+
accountSecUid: string('账号 secUid'),
|
|
12
|
+
keyword: string('关键词'),
|
|
13
|
+
startDate: date('开始日期(发布时间)'),
|
|
14
|
+
endDate: date('结束日期(发布时间)'),
|
|
15
|
+
refreshStartDate: date('刷新开始日期'),
|
|
16
|
+
refreshEndDate: date('刷新结束日期'),
|
|
17
|
+
minDiggCount: number('最小点赞数'),
|
|
18
|
+
pageNum: pageNum(1),
|
|
19
|
+
pageSize: pageSize(20),
|
|
20
|
+
},
|
|
21
|
+
build: (p) =>
|
|
22
|
+
post(
|
|
23
|
+
'/api/comment/comment/page',
|
|
24
|
+
pick(p, [
|
|
25
|
+
'authorSecUid',
|
|
26
|
+
'platformAwemeId',
|
|
27
|
+
'accountSecUid',
|
|
28
|
+
'keyword',
|
|
29
|
+
'startDate',
|
|
30
|
+
'endDate',
|
|
31
|
+
'refreshStartDate',
|
|
32
|
+
'refreshEndDate',
|
|
33
|
+
'minDiggCount',
|
|
34
|
+
'pageNum',
|
|
35
|
+
'pageSize',
|
|
36
|
+
]),
|
|
37
|
+
),
|
|
38
|
+
},
|
|
39
|
+
get: {
|
|
40
|
+
summary: '评论详情',
|
|
41
|
+
params: { id: id('评论 ID') },
|
|
42
|
+
build: (p) => post('/api/comment/comment/detail', pick(p, ['id'])),
|
|
43
|
+
},
|
|
44
|
+
refresh: {
|
|
45
|
+
summary: '刷新评论(实时拉抖音最新数据,点赞没变大就不改)',
|
|
46
|
+
params: { id: id('评论 ID') },
|
|
47
|
+
build: (p) => post('/api/comment/comment/refresh', pick(p, ['id'])),
|
|
48
|
+
},
|
|
49
|
+
update: {
|
|
50
|
+
summary: '直接更新评论数据(整体覆盖)',
|
|
51
|
+
params: {
|
|
52
|
+
id: id('评论 ID'),
|
|
53
|
+
diggCount: number('点赞数(不能小于当前值)', { required: true }),
|
|
54
|
+
replyCount: number('回复数', { required: true }),
|
|
55
|
+
folded: flag('是否折叠', { required: true }),
|
|
56
|
+
hot: flag('是否热评', { required: true }),
|
|
57
|
+
authorDigged: flag('作者是否点赞', { required: true }),
|
|
58
|
+
},
|
|
59
|
+
build: (p) =>
|
|
60
|
+
post(
|
|
61
|
+
'/api/comment/comment/update',
|
|
62
|
+
pick(p, ['id', 'diggCount', 'replyCount', 'folded', 'hot', 'authorDigged']),
|
|
63
|
+
),
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { Blob } from 'node:buffer'
|
|
4
|
+
|
|
5
|
+
/** 把本地文件以指定字段名追加到 FormData。 */
|
|
6
|
+
export async function appendFile(formData, field, filePath) {
|
|
7
|
+
const data = await fs.promises.readFile(filePath)
|
|
8
|
+
formData.append(field, new Blob([data]), path.basename(filePath))
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** 从参数对象里挑出请求体字段。字段可写成 'name' 或 ['参数名', '请求字段名']。 */
|
|
12
|
+
export function pick(params, fields) {
|
|
13
|
+
const out = {}
|
|
14
|
+
for (const field of fields) {
|
|
15
|
+
const [from, to = from] = Array.isArray(field) ? field : [field]
|
|
16
|
+
if (params[from] !== undefined) out[to] = params[from]
|
|
17
|
+
}
|
|
18
|
+
return out
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const post = (path, json = {}) => ({ method: 'POST', path, json })
|
|
22
|
+
export const get = (path) => ({ method: 'GET', path })
|
|
23
|
+
|
|
24
|
+
export const string = (desc, extra = {}) => ({ type: 'string', desc, ...extra })
|
|
25
|
+
export const number = (desc, extra = {}) => ({ type: 'number', desc, ...extra })
|
|
26
|
+
export const boolean = (desc, extra = {}) => ({ type: 'boolean', desc, ...extra })
|
|
27
|
+
/** 必须显式写 true / false 的布尔参数:boolean 选项只能表达「开了」,没法表达 false。 */
|
|
28
|
+
export const flag = (desc, extra = {}) => ({ type: 'flag', desc, ...extra })
|
|
29
|
+
export const array = (desc, extra = {}) => ({ type: 'array', desc, ...extra })
|
|
30
|
+
export const json = (desc, extra = {}) => ({ type: 'json', desc, ...extra })
|
|
31
|
+
|
|
32
|
+
export const pageNum = (def = 1) => number('页码', { default: def })
|
|
33
|
+
export const pageSize = (def = 10) => number('每页数量', { default: def })
|
|
34
|
+
export const date = (desc) => string(`${desc}(yyyy-MM-dd)`)
|
|
35
|
+
export const id = (desc = 'ID') => number(desc, { required: true, alias: 'i' })
|
|
36
|
+
export const taskId = (desc = '任务 ID') => number(desc, { required: true })
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { pick, post, string, array, json, date, pageNum, pageSize, id, appendFile } from './common.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
summary: '草稿',
|
|
5
|
+
commands: {
|
|
6
|
+
list: {
|
|
7
|
+
summary: '分页查询草稿',
|
|
8
|
+
params: {
|
|
9
|
+
status: string('状态:DRAFT / SUBMITTED / PUBLISHED / FAILED / DISCARDED'),
|
|
10
|
+
keyword: string('关键词'),
|
|
11
|
+
startDate: date('开始日期'),
|
|
12
|
+
endDate: date('结束日期'),
|
|
13
|
+
pageNum: pageNum(1),
|
|
14
|
+
pageSize: pageSize(20),
|
|
15
|
+
},
|
|
16
|
+
build: (p) =>
|
|
17
|
+
post(
|
|
18
|
+
'/api/post/draft/page',
|
|
19
|
+
pick(p, ['status', 'keyword', 'startDate', 'endDate', 'pageNum', 'pageSize']),
|
|
20
|
+
),
|
|
21
|
+
},
|
|
22
|
+
create: {
|
|
23
|
+
summary: '创建草稿(multipart 上传文件)',
|
|
24
|
+
params: {
|
|
25
|
+
type: string('类型:VIDEO / NOTE', { required: true }),
|
|
26
|
+
title: string('标题'),
|
|
27
|
+
description: string('描述'),
|
|
28
|
+
tags: array('标签'),
|
|
29
|
+
hashtags: array('话题'),
|
|
30
|
+
extra: json('扩展字段 JSON'),
|
|
31
|
+
files: array('本地文件路径,可重复传入', { required: true }),
|
|
32
|
+
},
|
|
33
|
+
build: async (p) => {
|
|
34
|
+
const formData = new FormData()
|
|
35
|
+
formData.append('type', p.type)
|
|
36
|
+
formData.append('title', p.title || '')
|
|
37
|
+
formData.append('description', p.description || '')
|
|
38
|
+
formData.append('tags', JSON.stringify(p.tags || []))
|
|
39
|
+
formData.append('hashtags', JSON.stringify(p.hashtags || []))
|
|
40
|
+
formData.append('extra', JSON.stringify(p.extra || {}))
|
|
41
|
+
for (const file of p.files) await appendFile(formData, 'files', file)
|
|
42
|
+
return { method: 'POST', path: '/api/post/draft/create', formData }
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
'create-urls': {
|
|
46
|
+
summary: '创建草稿(通过图片/视频 URL)',
|
|
47
|
+
params: {
|
|
48
|
+
type: string('类型:VIDEO / NOTE', { required: true }),
|
|
49
|
+
title: string('标题'),
|
|
50
|
+
description: string('描述'),
|
|
51
|
+
tags: array('标签'),
|
|
52
|
+
hashtags: array('话题'),
|
|
53
|
+
extra: json('扩展字段 JSON'),
|
|
54
|
+
imageUrls: array('图片 URL 列表'),
|
|
55
|
+
videoUrl: string('视频 URL'),
|
|
56
|
+
},
|
|
57
|
+
build: (p) =>
|
|
58
|
+
post(
|
|
59
|
+
'/api/post/open/draft/create',
|
|
60
|
+
pick(p, ['type', 'title', 'description', 'tags', 'hashtags', 'extra', 'imageUrls', 'videoUrl']),
|
|
61
|
+
),
|
|
62
|
+
},
|
|
63
|
+
discard: {
|
|
64
|
+
summary: '丢弃草稿',
|
|
65
|
+
params: { id: id('草稿 ID') },
|
|
66
|
+
build: (p) => post('/api/post/draft/discard', pick(p, ['id'])),
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { pick, post, string, pageNum, pageSize, id, appendFile } from './common.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
summary: 'Extension 制品',
|
|
5
|
+
commands: {
|
|
6
|
+
list: {
|
|
7
|
+
summary: '分页查询 Extension 制品',
|
|
8
|
+
params: {
|
|
9
|
+
keyword: string('关键词'),
|
|
10
|
+
pageNum: pageNum(1),
|
|
11
|
+
pageSize: pageSize(10),
|
|
12
|
+
},
|
|
13
|
+
build: (p) => post('/api/fleet/extension/page', pick(p, ['keyword', 'pageNum', 'pageSize'])),
|
|
14
|
+
},
|
|
15
|
+
create: {
|
|
16
|
+
summary: '上传 Extension 制品(multipart)',
|
|
17
|
+
params: {
|
|
18
|
+
file: string('本地文件路径', { required: true }),
|
|
19
|
+
description: string('描述'),
|
|
20
|
+
},
|
|
21
|
+
build: async (p) => {
|
|
22
|
+
const formData = new FormData()
|
|
23
|
+
if (p.description !== undefined) formData.append('description', p.description)
|
|
24
|
+
await appendFile(formData, 'file', p.file)
|
|
25
|
+
return { method: 'POST', path: '/api/fleet/extension/create', formData }
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
update: {
|
|
29
|
+
summary: '编辑 Extension 制品描述',
|
|
30
|
+
params: {
|
|
31
|
+
id: id('制品 ID'),
|
|
32
|
+
description: string('描述'),
|
|
33
|
+
},
|
|
34
|
+
build: (p) => post('/api/fleet/extension/update', pick(p, ['id', 'description'])),
|
|
35
|
+
},
|
|
36
|
+
activate: {
|
|
37
|
+
summary: '激活 Extension 制品',
|
|
38
|
+
params: { id: id('制品 ID') },
|
|
39
|
+
build: (p) => post('/api/fleet/extension/activate', pick(p, ['id'])),
|
|
40
|
+
},
|
|
41
|
+
statistics: {
|
|
42
|
+
summary: 'Extension 制品版本统计',
|
|
43
|
+
params: {},
|
|
44
|
+
build: () => post('/api/fleet/extension/statistics'),
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { pick, post, string, number, json, date, pageNum, pageSize, taskId } from './common.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
summary: '插件任务',
|
|
5
|
+
commands: {
|
|
6
|
+
list: {
|
|
7
|
+
summary: '分页查询插件任务',
|
|
8
|
+
params: {
|
|
9
|
+
accountId: number('账号 ID'),
|
|
10
|
+
type: string('任务类型:AWEMES / ITEMS / COMMENT / COMMENT_INFO / COMMENT_DIGG / HOT_COMMENT / PUBLISH'),
|
|
11
|
+
status: string('状态:PENDING / RUNNING / SUCCESS / FAILED / CANCELLED'),
|
|
12
|
+
keyword: string('关键词'),
|
|
13
|
+
startDate: date('开始日期'),
|
|
14
|
+
endDate: date('结束日期'),
|
|
15
|
+
pageNum: pageNum(1),
|
|
16
|
+
pageSize: pageSize(8),
|
|
17
|
+
},
|
|
18
|
+
build: (p) =>
|
|
19
|
+
post(
|
|
20
|
+
'/api/fleet/extension-task/page',
|
|
21
|
+
pick(p, ['accountId', 'type', 'status', 'keyword', 'startDate', 'endDate', 'pageNum', 'pageSize']),
|
|
22
|
+
),
|
|
23
|
+
},
|
|
24
|
+
get: {
|
|
25
|
+
summary: '插件任务详情',
|
|
26
|
+
params: { taskId: taskId() },
|
|
27
|
+
build: (p) => post('/api/fleet/extension-task/detail', pick(p, ['taskId'])),
|
|
28
|
+
},
|
|
29
|
+
create: {
|
|
30
|
+
summary: '创建插件任务',
|
|
31
|
+
params: {
|
|
32
|
+
accountId: number('账号 ID', { required: true }),
|
|
33
|
+
type: string(
|
|
34
|
+
'任务类型:AWEMES / ITEMS / COMMENT / COMMENT_INFO / COMMENT_DIGG / HOT_COMMENT / PUBLISH',
|
|
35
|
+
{ required: true },
|
|
36
|
+
),
|
|
37
|
+
input: json('任务输入 JSON'),
|
|
38
|
+
},
|
|
39
|
+
build: (p) => post('/api/fleet/extension-task/create', pick(p, ['accountId', 'type', 'input'])),
|
|
40
|
+
},
|
|
41
|
+
cancel: {
|
|
42
|
+
summary: '取消任务',
|
|
43
|
+
params: { taskId: taskId() },
|
|
44
|
+
build: (p) => post('/api/fleet/extension-task/cancel', pick(p, ['taskId'])),
|
|
45
|
+
},
|
|
46
|
+
abort: {
|
|
47
|
+
summary: '中止任务',
|
|
48
|
+
params: { taskId: taskId() },
|
|
49
|
+
build: (p) => post('/api/fleet/extension-task/abort', pick(p, ['taskId'])),
|
|
50
|
+
},
|
|
51
|
+
reset: {
|
|
52
|
+
summary: '重置任务',
|
|
53
|
+
params: { taskId: taskId() },
|
|
54
|
+
build: (p) => post('/api/fleet/extension-task/reset', pick(p, ['taskId'])),
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { pick, post, string, pageNum, pageSize } from './common.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
summary: '热评',
|
|
5
|
+
commands: {
|
|
6
|
+
list: {
|
|
7
|
+
summary: '分页查询热评',
|
|
8
|
+
params: {
|
|
9
|
+
authorSecUid: string('达人 secUid'),
|
|
10
|
+
platformAwemeId: string('平台作品 ID'),
|
|
11
|
+
keyword: string('关键词'),
|
|
12
|
+
pageNum: pageNum(1),
|
|
13
|
+
pageSize: pageSize(20),
|
|
14
|
+
},
|
|
15
|
+
build: (p) =>
|
|
16
|
+
post('/api/comment/hot-comment/page', pick(p, ['authorSecUid', 'platformAwemeId', 'keyword', 'pageNum', 'pageSize'])),
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import user from './user.js'
|
|
2
|
+
import workbench from './workbench.js'
|
|
3
|
+
import machine from './machine.js'
|
|
4
|
+
import account from './account.js'
|
|
5
|
+
import machineJob from './machine-job.js'
|
|
6
|
+
import machineTask from './machine-task.js'
|
|
7
|
+
import extensionTask from './extension-task.js'
|
|
8
|
+
import agentArtifact from './agent-artifact.js'
|
|
9
|
+
import extensionArtifact from './extension-artifact.js'
|
|
10
|
+
import author from './author.js'
|
|
11
|
+
import aweme from './aweme.js'
|
|
12
|
+
import comment from './comment.js'
|
|
13
|
+
import commentCandidate from './comment-candidate.js'
|
|
14
|
+
import commentStrategy from './comment-strategy.js'
|
|
15
|
+
import hotComment from './hot-comment.js'
|
|
16
|
+
import material from './material.js'
|
|
17
|
+
import draft from './draft.js'
|
|
18
|
+
import item from './item.js'
|
|
19
|
+
import { topCommands } from './auth.js'
|
|
20
|
+
|
|
21
|
+
export const groups = {
|
|
22
|
+
user,
|
|
23
|
+
workbench,
|
|
24
|
+
machine,
|
|
25
|
+
account,
|
|
26
|
+
'machine-job': machineJob,
|
|
27
|
+
'machine-task': machineTask,
|
|
28
|
+
'extension-task': extensionTask,
|
|
29
|
+
'agent-artifact': agentArtifact,
|
|
30
|
+
'extension-artifact': extensionArtifact,
|
|
31
|
+
author,
|
|
32
|
+
aweme,
|
|
33
|
+
comment,
|
|
34
|
+
'comment-candidate': commentCandidate,
|
|
35
|
+
'comment-strategy': commentStrategy,
|
|
36
|
+
'hot-comment': hotComment,
|
|
37
|
+
material,
|
|
38
|
+
draft,
|
|
39
|
+
item,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { topCommands }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { pick, post, string, number, date, pageNum, pageSize } from './common.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
summary: '作品',
|
|
5
|
+
commands: {
|
|
6
|
+
list: {
|
|
7
|
+
summary: '分页查询作品',
|
|
8
|
+
params: {
|
|
9
|
+
accountId: number('账号 ID'),
|
|
10
|
+
keyword: string('关键词'),
|
|
11
|
+
startDate: date('开始日期'),
|
|
12
|
+
endDate: date('结束日期'),
|
|
13
|
+
pageNum: pageNum(1),
|
|
14
|
+
pageSize: pageSize(20),
|
|
15
|
+
},
|
|
16
|
+
build: (p) =>
|
|
17
|
+
post('/api/post/item/page', pick(p, ['accountId', 'keyword', 'startDate', 'endDate', 'pageNum', 'pageSize'])),
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { pick, post, string, array, json, date, pageNum, pageSize } from './common.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
summary: '机器作业',
|
|
5
|
+
commands: {
|
|
6
|
+
list: {
|
|
7
|
+
summary: '分页查询作业',
|
|
8
|
+
params: {
|
|
9
|
+
keyword: string('关键词'),
|
|
10
|
+
startDate: date('开始日期'),
|
|
11
|
+
endDate: date('结束日期'),
|
|
12
|
+
pageNum: pageNum(1),
|
|
13
|
+
pageSize: pageSize(100),
|
|
14
|
+
},
|
|
15
|
+
build: (p) => post('/api/fleet/job/page', pick(p, ['keyword', 'startDate', 'endDate', 'pageNum', 'pageSize'])),
|
|
16
|
+
},
|
|
17
|
+
create: {
|
|
18
|
+
summary: '创建作业(EXEC / REBOOT / UPDATE / UPDATE_EXTENSION)',
|
|
19
|
+
params: {
|
|
20
|
+
type: string('作业类型:EXEC / REBOOT / UPDATE / UPDATE_EXTENSION', { required: true }),
|
|
21
|
+
description: string('描述'),
|
|
22
|
+
machineIds: array('目标机器 ID 列表', { items: 'number', required: true }),
|
|
23
|
+
input: json('作业输入 JSON,例如 {"command":"ipconfig /all"}'),
|
|
24
|
+
},
|
|
25
|
+
examples: [
|
|
26
|
+
'tcm machine-job create --type EXEC --machineIds 1,2 --input \'{"command":"ipconfig /all"}\'',
|
|
27
|
+
'tcm machine-job create --type UPDATE --machineIds 1 --input \'{"agentArtifactId":12}\'',
|
|
28
|
+
'tcm machine-job create --type UPDATE_EXTENSION --machineIds 1 --input \'{"extensionArtifactId":34}\'',
|
|
29
|
+
],
|
|
30
|
+
build: (p) => post('/api/fleet/job/create', pick(p, ['type', 'description', 'machineIds', 'input'])),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { pick, post, string, number, date, pageNum, pageSize, taskId } from './common.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
summary: '机器任务',
|
|
5
|
+
commands: {
|
|
6
|
+
list: {
|
|
7
|
+
summary: '分页查询机器任务',
|
|
8
|
+
params: {
|
|
9
|
+
jobId: number('作业 ID'),
|
|
10
|
+
status: string('状态:PENDING / RUNNING / SUCCESS / FAILED / CANCELLED'),
|
|
11
|
+
keyword: string('关键词'),
|
|
12
|
+
startDate: date('开始日期'),
|
|
13
|
+
endDate: date('结束日期'),
|
|
14
|
+
pageNum: pageNum(1),
|
|
15
|
+
pageSize: pageSize(8),
|
|
16
|
+
},
|
|
17
|
+
build: (p) =>
|
|
18
|
+
post(
|
|
19
|
+
'/api/fleet/agent-task/page',
|
|
20
|
+
pick(p, ['jobId', 'status', 'keyword', 'startDate', 'endDate', 'pageNum', 'pageSize']),
|
|
21
|
+
),
|
|
22
|
+
},
|
|
23
|
+
cancel: {
|
|
24
|
+
summary: '取消任务',
|
|
25
|
+
params: { taskId: taskId() },
|
|
26
|
+
build: (p) => post('/api/fleet/agent-task/cancel', pick(p, ['taskId'])),
|
|
27
|
+
},
|
|
28
|
+
abort: {
|
|
29
|
+
summary: '中止任务',
|
|
30
|
+
params: { taskId: taskId() },
|
|
31
|
+
build: (p) => post('/api/fleet/agent-task/abort', pick(p, ['taskId'])),
|
|
32
|
+
},
|
|
33
|
+
reset: {
|
|
34
|
+
summary: '重置任务',
|
|
35
|
+
params: { taskId: taskId() },
|
|
36
|
+
build: (p) => post('/api/fleet/agent-task/reset', pick(p, ['taskId'])),
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
}
|