@vitex/tcm-cli 0.0.0-stage → 0.1.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 +204 -2
- package/bin/tcm.js +15 -0
- package/package.json +33 -4
- package/src/args.js +99 -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.js +39 -0
- package/src/commands/common.js +34 -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 +40 -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 +287 -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,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
|
+
accountSecUid: string('账号 secUid'),
|
|
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/comment/page',
|
|
21
|
+
pick(p, [
|
|
22
|
+
'authorSecUid',
|
|
23
|
+
'platformAwemeId',
|
|
24
|
+
'accountSecUid',
|
|
25
|
+
'keyword',
|
|
26
|
+
'startDate',
|
|
27
|
+
'endDate',
|
|
28
|
+
'pageNum',
|
|
29
|
+
'pageSize',
|
|
30
|
+
]),
|
|
31
|
+
),
|
|
32
|
+
},
|
|
33
|
+
get: {
|
|
34
|
+
summary: '评论详情',
|
|
35
|
+
params: { id: id('评论 ID') },
|
|
36
|
+
build: (p) => post('/api/comment/comment/detail', pick(p, ['id'])),
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
export const array = (desc, extra = {}) => ({ type: 'array', desc, ...extra })
|
|
28
|
+
export const json = (desc, extra = {}) => ({ type: 'json', desc, ...extra })
|
|
29
|
+
|
|
30
|
+
export const pageNum = (def = 1) => number('页码', { default: def })
|
|
31
|
+
export const pageSize = (def = 10) => number('每页数量', { default: def })
|
|
32
|
+
export const date = (desc) => string(`${desc}(yyyy-MM-dd)`)
|
|
33
|
+
export const id = (desc = 'ID') => number(desc, { required: true, alias: 'i' })
|
|
34
|
+
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,40 @@
|
|
|
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 hotComment from './hot-comment.js'
|
|
15
|
+
import material from './material.js'
|
|
16
|
+
import draft from './draft.js'
|
|
17
|
+
import item from './item.js'
|
|
18
|
+
import { topCommands } from './auth.js'
|
|
19
|
+
|
|
20
|
+
export const groups = {
|
|
21
|
+
user,
|
|
22
|
+
workbench,
|
|
23
|
+
machine,
|
|
24
|
+
account,
|
|
25
|
+
'machine-job': machineJob,
|
|
26
|
+
'machine-task': machineTask,
|
|
27
|
+
'extension-task': extensionTask,
|
|
28
|
+
'agent-artifact': agentArtifact,
|
|
29
|
+
'extension-artifact': extensionArtifact,
|
|
30
|
+
author,
|
|
31
|
+
aweme,
|
|
32
|
+
comment,
|
|
33
|
+
'comment-candidate': commentCandidate,
|
|
34
|
+
'hot-comment': hotComment,
|
|
35
|
+
material,
|
|
36
|
+
draft,
|
|
37
|
+
item,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
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
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
os: string('操作系统:MAC / WINDOWS / LINUX'),
|
|
11
|
+
statuses: array('状态多选:INIT / NORMAL / HIDDEN'),
|
|
12
|
+
health: string('健康状态:ONLINE / OFFLINE'),
|
|
13
|
+
tags: array('标签'),
|
|
14
|
+
machineId: number('机器 ID'),
|
|
15
|
+
pageNum: pageNum(1),
|
|
16
|
+
pageSize: pageSize(8),
|
|
17
|
+
},
|
|
18
|
+
build: (p) =>
|
|
19
|
+
post(
|
|
20
|
+
'/api/fleet/machine/page',
|
|
21
|
+
pick(p, ['keyword', 'os', 'statuses', 'health', 'tags', 'machineId', 'pageNum', 'pageSize']),
|
|
22
|
+
),
|
|
23
|
+
},
|
|
24
|
+
get: {
|
|
25
|
+
summary: '机器详情',
|
|
26
|
+
params: { id: id('机器 ID') },
|
|
27
|
+
build: (p) => post('/api/fleet/machine/detail', pick(p, ['id'])),
|
|
28
|
+
},
|
|
29
|
+
create: {
|
|
30
|
+
summary: '新建机器',
|
|
31
|
+
params: {
|
|
32
|
+
os: string('操作系统:MAC / WINDOWS / LINUX', { required: true }),
|
|
33
|
+
name: string('名称', { required: true }),
|
|
34
|
+
description: string('备注'),
|
|
35
|
+
},
|
|
36
|
+
build: (p) => post('/api/fleet/machine/create', pick(p, ['os', 'name', 'description'])),
|
|
37
|
+
},
|
|
38
|
+
update: {
|
|
39
|
+
summary: '编辑机器',
|
|
40
|
+
params: {
|
|
41
|
+
id: id('机器 ID'),
|
|
42
|
+
name: string('名称'),
|
|
43
|
+
description: string('备注'),
|
|
44
|
+
tags: array('标签'),
|
|
45
|
+
status: string('状态:INIT / NORMAL / HIDDEN'),
|
|
46
|
+
},
|
|
47
|
+
build: (p) => post('/api/fleet/machine/update', pick(p, ['id', 'name', 'description', 'tags', 'status'])),
|
|
48
|
+
},
|
|
49
|
+
status: {
|
|
50
|
+
summary: '切换机器状态',
|
|
51
|
+
params: {
|
|
52
|
+
id: id('机器 ID'),
|
|
53
|
+
status: string('状态:INIT / NORMAL / HIDDEN', { required: true }),
|
|
54
|
+
},
|
|
55
|
+
build: (p) => post('/api/fleet/machine/status', pick(p, ['id', 'status'])),
|
|
56
|
+
},
|
|
57
|
+
names: {
|
|
58
|
+
summary: '按 ID 批量查询机器名称',
|
|
59
|
+
params: { ids: array('机器 ID 列表', { items: 'number', required: true }) },
|
|
60
|
+
build: (p) => post('/api/fleet/machine/names', pick(p, ['ids'])),
|
|
61
|
+
},
|
|
62
|
+
summary: {
|
|
63
|
+
summary: '机器汇总',
|
|
64
|
+
params: {},
|
|
65
|
+
build: () => post('/api/fleet/machine/summary'),
|
|
66
|
+
},
|
|
67
|
+
logs: {
|
|
68
|
+
summary: '机器日志分页',
|
|
69
|
+
params: {
|
|
70
|
+
machineId: number('机器 ID'),
|
|
71
|
+
type: string('日志类型,例如 ONLINE / OFFLINE / REBOOT / UPGRADE / EXTENSION_UPGRADE'),
|
|
72
|
+
pageNum: pageNum(1),
|
|
73
|
+
pageSize: pageSize(10),
|
|
74
|
+
},
|
|
75
|
+
build: (p) => post('/api/fleet/machine/log/page', pick(p, ['machineId', 'type', 'pageNum', 'pageSize'])),
|
|
76
|
+
},
|
|
77
|
+
statistics: {
|
|
78
|
+
summary: '机器统计趋势',
|
|
79
|
+
params: { machineId: number('机器 ID', { required: true }) },
|
|
80
|
+
build: (p) => post('/api/fleet/machine/statistics', pick(p, ['machineId'])),
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
}
|