jpsclient 2.5.0 → 2.7.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.
- checksums.yaml +4 -4
- data/lib/jpsclient/api/category.rb +16 -206
- data/lib/jpsclient/api/material.rb +353 -0
- data/lib/jpsclient/api/project_package.rb +2 -2
- data/lib/jpsclient/auth/auth.rb +194 -579
- data/lib/jpsclient/auth/endpoints.rb +46 -0
- data/lib/jpsclient/auth/token.rb +157 -114
- data/lib/jpsclient/base/client.rb +12 -6
- data/lib/jpsclient/http/http_client.rb +25 -11
- data/lib/jpsclient/upload/upload_client.rb +5 -5
- data/lib/jpsclient/utils/debug.rb +20 -0
- data/lib/jpsclient/utils/logger.rb +1 -1
- data/lib/jpsclient/version.rb +1 -1
- data/lib/jpsclient.rb +3 -0
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4c96b5ac6d4cc1926b3ed272182eb162381f858180369c2c1c0a119937ce1dc4
|
|
4
|
+
data.tar.gz: 1ff46ef1dbc14c78ebc34eafa722402299d51f5685f4b949256c533690c4883e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b042d80d7475b6d3477ba406a52343899e8557270db0de0845304a4d9c8a88326be30fa2eb61d345401b0746cda2413e19e088806facfceeca7535437f120401
|
|
7
|
+
data.tar.gz: e0ad15a3b46d560381c4b51330dc599eabb2a46b00fa1de50428f0c30458fdedc09bcd2d3d403bf9a26eff14a31e9c56d0480f8b510acadb0f504931ef073d72
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
module JPSClient
|
|
2
2
|
module API
|
|
3
3
|
# Category 相关 API
|
|
4
|
-
#
|
|
4
|
+
# 通用分类管理接口 (/api/category,分类 controller)
|
|
5
5
|
module Category
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# 分类列表
|
|
8
8
|
#
|
|
9
|
-
# @param params [Hash]
|
|
10
|
-
#
|
|
11
|
-
# - parent_id: 父分类ID(可选)
|
|
12
|
-
# @return [Hash] API响应
|
|
9
|
+
# @param params [Hash] CategoryListDto: type(分类类型), platforms(平台,可多个)
|
|
10
|
+
# @return [Hash] API响应,data: { list: [Category], count }
|
|
13
11
|
def get_category_list(params: {})
|
|
14
12
|
config = @request_config && @request_config["category_list"]
|
|
15
13
|
raise JPSClient::ExceptionError, "Missing config for category_list" unless config && config["url"]
|
|
@@ -19,12 +17,10 @@ module JPSClient
|
|
|
19
17
|
return request_with_auth(:get, path, params: params)
|
|
20
18
|
end
|
|
21
19
|
|
|
22
|
-
#
|
|
20
|
+
# 分类树
|
|
23
21
|
#
|
|
24
|
-
# @param params [Hash]
|
|
25
|
-
#
|
|
26
|
-
# - max_level: 最大层级深度(可选)
|
|
27
|
-
# @return [Hash] API响应,包含树形结构数据
|
|
22
|
+
# @param params [Hash] CategoryListDto: type(分类类型), platforms(平台,可多个)
|
|
23
|
+
# @return [Hash] API响应,data: [CategoryTreeVo]
|
|
28
24
|
def get_category_tree(params: {})
|
|
29
25
|
config = @request_config && @request_config["category_tree"]
|
|
30
26
|
raise JPSClient::ExceptionError, "Missing config for category_tree" unless config && config["url"]
|
|
@@ -36,29 +32,12 @@ module JPSClient
|
|
|
36
32
|
|
|
37
33
|
# 创建分类
|
|
38
34
|
#
|
|
39
|
-
# @param params [Hash]
|
|
40
|
-
#
|
|
41
|
-
# - type: 分类类型(必需)
|
|
42
|
-
# - parent_id: 父分类ID(可选,根分类不需要)
|
|
43
|
-
# - icon: 分类图标(可选)
|
|
44
|
-
# - description: 分类描述(可选)
|
|
45
|
-
# - sort_order: 排序值(可选,默认1)
|
|
46
|
-
# @return [Hash] API响应
|
|
35
|
+
# @param params [Hash] CategoryCreateDto: type*, name*, parentId, priority, description, medias, platform
|
|
36
|
+
# @return [Hash] API响应,data: Category
|
|
47
37
|
def create_category(params: {})
|
|
48
38
|
config = @request_config && @request_config["category_create"]
|
|
49
39
|
raise JPSClient::ExceptionError, "Missing config for category_create" unless config && config["url"]
|
|
50
40
|
|
|
51
|
-
# 参数验证
|
|
52
|
-
required_fields = [:name, :type]
|
|
53
|
-
missing_fields = required_fields.select { |field| params[field].nil? || params[field].to_s.empty? }
|
|
54
|
-
|
|
55
|
-
if missing_fields.any?
|
|
56
|
-
raise JPSClient::ExceptionError, "Missing required fields: #{missing_fields.join(', ')}"
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
# 设置默认值
|
|
60
|
-
params[:sort_order] ||= 1
|
|
61
|
-
|
|
62
41
|
path = config["url"]
|
|
63
42
|
|
|
64
43
|
return request_with_auth(:post, path, body: params)
|
|
@@ -66,21 +45,12 @@ module JPSClient
|
|
|
66
45
|
|
|
67
46
|
# 更新分类
|
|
68
47
|
#
|
|
69
|
-
# @param params [Hash]
|
|
70
|
-
#
|
|
71
|
-
# - name: 分类名称
|
|
72
|
-
# - icon: 分类图标
|
|
73
|
-
# - description: 分类描述
|
|
74
|
-
# - sort_order: 排序值
|
|
75
|
-
# - status: 分类状态(1:启用, 0:停用)
|
|
76
|
-
# @return [Hash] API响应
|
|
48
|
+
# @param params [Hash] CategoryUpdateDto: id*, parentId, priority, name, weight, medias, description
|
|
49
|
+
# @return [Hash] API响应,data: Category
|
|
77
50
|
def update_category(params: {})
|
|
78
51
|
config = @request_config && @request_config["category_update"]
|
|
79
52
|
raise JPSClient::ExceptionError, "Missing config for category_update" unless config && config["url"]
|
|
80
53
|
|
|
81
|
-
# ID 是必需的
|
|
82
|
-
raise JPSClient::ExceptionError, "Missing required field: id" unless params[:id]
|
|
83
|
-
|
|
84
54
|
path = config["url"]
|
|
85
55
|
|
|
86
56
|
return request_with_auth(:post, path, body: params)
|
|
@@ -88,190 +58,30 @@ module JPSClient
|
|
|
88
58
|
|
|
89
59
|
# 删除分类
|
|
90
60
|
#
|
|
91
|
-
# @param
|
|
61
|
+
# @param params [Hash] BaseIdDtoInteger: id*
|
|
92
62
|
# @return [Hash] API响应
|
|
93
|
-
def delete_category(
|
|
63
|
+
def delete_category(params: {})
|
|
94
64
|
config = @request_config && @request_config["category_delete"]
|
|
95
65
|
raise JPSClient::ExceptionError, "Missing config for category_delete" unless config && config["url"]
|
|
96
66
|
|
|
97
67
|
path = config["url"]
|
|
98
68
|
|
|
99
|
-
# POST请求,ID作为body参数
|
|
100
|
-
params = { id: id }
|
|
101
|
-
|
|
102
69
|
return request_with_auth(:post, path, body: params)
|
|
103
70
|
end
|
|
104
71
|
|
|
105
72
|
# 分类排序
|
|
106
73
|
#
|
|
107
|
-
# @param
|
|
108
|
-
# 每个项包含:
|
|
109
|
-
# - id: 分类ID
|
|
110
|
-
# - sort_order: 新的排序值
|
|
74
|
+
# @param params [Array] CategorySortDto 数组,每项: id*, weight*, parentId(前端以裸数组体提交)
|
|
111
75
|
# @return [Hash] API响应
|
|
112
|
-
def sort_categories(
|
|
76
|
+
def sort_categories(params: [])
|
|
113
77
|
config = @request_config && @request_config["category_sort"]
|
|
114
78
|
raise JPSClient::ExceptionError, "Missing config for category_sort" unless config && config["url"]
|
|
115
79
|
|
|
116
|
-
if items.empty?
|
|
117
|
-
raise JPSClient::ExceptionError, "Items array cannot be empty"
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
# 验证每个项都有必需的字段
|
|
121
|
-
items.each_with_index do |item, index|
|
|
122
|
-
unless item[:id] || item["id"]
|
|
123
|
-
raise JPSClient::ExceptionError, "Item at index #{index} missing 'id'"
|
|
124
|
-
end
|
|
125
|
-
unless item[:sort_order] || item["sort_order"]
|
|
126
|
-
raise JPSClient::ExceptionError, "Item at index #{index} missing 'sort_order'"
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
|
|
130
80
|
path = config["url"]
|
|
131
|
-
params = { items: items }
|
|
132
81
|
|
|
133
82
|
return request_with_auth(:post, path, body: params)
|
|
134
83
|
end
|
|
135
84
|
|
|
136
|
-
# 按类型获取分类列表(便捷方法)
|
|
137
|
-
#
|
|
138
|
-
# @param type [String] 分类类型
|
|
139
|
-
# - application: 应用分类
|
|
140
|
-
# - resource: 资源分类
|
|
141
|
-
# - asset: 素材分类
|
|
142
|
-
# - requirement: 需求分类
|
|
143
|
-
# - sketch: 画板分类
|
|
144
|
-
# - tool: 工具分类
|
|
145
|
-
# - survey: 调研分类
|
|
146
|
-
# - publisher: 发行商分类
|
|
147
|
-
# - experience: 体验分类
|
|
148
|
-
# @param parent_id [String, Integer, nil] 父分类ID
|
|
149
|
-
# @return [Hash] API响应
|
|
150
|
-
def get_categories_by_type(type:, parent_id: nil)
|
|
151
|
-
params = { type: type }
|
|
152
|
-
params[:parent_id] = parent_id if parent_id
|
|
153
|
-
get_category_list(params: params)
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
# 获取某分类的所有子分类
|
|
157
|
-
#
|
|
158
|
-
# @param parent_id [String, Integer] 父分类ID
|
|
159
|
-
# @return [Hash] API响应
|
|
160
|
-
def get_subcategories(parent_id:)
|
|
161
|
-
get_category_list(params: { parent_id: parent_id })
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
# 获取根分类列表
|
|
165
|
-
#
|
|
166
|
-
# @param type [String, nil] 分类类型(可选)
|
|
167
|
-
# @return [Hash] API响应
|
|
168
|
-
def get_root_categories(type: nil)
|
|
169
|
-
params = { parent_id: 0 } # parent_id 为 0 或 null 表示根分类
|
|
170
|
-
params[:type] = type if type
|
|
171
|
-
get_category_list(params: params)
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
# 批量创建分类
|
|
175
|
-
# 注意:此方法会逐个调用 API,返回结果数组
|
|
176
|
-
#
|
|
177
|
-
# @param categories [Array<Hash>] 分类数组
|
|
178
|
-
# @return [Array<Hash>] 每个请求的响应结果
|
|
179
|
-
def batch_create_categories(categories: [])
|
|
180
|
-
return [] if categories.empty?
|
|
181
|
-
|
|
182
|
-
results = []
|
|
183
|
-
categories.each do |category_params|
|
|
184
|
-
result = create_category(params: category_params)
|
|
185
|
-
results << result
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
results
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
# 移动分类到新的父分类
|
|
192
|
-
#
|
|
193
|
-
# @param category_id [String, Integer] 要移动的分类ID
|
|
194
|
-
# @param new_parent_id [String, Integer, nil] 新的父分类ID(nil表示移到根级)
|
|
195
|
-
# @return [Hash] API响应
|
|
196
|
-
def move_category(category_id:, new_parent_id: nil)
|
|
197
|
-
params = {
|
|
198
|
-
id: category_id,
|
|
199
|
-
parent_id: new_parent_id || 0
|
|
200
|
-
}
|
|
201
|
-
update_category(params: params)
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
# 启用分类
|
|
205
|
-
#
|
|
206
|
-
# @param category_id [String, Integer] 分类ID
|
|
207
|
-
# @return [Hash] API响应
|
|
208
|
-
def enable_category(category_id:)
|
|
209
|
-
update_category(params: { id: category_id, status: 1 })
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
# 停用分类
|
|
213
|
-
#
|
|
214
|
-
# @param category_id [String, Integer] 分类ID
|
|
215
|
-
# @return [Hash] API响应
|
|
216
|
-
def disable_category(category_id:)
|
|
217
|
-
update_category(params: { id: category_id, status: 0 })
|
|
218
|
-
end
|
|
219
|
-
|
|
220
|
-
# 构建分类路径
|
|
221
|
-
# 根据分类ID获取从根到该分类的完整路径
|
|
222
|
-
#
|
|
223
|
-
# @param category_id [String, Integer] 分类ID
|
|
224
|
-
# @return [Array<Hash>] 分类路径数组,从根到目标分类
|
|
225
|
-
def get_category_path(category_id:)
|
|
226
|
-
response = get_category_list
|
|
227
|
-
|
|
228
|
-
# 如果请求失败,返回空数组
|
|
229
|
-
return [] unless response && response['data']
|
|
230
|
-
|
|
231
|
-
categories = response['data']['list'] || response['data'][:list] || []
|
|
232
|
-
path = []
|
|
233
|
-
|
|
234
|
-
current_id = category_id.to_s
|
|
235
|
-
while current_id
|
|
236
|
-
category = categories.find { |c|
|
|
237
|
-
(c['id'] || c[:id]).to_s == current_id
|
|
238
|
-
}
|
|
239
|
-
break unless category
|
|
240
|
-
|
|
241
|
-
path.unshift(category)
|
|
242
|
-
current_id = (category['parent_id'] || category[:parent_id])&.to_s
|
|
243
|
-
break if current_id == "0" || current_id.nil?
|
|
244
|
-
end
|
|
245
|
-
|
|
246
|
-
path
|
|
247
|
-
end
|
|
248
|
-
|
|
249
|
-
# 获取分类统计信息
|
|
250
|
-
# 统计某个分类下的直接子分类数量
|
|
251
|
-
#
|
|
252
|
-
# @param category_id [String, Integer] 分类ID
|
|
253
|
-
# @return [Hash] 包含统计数据的哈希
|
|
254
|
-
def get_category_statistics(category_id:)
|
|
255
|
-
response = get_subcategories(parent_id: category_id)
|
|
256
|
-
|
|
257
|
-
# 如果请求失败,返回空统计
|
|
258
|
-
unless response && response['data']
|
|
259
|
-
return {
|
|
260
|
-
category_id: category_id,
|
|
261
|
-
direct_children_count: 0,
|
|
262
|
-
children: []
|
|
263
|
-
}
|
|
264
|
-
end
|
|
265
|
-
|
|
266
|
-
child_list = response['data']['list'] || response['data'][:list] || []
|
|
267
|
-
|
|
268
|
-
{
|
|
269
|
-
category_id: category_id,
|
|
270
|
-
direct_children_count: child_list.size,
|
|
271
|
-
children: child_list
|
|
272
|
-
}
|
|
273
|
-
end
|
|
274
|
-
|
|
275
85
|
end
|
|
276
86
|
end
|
|
277
|
-
end
|
|
87
|
+
end
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
module JPSClient
|
|
2
|
+
module API
|
|
3
|
+
# Material 相关 API
|
|
4
|
+
# 素材库 v2 接口 (/api/v2/material),涵盖素材管理、素材配置管理、分区管理三组
|
|
5
|
+
module Material
|
|
6
|
+
|
|
7
|
+
# ==================== 素材管理 ====================
|
|
8
|
+
|
|
9
|
+
# 创建素材
|
|
10
|
+
#
|
|
11
|
+
# @param params [Hash] MaterialCreateDto: name, description, priorityRule,
|
|
12
|
+
# sourceType, sourceId, tagIds, items, categoryId*, instanceId*, flowId*, stateId*, screenId*
|
|
13
|
+
# @return [Hash] API响应
|
|
14
|
+
def create_material(params: {})
|
|
15
|
+
config = @request_config && @request_config["material_create"]
|
|
16
|
+
raise JPSClient::ExceptionError, "Missing config for material_create" unless config && config["url"]
|
|
17
|
+
|
|
18
|
+
path = config["url"]
|
|
19
|
+
|
|
20
|
+
return request_with_auth(:post, path, body: params)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# 更新素材
|
|
24
|
+
#
|
|
25
|
+
# @param params [Hash] MaterialUpdateDto: materialId*, name, description,
|
|
26
|
+
# priorityRule, sourceType, sourceId, tagIds, items(全量快照)
|
|
27
|
+
# @return [Hash] API响应
|
|
28
|
+
def update_material(params: {})
|
|
29
|
+
config = @request_config && @request_config["material_update"]
|
|
30
|
+
raise JPSClient::ExceptionError, "Missing config for material_update" unless config && config["url"]
|
|
31
|
+
|
|
32
|
+
path = config["url"]
|
|
33
|
+
|
|
34
|
+
return request_with_auth(:post, path, body: params)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# 删除素材(软删除,同步软删其下 item、partition)
|
|
38
|
+
#
|
|
39
|
+
# @param params [Hash] MaterialDeleteDto: id*
|
|
40
|
+
# @return [Hash] API响应
|
|
41
|
+
def delete_material(params: {})
|
|
42
|
+
config = @request_config && @request_config["material_delete"]
|
|
43
|
+
raise JPSClient::ExceptionError, "Missing config for material_delete" unless config && config["url"]
|
|
44
|
+
|
|
45
|
+
path = config["url"]
|
|
46
|
+
|
|
47
|
+
return request_with_auth(:post, path, body: params)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# 复制或迁移素材内容(兼容旧 material/copy_or_trans 语义)
|
|
51
|
+
#
|
|
52
|
+
# @param params [Hash] 传 materialId 更新现有素材,不传则按条件定位或新建目标素材
|
|
53
|
+
# @return [Hash] API响应
|
|
54
|
+
def copy_or_trans(params: {})
|
|
55
|
+
config = @request_config && @request_config["material_copy_or_trans"]
|
|
56
|
+
raise JPSClient::ExceptionError, "Missing config for material_copy_or_trans" unless config && config["url"]
|
|
57
|
+
|
|
58
|
+
path = config["url"]
|
|
59
|
+
|
|
60
|
+
return request_with_auth(:post, path, body: params)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# 批量导入素材(兼容旧 material/zip 语义,按 zip 内目录名匹配分类)
|
|
64
|
+
#
|
|
65
|
+
# @param params [Hash] MaterialCreateByZipDto: zipUrl*, applicationId*, platform*, flowId*, stateId*, screenId*
|
|
66
|
+
# @return [Hash] API响应
|
|
67
|
+
def create_by_zip(params: {})
|
|
68
|
+
config = @request_config && @request_config["material_batch_create"]
|
|
69
|
+
raise JPSClient::ExceptionError, "Missing config for material_batch_create" unless config && config["url"]
|
|
70
|
+
|
|
71
|
+
path = config["url"]
|
|
72
|
+
|
|
73
|
+
return request_with_auth(:post, path, body: params)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# 素材库素材列表
|
|
77
|
+
#
|
|
78
|
+
# @param params [Hash] categoryIds, platforms, unifiedAppIds, materialTagIds,
|
|
79
|
+
# itemTagIds, itemTitles, onlyCollected, keywords, createUserId, updateUserId,
|
|
80
|
+
# excludeCreateUserId, excludeUpdateUserId, pageNo, pageSize
|
|
81
|
+
# @return [Hash] API响应
|
|
82
|
+
def get_material_list(params: {})
|
|
83
|
+
config = @request_config && @request_config["material_list"]
|
|
84
|
+
raise JPSClient::ExceptionError, "Missing config for material_list" unless config && config["url"]
|
|
85
|
+
|
|
86
|
+
path = config["url"]
|
|
87
|
+
|
|
88
|
+
return request_with_auth(:get, path, params: params)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# 应用详情素材列表(每个分类返回最新一条素材及其 items、分类下素材数量)
|
|
92
|
+
#
|
|
93
|
+
# @param params [Hash] sourceId*, categoryId, categoryIds, platforms, unifiedAppIds,
|
|
94
|
+
# materialTagIds, itemTagIds, itemTitles, onlyCollected, keywords,
|
|
95
|
+
# createUserId, updateUserId, excludeCreateUserId, excludeUpdateUserId, pageNo, pageSize
|
|
96
|
+
# @return [Hash] API响应
|
|
97
|
+
def get_list_by_source(params: {})
|
|
98
|
+
config = @request_config && @request_config["material_list_by_source"]
|
|
99
|
+
raise JPSClient::ExceptionError, "Missing config for material_list_by_source" unless config && config["url"]
|
|
100
|
+
|
|
101
|
+
path = config["url"]
|
|
102
|
+
|
|
103
|
+
return request_with_auth(:get, path, params: params)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# 分类素材详情(返回该分类下全部素材记录)
|
|
107
|
+
#
|
|
108
|
+
# @param params [Hash] categoryId*, materialTagIds, itemTagIds, itemTitles, keywords
|
|
109
|
+
# @return [Hash] API响应
|
|
110
|
+
def get_detail_by_category(params: {})
|
|
111
|
+
config = @request_config && @request_config["material_detail_by_category"]
|
|
112
|
+
raise JPSClient::ExceptionError, "Missing config for material_detail_by_category" unless config && config["url"]
|
|
113
|
+
|
|
114
|
+
path = config["url"]
|
|
115
|
+
|
|
116
|
+
return request_with_auth(:get, path, params: params)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# ==================== 素材配置管理 ====================
|
|
120
|
+
|
|
121
|
+
# 创建素材配置(按 scopeType 创建 instance/flow/state/screen)
|
|
122
|
+
#
|
|
123
|
+
# @param params [Hash] MaterialConfigCreateDto: scopeType*, name*, categoryId,
|
|
124
|
+
# lang, appVersion, device, identity, bizKey, description, flowType, note, groupName, weight
|
|
125
|
+
# @return [Hash] API响应
|
|
126
|
+
def create_material_config(params: {})
|
|
127
|
+
config = @request_config && @request_config["material_config_create"]
|
|
128
|
+
raise JPSClient::ExceptionError, "Missing config for material_config_create" unless config && config["url"]
|
|
129
|
+
|
|
130
|
+
path = config["url"]
|
|
131
|
+
|
|
132
|
+
return request_with_auth(:post, path, body: params)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# 更新素材配置(按 scopeType + id 更新,仅非空字段参与更新)
|
|
136
|
+
#
|
|
137
|
+
# @param params [Hash] MaterialConfigUpdateDto: scopeType*, id*, categoryId, name,
|
|
138
|
+
# lang, appVersion, device, identity, bizKey, description, flowType, note, groupName, weight
|
|
139
|
+
# @return [Hash] API响应
|
|
140
|
+
def update_material_config(params: {})
|
|
141
|
+
config = @request_config && @request_config["material_config_update"]
|
|
142
|
+
raise JPSClient::ExceptionError, "Missing config for material_config_update" unless config && config["url"]
|
|
143
|
+
|
|
144
|
+
path = config["url"]
|
|
145
|
+
|
|
146
|
+
return request_with_auth(:post, path, body: params)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# 删除素材配置(软删除指定 scopeType + id)
|
|
150
|
+
#
|
|
151
|
+
# @param params [Hash] MaterialConfigDeleteDto: scopeType*, id*
|
|
152
|
+
# @return [Hash] API响应
|
|
153
|
+
def delete_material_config(params: {})
|
|
154
|
+
config = @request_config && @request_config["material_config_delete"]
|
|
155
|
+
raise JPSClient::ExceptionError, "Missing config for material_config_delete" unless config && config["url"]
|
|
156
|
+
|
|
157
|
+
path = config["url"]
|
|
158
|
+
|
|
159
|
+
return request_with_auth(:post, path, body: params)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# 绑定分类可用配置(维护分类可用的 flow/state/screen 列表)
|
|
163
|
+
#
|
|
164
|
+
# @param params [Hash] MaterialCategoryScopeBindDto: categoryId*, scopeType*, scopeIds*
|
|
165
|
+
# @return [Hash] API响应
|
|
166
|
+
def bind_material_config(params: {})
|
|
167
|
+
config = @request_config && @request_config["material_config_bind"]
|
|
168
|
+
raise JPSClient::ExceptionError, "Missing config for material_config_bind" unless config && config["url"]
|
|
169
|
+
|
|
170
|
+
path = config["url"]
|
|
171
|
+
|
|
172
|
+
return request_with_auth(:post, path, body: params)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# 查询分类可用配置(instances、flows、states、screens)
|
|
176
|
+
#
|
|
177
|
+
# @param params [Hash] categoryId*, includeInherited
|
|
178
|
+
# @return [Hash] API响应
|
|
179
|
+
def get_material_config_options(params: {})
|
|
180
|
+
config = @request_config && @request_config["material_config_options"]
|
|
181
|
+
raise JPSClient::ExceptionError, "Missing config for material_config_options" unless config && config["url"]
|
|
182
|
+
|
|
183
|
+
path = config["url"]
|
|
184
|
+
|
|
185
|
+
return request_with_auth(:get, path, params: params)
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# ==================== 素材分区管理 ====================
|
|
189
|
+
|
|
190
|
+
# 创建素材分区(在指定素材下创建分区)
|
|
191
|
+
#
|
|
192
|
+
# @param params [Hash] MaterialPartitionCreateDto: materialId*, name*, color, weight
|
|
193
|
+
# @return [Hash] API响应
|
|
194
|
+
def create_material_partition(params: {})
|
|
195
|
+
config = @request_config && @request_config["material_partition_create"]
|
|
196
|
+
raise JPSClient::ExceptionError, "Missing config for material_partition_create" unless config && config["url"]
|
|
197
|
+
|
|
198
|
+
path = config["url"]
|
|
199
|
+
|
|
200
|
+
return request_with_auth(:post, path, body: params)
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# 更新素材分区(仅非空字段参与更新)
|
|
204
|
+
#
|
|
205
|
+
# @param params [Hash] MaterialPartitionUpdateDto: id*, name, color, weight
|
|
206
|
+
# @return [Hash] API响应
|
|
207
|
+
def update_material_partition(params: {})
|
|
208
|
+
config = @request_config && @request_config["material_partition_update"]
|
|
209
|
+
raise JPSClient::ExceptionError, "Missing config for material_partition_update" unless config && config["url"]
|
|
210
|
+
|
|
211
|
+
path = config["url"]
|
|
212
|
+
|
|
213
|
+
return request_with_auth(:post, path, body: params)
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# 删除素材分区(软删除,删除前把分区下未删 item 的 partitionId 置空)
|
|
217
|
+
#
|
|
218
|
+
# @param params [Hash] MaterialPartitionDeleteDto: id*
|
|
219
|
+
# @return [Hash] API响应
|
|
220
|
+
def delete_material_partition(params: {})
|
|
221
|
+
config = @request_config && @request_config["material_partition_delete"]
|
|
222
|
+
raise JPSClient::ExceptionError, "Missing config for material_partition_delete" unless config && config["url"]
|
|
223
|
+
|
|
224
|
+
path = config["url"]
|
|
225
|
+
|
|
226
|
+
return request_with_auth(:post, path, body: params)
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# ==================== 旧版素材接口 (/api/material,material-controller) ====================
|
|
230
|
+
# 与上方 v2 接口并存;别名统一 material_v1_ 前缀,方法名对与 v2 同名者加 _v1 后缀
|
|
231
|
+
|
|
232
|
+
# 新增素材(旧版)
|
|
233
|
+
#
|
|
234
|
+
# @param params [Hash] ResourceCreateDto: elementType*, content, sourceType*, sourceId*,
|
|
235
|
+
# name, categoryId*, partition, version, status, publishTime
|
|
236
|
+
# @return [Hash] API响应
|
|
237
|
+
def create_material_v1(params: {})
|
|
238
|
+
config = @request_config && @request_config["material_v1_create"]
|
|
239
|
+
raise JPSClient::ExceptionError, "Missing config for material_v1_create" unless config && config["url"]
|
|
240
|
+
|
|
241
|
+
path = config["url"]
|
|
242
|
+
|
|
243
|
+
return request_with_auth(:post, path, body: params)
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# 更新素材(旧版)
|
|
247
|
+
#
|
|
248
|
+
# @param params [Hash] ResourceUpdateDto: id*, content, name, categoryId, partition,
|
|
249
|
+
# version, status, publishTime, tagList, elementType
|
|
250
|
+
# @return [Hash] API响应
|
|
251
|
+
def update_material_v1(params: {})
|
|
252
|
+
config = @request_config && @request_config["material_v1_update"]
|
|
253
|
+
raise JPSClient::ExceptionError, "Missing config for material_v1_update" unless config && config["url"]
|
|
254
|
+
|
|
255
|
+
path = config["url"]
|
|
256
|
+
|
|
257
|
+
return request_with_auth(:post, path, body: params)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# 删除素材(旧版)
|
|
261
|
+
#
|
|
262
|
+
# @param params [Hash] BaseIdDtoInteger: id*
|
|
263
|
+
# @return [Hash] API响应
|
|
264
|
+
def delete_material_v1(params: {})
|
|
265
|
+
config = @request_config && @request_config["material_v1_delete"]
|
|
266
|
+
raise JPSClient::ExceptionError, "Missing config for material_v1_delete" unless config && config["url"]
|
|
267
|
+
|
|
268
|
+
path = config["url"]
|
|
269
|
+
|
|
270
|
+
return request_with_auth(:post, path, body: params)
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# 移动或者复制素材(旧版)
|
|
274
|
+
#
|
|
275
|
+
# @param params [Array] 数组,每项含 sourceId, targetId, type, elementType, content 等(前端实际传数组体)
|
|
276
|
+
# @return [Hash] API响应
|
|
277
|
+
def copy_or_trans_v1(params: [])
|
|
278
|
+
config = @request_config && @request_config["material_v1_copy_or_trans"]
|
|
279
|
+
raise JPSClient::ExceptionError, "Missing config for material_v1_copy_or_trans" unless config && config["url"]
|
|
280
|
+
|
|
281
|
+
path = config["url"]
|
|
282
|
+
|
|
283
|
+
return request_with_auth(:post, path, body: params)
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
# 批量新增素材,不支持创建素材版本(旧版)
|
|
287
|
+
#
|
|
288
|
+
# @param params [Hash] ResourceCreateByZipDto: zipUrl*, sourceType*, sourceId*, platform*, resourceType
|
|
289
|
+
# @return [Hash] API响应
|
|
290
|
+
def create_by_zip_v1(params: {})
|
|
291
|
+
config = @request_config && @request_config["material_v1_zip"]
|
|
292
|
+
raise JPSClient::ExceptionError, "Missing config for material_v1_zip" unless config && config["url"]
|
|
293
|
+
|
|
294
|
+
path = config["url"]
|
|
295
|
+
|
|
296
|
+
return request_with_auth(:post, path, body: params)
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# 素材库下发素材列表(旧版)
|
|
300
|
+
#
|
|
301
|
+
# @param params [Hash] ResourceSearchDto: page, pageSize, elementType, categoryId,
|
|
302
|
+
# keyword, sourceType, sourceId 等
|
|
303
|
+
# @return [Hash] API响应
|
|
304
|
+
def get_material_list_v1(params: {})
|
|
305
|
+
config = @request_config && @request_config["material_v1_list"]
|
|
306
|
+
raise JPSClient::ExceptionError, "Missing config for material_v1_list" unless config && config["url"]
|
|
307
|
+
|
|
308
|
+
path = config["url"]
|
|
309
|
+
|
|
310
|
+
return request_with_auth(:get, path, params: params)
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
# 应用详情下发素材列表(旧版)
|
|
314
|
+
#
|
|
315
|
+
# @param params [Hash] ResourceByTypeDto: sourceId*, resourceType 等
|
|
316
|
+
# @return [Hash] API响应
|
|
317
|
+
def get_list_by_source_v1(params: {})
|
|
318
|
+
config = @request_config && @request_config["material_v1_list_by_source"]
|
|
319
|
+
raise JPSClient::ExceptionError, "Missing config for material_v1_list_by_source" unless config && config["url"]
|
|
320
|
+
|
|
321
|
+
path = config["url"]
|
|
322
|
+
|
|
323
|
+
return request_with_auth(:get, path, params: params)
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
# 应用详情素材视频/图片信息(旧版,v2 无对应端点)
|
|
327
|
+
#
|
|
328
|
+
# @param params [Hash] sourceId
|
|
329
|
+
# @return [Hash] API响应
|
|
330
|
+
def get_medias_by_source(params: {})
|
|
331
|
+
config = @request_config && @request_config["material_v1_medias_by_source"]
|
|
332
|
+
raise JPSClient::ExceptionError, "Missing config for material_v1_medias_by_source" unless config && config["url"]
|
|
333
|
+
|
|
334
|
+
path = config["url"]
|
|
335
|
+
|
|
336
|
+
return request_with_auth(:get, path, params: params)
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
# 应用详情素材相关统计信息(旧版,v2 无对应端点)
|
|
340
|
+
#
|
|
341
|
+
# @param params [Hash] sourceId
|
|
342
|
+
# @return [Hash] API响应
|
|
343
|
+
def get_summary_by_source(params: {})
|
|
344
|
+
config = @request_config && @request_config["material_v1_summary_by_source"]
|
|
345
|
+
raise JPSClient::ExceptionError, "Missing config for material_v1_summary_by_source" unless config && config["url"]
|
|
346
|
+
|
|
347
|
+
path = config["url"]
|
|
348
|
+
|
|
349
|
+
return request_with_auth(:get, path, params: params)
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
end
|
|
353
|
+
end
|
|
@@ -61,7 +61,7 @@ module JPSClient
|
|
|
61
61
|
# @option params [String] :projectPackageId 项目包ID
|
|
62
62
|
# @return [Hash] API响应
|
|
63
63
|
def upload_nuget_package(projectId:nil, params:nil)
|
|
64
|
-
puts "========1111 upload_nuget_package" if
|
|
64
|
+
puts "========1111 upload_nuget_package" if JPSClient.debug?
|
|
65
65
|
config = @request_config && @request_config["project_package_upload_nuget"]
|
|
66
66
|
raise JPSClient::ExceptionError, "Missing config for project_package_upload_nuget" unless config && config["url"]
|
|
67
67
|
path = config["url"]
|
|
@@ -86,7 +86,7 @@ module JPSClient
|
|
|
86
86
|
# 移除值为nil的键
|
|
87
87
|
body_params.compact!
|
|
88
88
|
|
|
89
|
-
if
|
|
89
|
+
if JPSClient.debug?
|
|
90
90
|
puts "[DEBUG]upload_nuget_package upload_nuget_package 请求详情:"
|
|
91
91
|
puts "[DEBUG]upload_nuget_package URL: #{path}"
|
|
92
92
|
puts "[DEBUG]upload_nuget_package 请求体:"
|