jpsclient 1.3.0 → 1.4.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 +331 -0
- data/lib/jpsclient/api/cert.rb +4 -1
- data/lib/jpsclient/api/client.rb +68 -37
- data/lib/jpsclient/api/design.rb +123 -0
- data/lib/jpsclient/api/image_search.rb +74 -0
- data/lib/jpsclient/api/lark_card_message.rb +45 -0
- data/lib/jpsclient/api/lark_department.rb +44 -0
- data/lib/jpsclient/api/lark_file.rb +32 -0
- data/lib/jpsclient/api/lark_leave_approval.rb +47 -0
- data/lib/jpsclient/api/lark_message.rb +32 -0
- data/lib/jpsclient/api/nuget.rb +30 -0
- data/lib/jpsclient/api/permission.rb +137 -0
- data/lib/jpsclient/api/tag.rb +267 -45
- data/lib/jpsclient/api/template.rb +216 -0
- data/lib/jpsclient/auth/auth.rb +1 -1
- data/lib/jpsclient/http/http_client.rb +24 -4
- data/lib/jpsclient/upload/upload_client.rb +1 -1
- data/lib/jpsclient/version.rb +1 -1
- metadata +57 -18
- /data/lib/jpsclient/api/{app_resource_version.rb → archived_outdated/app_resource_version.rb} +0 -0
- /data/lib/jpsclient/api/{application_category.rb → archived_outdated/application_category.rb} +0 -0
- /data/lib/jpsclient/api/{application_design.rb → archived_outdated/application_design.rb} +0 -0
- /data/lib/jpsclient/api/{assets_category.rb → archived_outdated/assets_category.rb} +0 -0
- /data/lib/jpsclient/api/{experience.rb → archived_outdated/experience.rb} +0 -0
- /data/lib/jpsclient/api/{experience_category.rb → archived_outdated/experience_category.rb} +0 -0
- /data/lib/jpsclient/api/{icon_and_snapshot.rb → archived_outdated/icon_and_snapshot.rb} +0 -0
- /data/lib/jpsclient/api/{publisher_category.rb → archived_outdated/publisher_category.rb} +0 -0
- /data/lib/jpsclient/api/{publisher_group_category.rb → archived_outdated/publisher_group_category.rb} +0 -0
- /data/lib/jpsclient/api/{requirements_category.rb → archived_outdated/requirements_category.rb} +0 -0
- /data/lib/jpsclient/api/{resource_category.rb → archived_outdated/resource_category.rb} +0 -0
- /data/lib/jpsclient/api/{sketch_category.rb → archived_outdated/sketch_category.rb} +0 -0
- /data/lib/jpsclient/api/{survey_category.rb → archived_outdated/survey_category.rb} +0 -0
- /data/lib/jpsclient/api/{tool_category.rb → archived_outdated/tool_category.rb} +0 -0
- /data/lib/jpsclient/api/{jssdk.rb → js_sdk.rb} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5dc83223b65fce83cf83423489a63175292008cadba1fa25d20a428d5401cef0
|
|
4
|
+
data.tar.gz: 78c8a24b9d535fcd0bc64ab6add14c466c99725212ae0f5267a67248060d1ecb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a85d81582f25660667707be4c4370f0db5555ffd8ef805da89e23c54c4be94c0926b1e4f38b61bb98cb76807356e6f2b01898f855734e338e868a3a3c2717a1b
|
|
7
|
+
data.tar.gz: 25b41812658ae7a22d49359a849509129b233e951d4aacb0bc3c73a78cd3ba086fe3bd494c9c72a85f972a3109f8084414138ce16ac5963d64912069b73cabbf
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
module JPSClient
|
|
2
|
+
module API
|
|
3
|
+
# Category 相关 API
|
|
4
|
+
# 处理通用分类管理相关接口
|
|
5
|
+
module Category
|
|
6
|
+
|
|
7
|
+
# 获取分类列表
|
|
8
|
+
#
|
|
9
|
+
# @param params [Hash] 查询参数
|
|
10
|
+
# - type: 分类类型(可选)
|
|
11
|
+
# - parent_id: 父分类ID(可选)
|
|
12
|
+
# @return [Hash] API响应
|
|
13
|
+
def get_category_list(params: {})
|
|
14
|
+
config = @request_config && @request_config["category_list"]
|
|
15
|
+
raise JPSClient::ExceptionError, "Missing config for category_list" unless config && config["url"]
|
|
16
|
+
|
|
17
|
+
path = config["url"]
|
|
18
|
+
|
|
19
|
+
response = @http_client.get(path, params: params)
|
|
20
|
+
result = JPSClient::Response.new(response)
|
|
21
|
+
|
|
22
|
+
if result.need_login?
|
|
23
|
+
do_login(force_login: true)
|
|
24
|
+
response = @http_client.get(path, params: params)
|
|
25
|
+
result = JPSClient::Response.new(response)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
return result.to_h
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# 获取分类树形结构
|
|
32
|
+
#
|
|
33
|
+
# @param params [Hash] 查询参数
|
|
34
|
+
# - type: 分类类型(可选)
|
|
35
|
+
# - max_level: 最大层级深度(可选)
|
|
36
|
+
# @return [Hash] API响应,包含树形结构数据
|
|
37
|
+
def get_category_tree(params: {})
|
|
38
|
+
config = @request_config && @request_config["category_tree"]
|
|
39
|
+
raise JPSClient::ExceptionError, "Missing config for category_tree" unless config && config["url"]
|
|
40
|
+
|
|
41
|
+
path = config["url"]
|
|
42
|
+
|
|
43
|
+
response = @http_client.get(path, params: params)
|
|
44
|
+
result = JPSClient::Response.new(response)
|
|
45
|
+
|
|
46
|
+
if result.need_login?
|
|
47
|
+
do_login(force_login: true)
|
|
48
|
+
response = @http_client.get(path, params: params)
|
|
49
|
+
result = JPSClient::Response.new(response)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
return result.to_h
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# 创建分类
|
|
56
|
+
#
|
|
57
|
+
# @param params [Hash] 分类信息参数
|
|
58
|
+
# - name: 分类名称(必需)
|
|
59
|
+
# - type: 分类类型(必需)
|
|
60
|
+
# - parent_id: 父分类ID(可选,根分类不需要)
|
|
61
|
+
# - icon: 分类图标(可选)
|
|
62
|
+
# - description: 分类描述(可选)
|
|
63
|
+
# - sort_order: 排序值(可选,默认1)
|
|
64
|
+
# @return [Hash] API响应
|
|
65
|
+
def create_category(params: {})
|
|
66
|
+
config = @request_config && @request_config["category_create"]
|
|
67
|
+
raise JPSClient::ExceptionError, "Missing config for category_create" unless config && config["url"]
|
|
68
|
+
|
|
69
|
+
# 参数验证
|
|
70
|
+
required_fields = [:name, :type]
|
|
71
|
+
missing_fields = required_fields.select { |field| params[field].nil? || params[field].to_s.empty? }
|
|
72
|
+
|
|
73
|
+
if missing_fields.any?
|
|
74
|
+
raise JPSClient::ExceptionError, "Missing required fields: #{missing_fields.join(', ')}"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# 设置默认值
|
|
78
|
+
params[:sort_order] ||= 1
|
|
79
|
+
|
|
80
|
+
path = config["url"]
|
|
81
|
+
|
|
82
|
+
response = @http_client.post(path, body: params)
|
|
83
|
+
result = JPSClient::Response.new(response)
|
|
84
|
+
|
|
85
|
+
if result.need_login?
|
|
86
|
+
do_login(force_login: true)
|
|
87
|
+
response = @http_client.post(path, body: params)
|
|
88
|
+
result = JPSClient::Response.new(response)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
return result.to_h
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# 更新分类
|
|
95
|
+
#
|
|
96
|
+
# @param params [Hash] 更新参数
|
|
97
|
+
# - id: 分类ID(必需)
|
|
98
|
+
# - name: 分类名称
|
|
99
|
+
# - icon: 分类图标
|
|
100
|
+
# - description: 分类描述
|
|
101
|
+
# - sort_order: 排序值
|
|
102
|
+
# - status: 分类状态(1:启用, 0:停用)
|
|
103
|
+
# @return [Hash] API响应
|
|
104
|
+
def update_category(params: {})
|
|
105
|
+
config = @request_config && @request_config["category_update"]
|
|
106
|
+
raise JPSClient::ExceptionError, "Missing config for category_update" unless config && config["url"]
|
|
107
|
+
|
|
108
|
+
# ID 是必需的
|
|
109
|
+
raise JPSClient::ExceptionError, "Missing required field: id" unless params[:id]
|
|
110
|
+
|
|
111
|
+
path = config["url"]
|
|
112
|
+
|
|
113
|
+
response = @http_client.post(path, body: params)
|
|
114
|
+
result = JPSClient::Response.new(response)
|
|
115
|
+
|
|
116
|
+
if result.need_login?
|
|
117
|
+
do_login(force_login: true)
|
|
118
|
+
response = @http_client.post(path, body: params)
|
|
119
|
+
result = JPSClient::Response.new(response)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
return result.to_h
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# 删除分类
|
|
126
|
+
#
|
|
127
|
+
# @param id [String, Integer] 分类ID(必需)
|
|
128
|
+
# @return [Hash] API响应
|
|
129
|
+
def delete_category(id:)
|
|
130
|
+
config = @request_config && @request_config["category_delete"]
|
|
131
|
+
raise JPSClient::ExceptionError, "Missing config for category_delete" unless config && config["url"]
|
|
132
|
+
|
|
133
|
+
path = config["url"]
|
|
134
|
+
|
|
135
|
+
# POST请求,ID作为body参数
|
|
136
|
+
params = { id: id }
|
|
137
|
+
|
|
138
|
+
response = @http_client.post(path, body: params)
|
|
139
|
+
result = JPSClient::Response.new(response)
|
|
140
|
+
|
|
141
|
+
if result.need_login?
|
|
142
|
+
do_login(force_login: true)
|
|
143
|
+
response = @http_client.post(path, body: params)
|
|
144
|
+
result = JPSClient::Response.new(response)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
return result.to_h
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# 分类排序
|
|
151
|
+
#
|
|
152
|
+
# @param items [Array<Hash>] 排序项数组
|
|
153
|
+
# 每个项包含:
|
|
154
|
+
# - id: 分类ID
|
|
155
|
+
# - sort_order: 新的排序值
|
|
156
|
+
# @return [Hash] API响应
|
|
157
|
+
def sort_categories(items: [])
|
|
158
|
+
config = @request_config && @request_config["category_sort"]
|
|
159
|
+
raise JPSClient::ExceptionError, "Missing config for category_sort" unless config && config["url"]
|
|
160
|
+
|
|
161
|
+
if items.empty?
|
|
162
|
+
raise JPSClient::ExceptionError, "Items array cannot be empty"
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# 验证每个项都有必需的字段
|
|
166
|
+
items.each_with_index do |item, index|
|
|
167
|
+
unless item[:id] || item["id"]
|
|
168
|
+
raise JPSClient::ExceptionError, "Item at index #{index} missing 'id'"
|
|
169
|
+
end
|
|
170
|
+
unless item[:sort_order] || item["sort_order"]
|
|
171
|
+
raise JPSClient::ExceptionError, "Item at index #{index} missing 'sort_order'"
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
path = config["url"]
|
|
176
|
+
params = { items: items }
|
|
177
|
+
|
|
178
|
+
response = @http_client.post(path, body: params)
|
|
179
|
+
result = JPSClient::Response.new(response)
|
|
180
|
+
|
|
181
|
+
if result.need_login?
|
|
182
|
+
do_login(force_login: true)
|
|
183
|
+
response = @http_client.post(path, body: params)
|
|
184
|
+
result = JPSClient::Response.new(response)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
return result.to_h
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# 按类型获取分类列表(便捷方法)
|
|
191
|
+
#
|
|
192
|
+
# @param type [String] 分类类型
|
|
193
|
+
# - application: 应用分类
|
|
194
|
+
# - resource: 资源分类
|
|
195
|
+
# - asset: 素材分类
|
|
196
|
+
# - requirement: 需求分类
|
|
197
|
+
# - sketch: 画板分类
|
|
198
|
+
# - tool: 工具分类
|
|
199
|
+
# - survey: 调研分类
|
|
200
|
+
# - publisher: 发行商分类
|
|
201
|
+
# - experience: 体验分类
|
|
202
|
+
# @param parent_id [String, Integer, nil] 父分类ID
|
|
203
|
+
# @return [Hash] API响应
|
|
204
|
+
def get_categories_by_type(type:, parent_id: nil)
|
|
205
|
+
params = { type: type }
|
|
206
|
+
params[:parent_id] = parent_id if parent_id
|
|
207
|
+
get_category_list(params: params)
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# 获取某分类的所有子分类
|
|
211
|
+
#
|
|
212
|
+
# @param parent_id [String, Integer] 父分类ID
|
|
213
|
+
# @return [Hash] API响应
|
|
214
|
+
def get_subcategories(parent_id:)
|
|
215
|
+
get_category_list(params: { parent_id: parent_id })
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# 获取根分类列表
|
|
219
|
+
#
|
|
220
|
+
# @param type [String, nil] 分类类型(可选)
|
|
221
|
+
# @return [Hash] API响应
|
|
222
|
+
def get_root_categories(type: nil)
|
|
223
|
+
params = { parent_id: 0 } # parent_id 为 0 或 null 表示根分类
|
|
224
|
+
params[:type] = type if type
|
|
225
|
+
get_category_list(params: params)
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# 批量创建分类
|
|
229
|
+
# 注意:此方法会逐个调用 API,返回结果数组
|
|
230
|
+
#
|
|
231
|
+
# @param categories [Array<Hash>] 分类数组
|
|
232
|
+
# @return [Array<Hash>] 每个请求的响应结果
|
|
233
|
+
def batch_create_categories(categories: [])
|
|
234
|
+
return [] if categories.empty?
|
|
235
|
+
|
|
236
|
+
results = []
|
|
237
|
+
categories.each do |category_params|
|
|
238
|
+
result = create_category(params: category_params)
|
|
239
|
+
results << result
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
results
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# 移动分类到新的父分类
|
|
246
|
+
#
|
|
247
|
+
# @param category_id [String, Integer] 要移动的分类ID
|
|
248
|
+
# @param new_parent_id [String, Integer, nil] 新的父分类ID(nil表示移到根级)
|
|
249
|
+
# @return [Hash] API响应
|
|
250
|
+
def move_category(category_id:, new_parent_id: nil)
|
|
251
|
+
params = {
|
|
252
|
+
id: category_id,
|
|
253
|
+
parent_id: new_parent_id || 0
|
|
254
|
+
}
|
|
255
|
+
update_category(params: params)
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# 启用分类
|
|
259
|
+
#
|
|
260
|
+
# @param category_id [String, Integer] 分类ID
|
|
261
|
+
# @return [Hash] API响应
|
|
262
|
+
def enable_category(category_id:)
|
|
263
|
+
update_category(params: { id: category_id, status: 1 })
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# 停用分类
|
|
267
|
+
#
|
|
268
|
+
# @param category_id [String, Integer] 分类ID
|
|
269
|
+
# @return [Hash] API响应
|
|
270
|
+
def disable_category(category_id:)
|
|
271
|
+
update_category(params: { id: category_id, status: 0 })
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# 构建分类路径
|
|
275
|
+
# 根据分类ID获取从根到该分类的完整路径
|
|
276
|
+
#
|
|
277
|
+
# @param category_id [String, Integer] 分类ID
|
|
278
|
+
# @return [Array<Hash>] 分类路径数组,从根到目标分类
|
|
279
|
+
def get_category_path(category_id:)
|
|
280
|
+
response = get_category_list
|
|
281
|
+
|
|
282
|
+
# 如果请求失败,返回空数组
|
|
283
|
+
return [] unless response && response['data']
|
|
284
|
+
|
|
285
|
+
categories = response['data']['list'] || response['data'][:list] || []
|
|
286
|
+
path = []
|
|
287
|
+
|
|
288
|
+
current_id = category_id.to_s
|
|
289
|
+
while current_id
|
|
290
|
+
category = categories.find { |c|
|
|
291
|
+
(c['id'] || c[:id]).to_s == current_id
|
|
292
|
+
}
|
|
293
|
+
break unless category
|
|
294
|
+
|
|
295
|
+
path.unshift(category)
|
|
296
|
+
current_id = (category['parent_id'] || category[:parent_id])&.to_s
|
|
297
|
+
break if current_id == "0" || current_id.nil?
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
path
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
# 获取分类统计信息
|
|
304
|
+
# 统计某个分类下的直接子分类数量
|
|
305
|
+
#
|
|
306
|
+
# @param category_id [String, Integer] 分类ID
|
|
307
|
+
# @return [Hash] 包含统计数据的哈希
|
|
308
|
+
def get_category_statistics(category_id:)
|
|
309
|
+
response = get_subcategories(parent_id: category_id)
|
|
310
|
+
|
|
311
|
+
# 如果请求失败,返回空统计
|
|
312
|
+
unless response && response['data']
|
|
313
|
+
return {
|
|
314
|
+
category_id: category_id,
|
|
315
|
+
direct_children_count: 0,
|
|
316
|
+
children: []
|
|
317
|
+
}
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
child_list = response['data']['list'] || response['data'][:list] || []
|
|
321
|
+
|
|
322
|
+
{
|
|
323
|
+
category_id: category_id,
|
|
324
|
+
direct_children_count: child_list.size,
|
|
325
|
+
children: child_list
|
|
326
|
+
}
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
end
|
data/lib/jpsclient/api/cert.rb
CHANGED
|
@@ -6,7 +6,10 @@ module JPSClient
|
|
|
6
6
|
|
|
7
7
|
# 获取证书列表
|
|
8
8
|
def get_cert_list()
|
|
9
|
-
|
|
9
|
+
config = @request_config && @request_config["cert_list"]
|
|
10
|
+
raise JPSClient::ExceptionError, "Missing config for cert_list" unless config && config["url"]
|
|
11
|
+
|
|
12
|
+
path = config["url"]
|
|
10
13
|
|
|
11
14
|
response = @http_client.get(path)
|
|
12
15
|
result = JPSClient::Response.new(response)
|
data/lib/jpsclient/api/client.rb
CHANGED
|
@@ -11,16 +11,17 @@ require 'jpsclient/utils/logger'
|
|
|
11
11
|
# 加载 API 模块
|
|
12
12
|
require 'jpsclient/api/app_level'
|
|
13
13
|
require 'jpsclient/api/app_resource'
|
|
14
|
-
require 'jpsclient/api/app_resource_version'
|
|
14
|
+
# require 'jpsclient/api/app_resource_version' # 已移除 - API不存在
|
|
15
15
|
require 'jpsclient/api/apple_account'
|
|
16
16
|
require 'jpsclient/api/application'
|
|
17
|
-
require 'jpsclient/api/application_category'
|
|
18
|
-
require 'jpsclient/api/application_design
|
|
17
|
+
# require 'jpsclient/api/application_category' # 已移除 - API不存在
|
|
18
|
+
require 'jpsclient/api/design' # 替代 application_design
|
|
19
19
|
require 'jpsclient/api/application_income'
|
|
20
20
|
require 'jpsclient/api/application_sales'
|
|
21
21
|
require 'jpsclient/api/application_version'
|
|
22
|
-
require 'jpsclient/api/assets_category'
|
|
22
|
+
# require 'jpsclient/api/assets_category' # 已移除 - API不存在
|
|
23
23
|
require 'jpsclient/api/bug'
|
|
24
|
+
require 'jpsclient/api/category'
|
|
24
25
|
require 'jpsclient/api/cert'
|
|
25
26
|
require 'jpsclient/api/collect'
|
|
26
27
|
require 'jpsclient/api/collection'
|
|
@@ -29,15 +30,15 @@ require 'jpsclient/api/creative'
|
|
|
29
30
|
require 'jpsclient/api/custom_application'
|
|
30
31
|
require 'jpsclient/api/custom_application_web'
|
|
31
32
|
require 'jpsclient/api/document_text'
|
|
32
|
-
require 'jpsclient/api/experience'
|
|
33
|
-
require 'jpsclient/api/experience_category'
|
|
33
|
+
# require 'jpsclient/api/experience' # 已移除 - API不存在
|
|
34
|
+
# require 'jpsclient/api/experience_category' # 已移除 - API不存在
|
|
34
35
|
require 'jpsclient/api/fgui_export'
|
|
35
36
|
require 'jpsclient/api/file'
|
|
36
37
|
require 'jpsclient/api/game_assets'
|
|
37
38
|
require 'jpsclient/api/healthy'
|
|
38
|
-
require 'jpsclient/api/icon_and_snapshot'
|
|
39
|
+
# require 'jpsclient/api/icon_and_snapshot' # 已移除 - API不存在
|
|
39
40
|
require 'jpsclient/api/idea'
|
|
40
|
-
require 'jpsclient/api/
|
|
41
|
+
require 'jpsclient/api/js_sdk' # 重命名为 js_sdk
|
|
41
42
|
require 'jpsclient/api/lark_bitable'
|
|
42
43
|
require 'jpsclient/api/lark_chat_group'
|
|
43
44
|
require 'jpsclient/api/lark_comment'
|
|
@@ -47,30 +48,41 @@ require 'jpsclient/api/lark_task_section'
|
|
|
47
48
|
require 'jpsclient/api/lark_user'
|
|
48
49
|
require 'jpsclient/api/lark_wiki_node'
|
|
49
50
|
require 'jpsclient/api/lark_wiki_space'
|
|
51
|
+
# 添加新的飞书API
|
|
52
|
+
require 'jpsclient/api/lark_card_message'
|
|
53
|
+
require 'jpsclient/api/lark_message'
|
|
54
|
+
require 'jpsclient/api/lark_file'
|
|
55
|
+
require 'jpsclient/api/lark_department'
|
|
56
|
+
require 'jpsclient/api/lark_leave_approval'
|
|
50
57
|
require 'jpsclient/api/login'
|
|
51
58
|
require 'jpsclient/api/m3u8'
|
|
52
59
|
require 'jpsclient/api/menu'
|
|
60
|
+
# 添加新的核心API
|
|
61
|
+
require 'jpsclient/api/permission'
|
|
62
|
+
require 'jpsclient/api/image_search'
|
|
63
|
+
require 'jpsclient/api/nuget'
|
|
53
64
|
require 'jpsclient/api/project'
|
|
54
65
|
require 'jpsclient/api/project_package'
|
|
55
66
|
require 'jpsclient/api/publisher'
|
|
56
|
-
require 'jpsclient/api/publisher_category'
|
|
67
|
+
# require 'jpsclient/api/publisher_category' # 已移除 - API不存在
|
|
57
68
|
require 'jpsclient/api/publisher_group'
|
|
58
|
-
require 'jpsclient/api/publisher_group_category'
|
|
69
|
+
# require 'jpsclient/api/publisher_group_category' # 已移除 - API不存在
|
|
59
70
|
require 'jpsclient/api/requirements'
|
|
60
|
-
require 'jpsclient/api/requirements_category'
|
|
61
|
-
require 'jpsclient/api/resource_category'
|
|
71
|
+
# require 'jpsclient/api/requirements_category' # 已移除 - API不存在
|
|
72
|
+
# require 'jpsclient/api/resource_category' # 已移除 - API不存在
|
|
62
73
|
require 'jpsclient/api/role'
|
|
63
74
|
require 'jpsclient/api/simple_search'
|
|
64
75
|
require 'jpsclient/api/sketch'
|
|
65
|
-
require 'jpsclient/api/sketch_category'
|
|
76
|
+
# require 'jpsclient/api/sketch_category' # 已移除 - API不存在
|
|
66
77
|
require 'jpsclient/api/sov'
|
|
67
78
|
require 'jpsclient/api/statistics'
|
|
68
79
|
require 'jpsclient/api/store'
|
|
69
80
|
require 'jpsclient/api/survey'
|
|
70
|
-
require 'jpsclient/api/survey_category'
|
|
81
|
+
# require 'jpsclient/api/survey_category' # 已移除 - API不存在
|
|
71
82
|
require 'jpsclient/api/tag'
|
|
83
|
+
require 'jpsclient/api/template'
|
|
72
84
|
require 'jpsclient/api/tool'
|
|
73
|
-
require 'jpsclient/api/tool_category'
|
|
85
|
+
# require 'jpsclient/api/tool_category' # 已移除 - API不存在
|
|
74
86
|
require 'jpsclient/api/trending'
|
|
75
87
|
require 'jpsclient/api/ud_id'
|
|
76
88
|
require 'jpsclient/api/user'
|
|
@@ -85,16 +97,17 @@ module JPSClient
|
|
|
85
97
|
# 引入各个 API 模块
|
|
86
98
|
include API::AppLevel
|
|
87
99
|
include API::AppResource
|
|
88
|
-
include API::AppResourceVersion
|
|
100
|
+
# include API::AppResourceVersion # 已移除 - API不存在
|
|
89
101
|
include API::AppleAccount
|
|
90
102
|
include API::Application
|
|
91
|
-
include API::ApplicationCategory
|
|
92
|
-
include API::ApplicationDesign
|
|
103
|
+
# include API::ApplicationCategory # 已移除 - API不存在
|
|
104
|
+
include API::Design # 替代 ApplicationDesign
|
|
93
105
|
include API::ApplicationIncome
|
|
94
106
|
include API::ApplicationSales
|
|
95
107
|
include API::ApplicationVersion
|
|
96
|
-
include API::AssetsCategory
|
|
108
|
+
# include API::AssetsCategory # 已移除 - API不存在
|
|
97
109
|
include API::Bug
|
|
110
|
+
include API::Category
|
|
98
111
|
include API::Cert
|
|
99
112
|
include API::Collect
|
|
100
113
|
include API::Collection
|
|
@@ -103,15 +116,15 @@ module JPSClient
|
|
|
103
116
|
include API::CustomApplication
|
|
104
117
|
include API::CustomApplicationWeb
|
|
105
118
|
include API::DocumentText
|
|
106
|
-
include API::Experience
|
|
107
|
-
include API::ExperienceCategory
|
|
119
|
+
# include API::Experience # 已移除 - API不存在
|
|
120
|
+
# include API::ExperienceCategory # 已移除 - API不存在
|
|
108
121
|
include API::FguiExport
|
|
109
122
|
include API::File
|
|
110
123
|
include API::GameAssets
|
|
111
124
|
include API::Healthy
|
|
112
|
-
include API::IconAndSnapshot
|
|
125
|
+
# include API::IconAndSnapshot # 已移除 - API不存在
|
|
113
126
|
include API::Idea
|
|
114
|
-
include API::Jssdk
|
|
127
|
+
include API::Jssdk # 模块名应该是 Jssdk
|
|
115
128
|
include API::LarkBitable
|
|
116
129
|
include API::LarkChatGroup
|
|
117
130
|
include API::LarkComment
|
|
@@ -121,30 +134,41 @@ module JPSClient
|
|
|
121
134
|
include API::LarkUser
|
|
122
135
|
include API::LarkWikiNode
|
|
123
136
|
include API::LarkWikiSpace
|
|
137
|
+
# 添加新的飞书API模块
|
|
138
|
+
include API::LarkCardMessage
|
|
139
|
+
include API::LarkMessage
|
|
140
|
+
include API::LarkFile
|
|
141
|
+
include API::LarkDepartment
|
|
142
|
+
include API::LarkLeaveApproval
|
|
124
143
|
include API::Login
|
|
125
144
|
include API::M3u8
|
|
126
145
|
include API::Menu
|
|
146
|
+
# 添加新的核心API模块
|
|
147
|
+
include API::Permission
|
|
148
|
+
include API::ImageSearch
|
|
149
|
+
include API::NuGet
|
|
127
150
|
include API::Project
|
|
128
151
|
include API::ProjectPackage
|
|
129
152
|
include API::Publisher
|
|
130
|
-
include API::PublisherCategory
|
|
153
|
+
# include API::PublisherCategory # 已移除 - API不存在
|
|
131
154
|
include API::PublisherGroup
|
|
132
|
-
include API::PublisherGroupCategory
|
|
155
|
+
# include API::PublisherGroupCategory # 已移除 - API不存在
|
|
133
156
|
include API::Requirements
|
|
134
|
-
include API::RequirementsCategory
|
|
135
|
-
include API::ResourceCategory
|
|
157
|
+
# include API::RequirementsCategory # 已移除 - API不存在
|
|
158
|
+
# include API::ResourceCategory # 已移除 - API不存在
|
|
136
159
|
include API::Role
|
|
137
160
|
include API::SimpleSearch
|
|
138
161
|
include API::Sketch
|
|
139
|
-
include API::SketchCategory
|
|
162
|
+
# include API::SketchCategory # 已移除 - API不存在
|
|
140
163
|
include API::Sov
|
|
141
164
|
include API::Statistics
|
|
142
165
|
include API::Store
|
|
143
166
|
include API::Survey
|
|
144
|
-
include API::SurveyCategory
|
|
167
|
+
# include API::SurveyCategory # 已移除 - API不存在
|
|
145
168
|
include API::Tag
|
|
169
|
+
include API::Template
|
|
146
170
|
include API::Tool
|
|
147
|
-
include API::ToolCategory
|
|
171
|
+
# include API::ToolCategory # 已移除 - API不存在
|
|
148
172
|
include API::Trending
|
|
149
173
|
include API::UdId
|
|
150
174
|
include API::User
|
|
@@ -161,14 +185,21 @@ module JPSClient
|
|
|
161
185
|
attr_reader :config_json # 暴露配置供其他模块使用
|
|
162
186
|
attr_reader :config_file # 配置文件路径
|
|
163
187
|
|
|
164
|
-
def initialize(config_file:)
|
|
188
|
+
def initialize(config_file: nil, config: nil)
|
|
165
189
|
begin
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
190
|
+
# 支持两种初始化方式:从文件或直接配置
|
|
191
|
+
if config
|
|
192
|
+
# 直接使用提供的配置(主要用于测试)
|
|
193
|
+
@config_json = config
|
|
194
|
+
@config_file = nil
|
|
195
|
+
elsif config_file
|
|
196
|
+
# 从文件加载配置
|
|
197
|
+
@config_file = config_file
|
|
198
|
+
raise ExceptionError, "配置文件不存在: #{@config_file}" unless File.exist?(@config_file)
|
|
199
|
+
@config_json = JSON.parse(File.read(@config_file))
|
|
200
|
+
else
|
|
201
|
+
raise ExceptionError, "必须提供配置文件路径或配置对象"
|
|
202
|
+
end
|
|
172
203
|
|
|
173
204
|
@baseurl = @config_json["pgyerapps_base_url"]
|
|
174
205
|
@request_config = @config_json["api_path_config"]
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
module JPSClient
|
|
2
|
+
module API
|
|
3
|
+
# Design 相关 API
|
|
4
|
+
# 处理应用设计相关接口
|
|
5
|
+
module Design
|
|
6
|
+
|
|
7
|
+
# 导入设计
|
|
8
|
+
#
|
|
9
|
+
# @param params [Hash] 导入参数
|
|
10
|
+
# @return [Hash] API响应
|
|
11
|
+
def import_design(params: {})
|
|
12
|
+
config = @request_config && @request_config["design_import"]
|
|
13
|
+
raise JPSClient::ExceptionError, "Missing config for design_import" unless config && config["url"]
|
|
14
|
+
|
|
15
|
+
path = config["url"]
|
|
16
|
+
|
|
17
|
+
response = @http_client.post(path, body: params)
|
|
18
|
+
result = JPSClient::Response.new(response)
|
|
19
|
+
|
|
20
|
+
if result.need_login?
|
|
21
|
+
do_login(force_login: true)
|
|
22
|
+
response = @http_client.post(path, body: params)
|
|
23
|
+
result = JPSClient::Response.new(response)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
return result.to_h
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# 检查设计
|
|
30
|
+
#
|
|
31
|
+
# @param params [Hash] 检查参数
|
|
32
|
+
# @return [Hash] API响应
|
|
33
|
+
def check_design(params: {})
|
|
34
|
+
config = @request_config && @request_config["design_check"]
|
|
35
|
+
raise JPSClient::ExceptionError, "Missing config for design_check" unless config && config["url"]
|
|
36
|
+
|
|
37
|
+
path = config["url"]
|
|
38
|
+
|
|
39
|
+
response = @http_client.post(path, body: params)
|
|
40
|
+
result = JPSClient::Response.new(response)
|
|
41
|
+
|
|
42
|
+
if result.need_login?
|
|
43
|
+
do_login(force_login: true)
|
|
44
|
+
response = @http_client.post(path, body: params)
|
|
45
|
+
result = JPSClient::Response.new(response)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
return result.to_h
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# 获取分类下的设计稿列表
|
|
52
|
+
#
|
|
53
|
+
# @param params [Hash] 请求参数
|
|
54
|
+
# @return [Hash] API响应
|
|
55
|
+
def get_category_designs(params: {})
|
|
56
|
+
config = @request_config && @request_config["design_category_designs"]
|
|
57
|
+
raise JPSClient::ExceptionError, "Missing config for design_category_designs" unless config && config["url"]
|
|
58
|
+
|
|
59
|
+
path = config["url"]
|
|
60
|
+
|
|
61
|
+
response = @http_client.post(path, body: params)
|
|
62
|
+
result = JPSClient::Response.new(response)
|
|
63
|
+
|
|
64
|
+
if result.need_login?
|
|
65
|
+
do_login(force_login: true)
|
|
66
|
+
response = @http_client.post(path, body: params)
|
|
67
|
+
result = JPSClient::Response.new(response)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
return result.to_h
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# 获取应用设计稿版本列表
|
|
74
|
+
#
|
|
75
|
+
# @param app_id [String, Integer] 应用ID(必需)
|
|
76
|
+
# @param params [Hash] 其他参数(可选)
|
|
77
|
+
# @return [Hash] API响应
|
|
78
|
+
def get_app_design_versions(app_id:, params: {})
|
|
79
|
+
config = @request_config && @request_config["design_app_versions"]
|
|
80
|
+
raise JPSClient::ExceptionError, "Missing config for design_app_versions" unless config && config["url"]
|
|
81
|
+
|
|
82
|
+
path = config["url"]
|
|
83
|
+
body = params.merge(app_id: app_id)
|
|
84
|
+
|
|
85
|
+
response = @http_client.post(path, body: body)
|
|
86
|
+
result = JPSClient::Response.new(response)
|
|
87
|
+
|
|
88
|
+
if result.need_login?
|
|
89
|
+
do_login(force_login: true)
|
|
90
|
+
response = @http_client.post(path, body: body)
|
|
91
|
+
result = JPSClient::Response.new(response)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
return result.to_h
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# 获取应用设计稿列表
|
|
98
|
+
#
|
|
99
|
+
# @param app_id [String, Integer] 应用ID(必需)
|
|
100
|
+
# @param params [Hash] 其他参数(可选)
|
|
101
|
+
# @return [Hash] API响应
|
|
102
|
+
def get_app_designs(app_id:, params: {})
|
|
103
|
+
config = @request_config && @request_config["design_app_designs"]
|
|
104
|
+
raise JPSClient::ExceptionError, "Missing config for design_app_designs" unless config && config["url"]
|
|
105
|
+
|
|
106
|
+
path = config["url"]
|
|
107
|
+
body = params.merge(app_id: app_id)
|
|
108
|
+
|
|
109
|
+
response = @http_client.post(path, body: body)
|
|
110
|
+
result = JPSClient::Response.new(response)
|
|
111
|
+
|
|
112
|
+
if result.need_login?
|
|
113
|
+
do_login(force_login: true)
|
|
114
|
+
response = @http_client.post(path, body: body)
|
|
115
|
+
result = JPSClient::Response.new(response)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
return result.to_h
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|