jpsclient 2.4.1 → 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.
@@ -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 ENV['PINDO_DEBUG']
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 ENV['PINDO_DEBUG']
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 请求体:"