uapi-browser-sdk 0.1.3 → 0.1.4

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/src/index.ts CHANGED
@@ -1,582 +1,751 @@
1
- export class UapiError extends Error {
2
- constructor(public code: string, public status: number, public details?: any) {
3
- super(`${status} ${code}`)
4
- }
5
- }
6
-
7
- export class UapiClient {
8
- constructor(private baseURL: string, private token?: string) {
9
- ;(this as any)["Clipzy 在线剪贴板"] = this.clipzyZaiXianJianTieBan
10
- ;(this as any)["Convert"] = this.convert
11
- ;(this as any)["Daily"] = this.daily
12
- ;(this as any)["Game"] = this.game
13
- ;(this as any)["Image"] = this.image
14
- ;(this as any)["Misc"] = this.misc
15
- ;(this as any)["Network"] = this.network
16
- ;(this as any)["Poem"] = this.poem
17
- ;(this as any)["Random"] = this.random
18
- ;(this as any)["Social"] = this.social
19
- ;(this as any)["Status"] = this.status
20
- ;(this as any)["Text"] = this.text
21
- ;(this as any)["Translate"] = this.translate
22
- ;(this as any)["WebParse"] = this.webparse
23
- ;(this as any)["敏感词识别"] = this.minGanCiShiBie
24
- ;(this as any)["智能搜索"] = this.zhiNengSouSuo
25
- }
26
- clipzyZaiXianJianTieBan = new ClipzyZaiXianJianTieBanApi(this)
27
- convert = new ConvertApi(this)
28
- daily = new DailyApi(this)
29
- game = new GameApi(this)
30
- image = new ImageApi(this)
31
- misc = new MiscApi(this)
32
- network = new NetworkApi(this)
33
- poem = new PoemApi(this)
34
- random = new RandomApi(this)
35
- social = new SocialApi(this)
36
- status = new StatusApi(this)
37
- text = new TextApi(this)
38
- translate = new TranslateApi(this)
39
- webparse = new WebparseApi(this)
40
- minGanCiShiBie = new MinGanCiShiBieApi(this)
41
- zhiNengSouSuo = new ZhiNengSouSuoApi(this)
42
- async _request(method: string, path: string, params?: Record<string,any>, body?: any) {
43
- const url = new URL(this.baseURL.replace(/\/$/, '') + path)
44
- if (params) Object.entries(params).forEach(([k,v]) => url.searchParams.set(k, String(v)))
45
- const res = await fetch(url.toString(), { method, headers: { 'Content-Type':'application/json', ...(this.token ? { Authorization: `Bearer ${this.token}` } : {}) }, body: body ? JSON.stringify(body) : undefined })
46
- if (!res.ok) {
47
- let data:any=null; try { data = await res.json() } catch {}
48
- const code = (data?.code || 'API_ERROR').toUpperCase()
49
- throw new UapiError(code, res.status, data?.details)
50
- }
51
- const ct = res.headers.get('content-type') || ''
52
- return ct.includes('application/json') ? res.json() : res.arrayBuffer()
53
- }
54
- }
55
- class ClipzyZaiXianJianTieBanApi {
56
- constructor(private c: UapiClient) {}
57
- async getClipzyGet(args: any = {}): Promise<any> {
58
- const params:any = {}
59
- if (args["id"] !== undefined) params["id"] = args["id"]
60
- let path = '/api/v1/api/get'
61
- return this.c._request('GET', path, params)
62
- }
63
- async getClipzyRaw(args: any = {}): Promise<any> {
64
- const params:any = {}
65
- if (args["key"] !== undefined) params["key"] = args["key"]
66
- let path = '/api/v1/api/raw/{id}'
67
- if (args['id'] !== undefined) path = path.replace('{' + 'id' + '}', String(args['id']))
68
- return this.c._request('GET', path, params)
69
- }
70
- async postClipzyStore(args: any = {}): Promise<any> {
71
- const params:any = {}
72
- let path = '/api/v1/api/store'
73
- return this.c._request('POST', path, params)
74
- }
75
- }
76
- class ConvertApi {
77
- constructor(private c: UapiClient) {}
78
- async getConvertUnixtime(args: any = {}): Promise<any> {
79
- const params:any = {}
80
- if (args["time"] !== undefined) params["time"] = args["time"]
81
- let path = '/api/v1/convert/unixtime'
82
- return this.c._request('GET', path, params)
83
- }
84
- async postConvertJson(args: any = {}): Promise<any> {
85
- const params:any = {}
86
- let path = '/api/v1/convert/json'
87
- return this.c._request('POST', path, params)
88
- }
89
- }
90
- class DailyApi {
91
- constructor(private c: UapiClient) {}
92
- async getDailyNewsImage(args: any = {}): Promise<any> {
93
- const params:any = {}
94
- let path = '/api/v1/daily/news-image'
95
- return this.c._request('GET', path, params)
96
- }
97
- }
98
- class GameApi {
99
- constructor(private c: UapiClient) {}
100
- async getGameEpicFree(args: any = {}): Promise<any> {
101
- const params:any = {}
102
- let path = '/api/v1/game/epic-free'
103
- return this.c._request('GET', path, params)
104
- }
105
- async getGameMinecraftHistoryid(args: any = {}): Promise<any> {
106
- const params:any = {}
107
- if (args["uuid"] !== undefined) params["uuid"] = args["uuid"]
108
- let path = '/api/v1/game/minecraft/historyid'
109
- return this.c._request('GET', path, params)
110
- }
111
- async getGameMinecraftServerstatus(args: any = {}): Promise<any> {
112
- const params:any = {}
113
- if (args["server"] !== undefined) params["server"] = args["server"]
114
- let path = '/api/v1/game/minecraft/serverstatus'
115
- return this.c._request('GET', path, params)
116
- }
117
- async getGameMinecraftUserinfo(args: any = {}): Promise<any> {
118
- const params:any = {}
119
- if (args["username"] !== undefined) params["username"] = args["username"]
120
- let path = '/api/v1/game/minecraft/userinfo'
121
- return this.c._request('GET', path, params)
122
- }
123
- async getGameSteamSummary(args: any = {}): Promise<any> {
124
- const params:any = {}
125
- if (args["steamid"] !== undefined) params["steamid"] = args["steamid"]
126
- if (args["id"] !== undefined) params["id"] = args["id"]
127
- if (args["id3"] !== undefined) params["id3"] = args["id3"]
128
- if (args["key"] !== undefined) params["key"] = args["key"]
129
- let path = '/api/v1/game/steam/summary'
130
- return this.c._request('GET', path, params)
131
- }
132
- }
133
- class ImageApi {
134
- constructor(private c: UapiClient) {}
135
- async getAvatarGravatar(args: any = {}): Promise<any> {
136
- const params:any = {}
137
- if (args["email"] !== undefined) params["email"] = args["email"]
138
- if (args["hash"] !== undefined) params["hash"] = args["hash"]
139
- if (args["s"] !== undefined) params["s"] = args["s"]
140
- if (args["d"] !== undefined) params["d"] = args["d"]
141
- if (args["r"] !== undefined) params["r"] = args["r"]
142
- let path = '/api/v1/avatar/gravatar'
143
- return this.c._request('GET', path, params)
144
- }
145
- async getImageBingDaily(args: any = {}): Promise<any> {
146
- const params:any = {}
147
- let path = '/api/v1/image/bing-daily'
148
- return this.c._request('GET', path, params)
149
- }
150
- async getImageMotou(args: any = {}): Promise<any> {
151
- const params:any = {}
152
- if (args["qq"] !== undefined) params["qq"] = args["qq"]
153
- if (args["bg_color"] !== undefined) params["bg_color"] = args["bg_color"]
154
- let path = '/api/v1/image/motou'
155
- return this.c._request('GET', path, params)
156
- }
157
- async getImageQrcode(args: any = {}): Promise<any> {
158
- const params:any = {}
159
- if (args["text"] !== undefined) params["text"] = args["text"]
160
- if (args["size"] !== undefined) params["size"] = args["size"]
161
- if (args["format"] !== undefined) params["format"] = args["format"]
162
- let path = '/api/v1/image/qrcode'
163
- return this.c._request('GET', path, params)
164
- }
165
- async getImageTobase64(args: any = {}): Promise<any> {
166
- const params:any = {}
167
- if (args["url"] !== undefined) params["url"] = args["url"]
168
- let path = '/api/v1/image/tobase64'
169
- return this.c._request('GET', path, params)
170
- }
171
- async postImageCompress(args: any = {}): Promise<any> {
172
- const params:any = {}
173
- if (args["level"] !== undefined) params["level"] = args["level"]
174
- if (args["format"] !== undefined) params["format"] = args["format"]
175
- let path = '/api/v1/image/compress'
176
- return this.c._request('POST', path, params)
177
- }
178
- async postImageFrombase64(args: any = {}): Promise<any> {
179
- const params:any = {}
180
- let path = '/api/v1/image/frombase64'
181
- return this.c._request('POST', path, params)
182
- }
183
- async postImageMotou(args: any = {}): Promise<any> {
184
- const params:any = {}
185
- let path = '/api/v1/image/motou'
186
- return this.c._request('POST', path, params)
187
- }
188
- async postImageSpeechless(args: any = {}): Promise<any> {
189
- const params:any = {}
190
- let path = '/api/v1/image/speechless'
191
- return this.c._request('POST', path, params)
192
- }
193
- async postImageSvg(args: any = {}): Promise<any> {
194
- const params:any = {}
195
- if (args["format"] !== undefined) params["format"] = args["format"]
196
- if (args["width"] !== undefined) params["width"] = args["width"]
197
- if (args["height"] !== undefined) params["height"] = args["height"]
198
- if (args["quality"] !== undefined) params["quality"] = args["quality"]
199
- let path = '/api/v1/image/svg'
200
- return this.c._request('POST', path, params)
201
- }
202
- }
203
- class MiscApi {
204
- constructor(private c: UapiClient) {}
205
- async getHistoryProgrammer(args: any = {}): Promise<any> {
206
- const params:any = {}
207
- if (args["month"] !== undefined) params["month"] = args["month"]
208
- if (args["day"] !== undefined) params["day"] = args["day"]
209
- let path = '/api/v1/history/programmer'
210
- return this.c._request('GET', path, params)
211
- }
212
- async getHistoryProgrammerToday(args: any = {}): Promise<any> {
213
- const params:any = {}
214
- let path = '/api/v1/history/programmer/today'
215
- return this.c._request('GET', path, params)
216
- }
217
- async getMiscHotboard(args: any = {}): Promise<any> {
218
- const params:any = {}
219
- if (args["type"] !== undefined) params["type"] = args["type"]
220
- let path = '/api/v1/misc/hotboard'
221
- return this.c._request('GET', path, params)
222
- }
223
- async getMiscPhoneinfo(args: any = {}): Promise<any> {
224
- const params:any = {}
225
- if (args["phone"] !== undefined) params["phone"] = args["phone"]
226
- let path = '/api/v1/misc/phoneinfo'
227
- return this.c._request('GET', path, params)
228
- }
229
- async getMiscRandomnumber(args: any = {}): Promise<any> {
230
- const params:any = {}
231
- if (args["min"] !== undefined) params["min"] = args["min"]
232
- if (args["max"] !== undefined) params["max"] = args["max"]
233
- if (args["count"] !== undefined) params["count"] = args["count"]
234
- if (args["allow_repeat"] !== undefined) params["allow_repeat"] = args["allow_repeat"]
235
- if (args["allow_decimal"] !== undefined) params["allow_decimal"] = args["allow_decimal"]
236
- if (args["decimal_places"] !== undefined) params["decimal_places"] = args["decimal_places"]
237
- let path = '/api/v1/misc/randomnumber'
238
- return this.c._request('GET', path, params)
239
- }
240
- async getMiscTimestamp(args: any = {}): Promise<any> {
241
- const params:any = {}
242
- if (args["ts"] !== undefined) params["ts"] = args["ts"]
243
- let path = '/api/v1/misc/timestamp'
244
- return this.c._request('GET', path, params)
245
- }
246
- async getMiscTrackingCarriers(args: any = {}): Promise<any> {
247
- const params:any = {}
248
- let path = '/api/v1/misc/tracking/carriers'
249
- return this.c._request('GET', path, params)
250
- }
251
- async getMiscTrackingDetect(args: any = {}): Promise<any> {
252
- const params:any = {}
253
- if (args["tracking_number"] !== undefined) params["tracking_number"] = args["tracking_number"]
254
- let path = '/api/v1/misc/tracking/detect'
255
- return this.c._request('GET', path, params)
256
- }
257
- async getMiscTrackingQuery(args: any = {}): Promise<any> {
258
- const params:any = {}
259
- if (args["tracking_number"] !== undefined) params["tracking_number"] = args["tracking_number"]
260
- if (args["carrier_code"] !== undefined) params["carrier_code"] = args["carrier_code"]
261
- let path = '/api/v1/misc/tracking/query'
262
- return this.c._request('GET', path, params)
263
- }
264
- async getMiscWeather(args: any = {}): Promise<any> {
265
- const params:any = {}
266
- if (args["city"] !== undefined) params["city"] = args["city"]
267
- if (args["adcode"] !== undefined) params["adcode"] = args["adcode"]
268
- let path = '/api/v1/misc/weather'
269
- return this.c._request('GET', path, params)
270
- }
271
- async getMiscWorldtime(args: any = {}): Promise<any> {
272
- const params:any = {}
273
- if (args["city"] !== undefined) params["city"] = args["city"]
274
- let path = '/api/v1/misc/worldtime'
275
- return this.c._request('GET', path, params)
276
- }
277
- }
278
- class NetworkApi {
279
- constructor(private c: UapiClient) {}
280
- async getNetworkDns(args: any = {}): Promise<any> {
281
- const params:any = {}
282
- if (args["domain"] !== undefined) params["domain"] = args["domain"]
283
- if (args["type"] !== undefined) params["type"] = args["type"]
284
- let path = '/api/v1/network/dns'
285
- return this.c._request('GET', path, params)
286
- }
287
- async getNetworkIcp(args: any = {}): Promise<any> {
288
- const params:any = {}
289
- if (args["domain"] !== undefined) params["domain"] = args["domain"]
290
- let path = '/api/v1/network/icp'
291
- return this.c._request('GET', path, params)
292
- }
293
- async getNetworkIpinfo(args: any = {}): Promise<any> {
294
- const params:any = {}
295
- if (args["ip"] !== undefined) params["ip"] = args["ip"]
296
- if (args["source"] !== undefined) params["source"] = args["source"]
297
- let path = '/api/v1/network/ipinfo'
298
- return this.c._request('GET', path, params)
299
- }
300
- async getNetworkMyip(args: any = {}): Promise<any> {
301
- const params:any = {}
302
- if (args["source"] !== undefined) params["source"] = args["source"]
303
- let path = '/api/v1/network/myip'
304
- return this.c._request('GET', path, params)
305
- }
306
- async getNetworkPing(args: any = {}): Promise<any> {
307
- const params:any = {}
308
- if (args["host"] !== undefined) params["host"] = args["host"]
309
- let path = '/api/v1/network/ping'
310
- return this.c._request('GET', path, params)
311
- }
312
- async getNetworkPingmyip(args: any = {}): Promise<any> {
313
- const params:any = {}
314
- let path = '/api/v1/network/pingmyip'
315
- return this.c._request('GET', path, params)
316
- }
317
- async getNetworkPortscan(args: any = {}): Promise<any> {
318
- const params:any = {}
319
- if (args["host"] !== undefined) params["host"] = args["host"]
320
- if (args["port"] !== undefined) params["port"] = args["port"]
321
- if (args["protocol"] !== undefined) params["protocol"] = args["protocol"]
322
- let path = '/api/v1/network/portscan'
323
- return this.c._request('GET', path, params)
324
- }
325
- async getNetworkUrlstatus(args: any = {}): Promise<any> {
326
- const params:any = {}
327
- if (args["url"] !== undefined) params["url"] = args["url"]
328
- let path = '/api/v1/network/urlstatus'
329
- return this.c._request('GET', path, params)
330
- }
331
- async getNetworkWhois(args: any = {}): Promise<any> {
332
- const params:any = {}
333
- if (args["domain"] !== undefined) params["domain"] = args["domain"]
334
- if (args["format"] !== undefined) params["format"] = args["format"]
335
- let path = '/api/v1/network/whois'
336
- return this.c._request('GET', path, params)
337
- }
338
- async getNetworkWxdomain(args: any = {}): Promise<any> {
339
- const params:any = {}
340
- if (args["domain"] !== undefined) params["domain"] = args["domain"]
341
- let path = '/api/v1/network/wxdomain'
342
- return this.c._request('GET', path, params)
343
- }
344
- }
345
- class PoemApi {
346
- constructor(private c: UapiClient) {}
347
- async getSaying(args: any = {}): Promise<any> {
348
- const params:any = {}
349
- let path = '/api/v1/saying'
350
- return this.c._request('GET', path, params)
351
- }
352
- }
353
- class RandomApi {
354
- constructor(private c: UapiClient) {}
355
- async getAnswerbookAsk(args: any = {}): Promise<any> {
356
- const params:any = {}
357
- if (args["question"] !== undefined) params["question"] = args["question"]
358
- let path = '/api/v1/answerbook/ask'
359
- return this.c._request('GET', path, params)
360
- }
361
- async getRandomImage(args: any = {}): Promise<any> {
362
- const params:any = {}
363
- if (args["category"] !== undefined) params["category"] = args["category"]
364
- if (args["type"] !== undefined) params["type"] = args["type"]
365
- let path = '/api/v1/random/image'
366
- return this.c._request('GET', path, params)
367
- }
368
- async getRandomString(args: any = {}): Promise<any> {
369
- const params:any = {}
370
- if (args["length"] !== undefined) params["length"] = args["length"]
371
- if (args["type"] !== undefined) params["type"] = args["type"]
372
- let path = '/api/v1/random/string'
373
- return this.c._request('GET', path, params)
374
- }
375
- async postAnswerbookAsk(args: any = {}): Promise<any> {
376
- const params:any = {}
377
- let path = '/api/v1/answerbook/ask'
378
- return this.c._request('POST', path, params)
379
- }
380
- }
381
- class SocialApi {
382
- constructor(private c: UapiClient) {}
383
- async getGithubRepo(args: any = {}): Promise<any> {
384
- const params:any = {}
385
- if (args["repo"] !== undefined) params["repo"] = args["repo"]
386
- let path = '/api/v1/github/repo'
387
- return this.c._request('GET', path, params)
388
- }
389
- async getSocialBilibiliArchives(args: any = {}): Promise<any> {
390
- const params:any = {}
391
- if (args["mid"] !== undefined) params["mid"] = args["mid"]
392
- if (args["keywords"] !== undefined) params["keywords"] = args["keywords"]
393
- if (args["orderby"] !== undefined) params["orderby"] = args["orderby"]
394
- if (args["ps"] !== undefined) params["ps"] = args["ps"]
395
- if (args["pn"] !== undefined) params["pn"] = args["pn"]
396
- let path = '/api/v1/social/bilibili/archives'
397
- return this.c._request('GET', path, params)
398
- }
399
- async getSocialBilibiliLiveroom(args: any = {}): Promise<any> {
400
- const params:any = {}
401
- if (args["mid"] !== undefined) params["mid"] = args["mid"]
402
- if (args["room_id"] !== undefined) params["room_id"] = args["room_id"]
403
- let path = '/api/v1/social/bilibili/liveroom'
404
- return this.c._request('GET', path, params)
405
- }
406
- async getSocialBilibiliReplies(args: any = {}): Promise<any> {
407
- const params:any = {}
408
- if (args["oid"] !== undefined) params["oid"] = args["oid"]
409
- if (args["sort"] !== undefined) params["sort"] = args["sort"]
410
- if (args["ps"] !== undefined) params["ps"] = args["ps"]
411
- if (args["pn"] !== undefined) params["pn"] = args["pn"]
412
- let path = '/api/v1/social/bilibili/replies'
413
- return this.c._request('GET', path, params)
414
- }
415
- async getSocialBilibiliUserinfo(args: any = {}): Promise<any> {
416
- const params:any = {}
417
- if (args["uid"] !== undefined) params["uid"] = args["uid"]
418
- let path = '/api/v1/social/bilibili/userinfo'
419
- return this.c._request('GET', path, params)
420
- }
421
- async getSocialBilibiliVideoinfo(args: any = {}): Promise<any> {
422
- const params:any = {}
423
- if (args["aid"] !== undefined) params["aid"] = args["aid"]
424
- if (args["bvid"] !== undefined) params["bvid"] = args["bvid"]
425
- let path = '/api/v1/social/bilibili/videoinfo'
426
- return this.c._request('GET', path, params)
427
- }
428
- async getSocialQqGroupinfo(args: any = {}): Promise<any> {
429
- const params:any = {}
430
- if (args["group_id"] !== undefined) params["group_id"] = args["group_id"]
431
- let path = '/api/v1/social/qq/groupinfo'
432
- return this.c._request('GET', path, params)
433
- }
434
- async getSocialQqUserinfo(args: any = {}): Promise<any> {
435
- const params:any = {}
436
- if (args["qq"] !== undefined) params["qq"] = args["qq"]
437
- let path = '/api/v1/social/qq/userinfo'
438
- return this.c._request('GET', path, params)
439
- }
440
- }
441
- class StatusApi {
442
- constructor(private c: UapiClient) {}
443
- async getStatusRatelimit(args: any = {}): Promise<any> {
444
- const params:any = {}
445
- let path = '/api/v1/status/ratelimit'
446
- return this.c._request('GET', path, params)
447
- }
448
- async getStatusUsage(args: any = {}): Promise<any> {
449
- const params:any = {}
450
- if (args["path"] !== undefined) params["path"] = args["path"]
451
- let path = '/api/v1/status/usage'
452
- return this.c._request('GET', path, params)
453
- }
454
- }
455
- class TextApi {
456
- constructor(private c: UapiClient) {}
457
- async getTextMd5(args: any = {}): Promise<any> {
458
- const params:any = {}
459
- if (args["text"] !== undefined) params["text"] = args["text"]
460
- let path = '/api/v1/text/md5'
461
- return this.c._request('GET', path, params)
462
- }
463
- async postTextAesDecrypt(args: any = {}): Promise<any> {
464
- const params:any = {}
465
- let path = '/api/v1/text/aes/decrypt'
466
- return this.c._request('POST', path, params)
467
- }
468
- async postTextAesEncrypt(args: any = {}): Promise<any> {
469
- const params:any = {}
470
- let path = '/api/v1/text/aes/encrypt'
471
- return this.c._request('POST', path, params)
472
- }
473
- async postTextAnalyze(args: any = {}): Promise<any> {
474
- const params:any = {}
475
- let path = '/api/v1/text/analyze'
476
- return this.c._request('POST', path, params)
477
- }
478
- async postTextBase64Decode(args: any = {}): Promise<any> {
479
- const params:any = {}
480
- let path = '/api/v1/text/base64/decode'
481
- return this.c._request('POST', path, params)
482
- }
483
- async postTextBase64Encode(args: any = {}): Promise<any> {
484
- const params:any = {}
485
- let path = '/api/v1/text/base64/encode'
486
- return this.c._request('POST', path, params)
487
- }
488
- async postTextMd5(args: any = {}): Promise<any> {
489
- const params:any = {}
490
- let path = '/api/v1/text/md5'
491
- return this.c._request('POST', path, params)
492
- }
493
- async postTextMd5Verify(args: any = {}): Promise<any> {
494
- const params:any = {}
495
- let path = '/api/v1/text/md5/verify'
496
- return this.c._request('POST', path, params)
497
- }
498
- }
499
- class TranslateApi {
500
- constructor(private c: UapiClient) {}
501
- async getAiTranslateLanguages(args: any = {}): Promise<any> {
502
- const params:any = {}
503
- let path = '/api/v1/ai/translate/languages'
504
- return this.c._request('GET', path, params)
505
- }
506
- async postAiTranslate(args: any = {}): Promise<any> {
507
- const params:any = {}
508
- if (args["target_lang"] !== undefined) params["target_lang"] = args["target_lang"]
509
- let path = '/api/v1/ai/translate'
510
- return this.c._request('POST', path, params)
511
- }
512
- async postTranslateStream(args: any = {}): Promise<any> {
513
- const params:any = {}
514
- let path = '/api/v1/translate/stream'
515
- return this.c._request('POST', path, params)
516
- }
517
- async postTranslateText(args: any = {}): Promise<any> {
518
- const params:any = {}
519
- if (args["to_lang"] !== undefined) params["to_lang"] = args["to_lang"]
520
- let path = '/api/v1/translate/text'
521
- return this.c._request('POST', path, params)
522
- }
523
- }
524
- class WebparseApi {
525
- constructor(private c: UapiClient) {}
526
- async getWebTomarkdownAsyncStatus(args: any = {}): Promise<any> {
527
- const params:any = {}
528
- let path = '/api/v1/web/tomarkdown/async/{task_id}'
529
- if (args['task_id'] !== undefined) path = path.replace('{' + 'task_id' + '}', String(args['task_id']))
530
- return this.c._request('GET', path, params)
531
- }
532
- async getWebparseExtractimages(args: any = {}): Promise<any> {
533
- const params:any = {}
534
- if (args["url"] !== undefined) params["url"] = args["url"]
535
- let path = '/api/v1/webparse/extractimages'
536
- return this.c._request('GET', path, params)
537
- }
538
- async getWebparseMetadata(args: any = {}): Promise<any> {
539
- const params:any = {}
540
- if (args["url"] !== undefined) params["url"] = args["url"]
541
- let path = '/api/v1/webparse/metadata'
542
- return this.c._request('GET', path, params)
543
- }
544
- async postWebTomarkdownAsync(args: any = {}): Promise<any> {
545
- const params:any = {}
546
- if (args["url"] !== undefined) params["url"] = args["url"]
547
- let path = '/api/v1/web/tomarkdown/async'
548
- return this.c._request('POST', path, params)
549
- }
550
- }
551
- class MinGanCiShiBieApi {
552
- constructor(private c: UapiClient) {}
553
- async getSensitiveWordAnalyzeQuery(args: any = {}): Promise<any> {
554
- const params:any = {}
555
- if (args["keyword"] !== undefined) params["keyword"] = args["keyword"]
556
- let path = '/api/v1/sensitive-word/analyze-query'
557
- return this.c._request('GET', path, params)
558
- }
559
- async postSensitiveWordAnalyze(args: any = {}): Promise<any> {
560
- const params:any = {}
561
- let path = '/api/v1/sensitive-word/analyze'
562
- return this.c._request('POST', path, params)
563
- }
564
- async postSensitiveWordQuickCheck(args: any = {}): Promise<any> {
565
- const params:any = {}
566
- let path = '/api/v1/text/profanitycheck'
567
- return this.c._request('POST', path, params)
568
- }
569
- }
570
- class ZhiNengSouSuoApi {
571
- constructor(private c: UapiClient) {}
572
- async getSearchEngines(args: any = {}): Promise<any> {
573
- const params:any = {}
574
- let path = '/api/v1/search/engines'
575
- return this.c._request('GET', path, params)
576
- }
577
- async postSearchAggregate(args: any = {}): Promise<any> {
578
- const params:any = {}
579
- let path = '/api/v1/search/aggregate'
580
- return this.c._request('POST', path, params)
581
- }
582
- }
1
+ export class UapiError extends Error {
2
+ constructor(public code: string, public status: number, public details?: any) {
3
+ super(`${status} ${code}`)
4
+ }
5
+ }
6
+
7
+ export class UapiClient {
8
+ constructor(private baseURL: string, private token?: string) {
9
+ ;(this as any)["Clipzy 在线剪贴板"] = this.clipzyZaiXianJianTieBan
10
+ ;(this as any)["Convert"] = this.convert
11
+ ;(this as any)["Daily"] = this.daily
12
+ ;(this as any)["Game"] = this.game
13
+ ;(this as any)["Image"] = this.image
14
+ ;(this as any)["Misc"] = this.misc
15
+ ;(this as any)["Network"] = this.network
16
+ ;(this as any)["Poem"] = this.poem
17
+ ;(this as any)["Random"] = this.random
18
+ ;(this as any)["Social"] = this.social
19
+ ;(this as any)["Status"] = this.status
20
+ ;(this as any)["Text"] = this.text
21
+ ;(this as any)["Translate"] = this.translate
22
+ ;(this as any)["WebParse"] = this.webparse
23
+ ;(this as any)["敏感词识别"] = this.minGanCiShiBie
24
+ ;(this as any)["智能搜索"] = this.zhiNengSouSuo
25
+ }
26
+ clipzyZaiXianJianTieBan = new ClipzyZaiXianJianTieBanApi(this)
27
+ convert = new ConvertApi(this)
28
+ daily = new DailyApi(this)
29
+ game = new GameApi(this)
30
+ image = new ImageApi(this)
31
+ misc = new MiscApi(this)
32
+ network = new NetworkApi(this)
33
+ poem = new PoemApi(this)
34
+ random = new RandomApi(this)
35
+ social = new SocialApi(this)
36
+ status = new StatusApi(this)
37
+ text = new TextApi(this)
38
+ translate = new TranslateApi(this)
39
+ webparse = new WebparseApi(this)
40
+ minGanCiShiBie = new MinGanCiShiBieApi(this)
41
+ zhiNengSouSuo = new ZhiNengSouSuoApi(this)
42
+ async _request(method: string, path: string, params?: Record<string,any>, body?: any) {
43
+ const url = new URL(this.baseURL.replace(/\/$/, '') + path)
44
+ if (params) Object.entries(params).forEach(([k,v]) => url.searchParams.set(k, String(v)))
45
+ const res = await fetch(url.toString(), { method, headers: { 'Content-Type':'application/json', ...(this.token ? { Authorization: `Bearer ${this.token}` } : {}) }, body: body ? JSON.stringify(body) : undefined })
46
+ if (!res.ok) {
47
+ let data:any=null; try { data = await res.json() } catch {}
48
+ const code = (data?.code || 'API_ERROR').toUpperCase()
49
+ throw new UapiError(code, res.status, data?.details)
50
+ }
51
+ const ct = res.headers.get('content-type') || ''
52
+ return ct.includes('application/json') ? res.json() : res.arrayBuffer()
53
+ }
54
+ }
55
+ class ClipzyZaiXianJianTieBanApi {
56
+ constructor(private c: UapiClient) {}
57
+ async getClipzyGet(args: any = {}): Promise<any> {
58
+ const params:any = {}
59
+ const body:any = {}
60
+ if (args["id"] !== undefined) params["id"] = args["id"]
61
+ let path = '/api/v1/api/get'
62
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
63
+ }
64
+ async getClipzyRaw(args: any = {}): Promise<any> {
65
+ const params:any = {}
66
+ const body:any = {}
67
+ if (args["key"] !== undefined) params["key"] = args["key"]
68
+ let path = '/api/v1/api/raw/{id}'
69
+ if (args['id'] !== undefined) path = path.replace('{' + 'id' + '}', String(args['id']))
70
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
71
+ }
72
+ async postClipzyStore(args: any = {}): Promise<any> {
73
+ const params:any = {}
74
+ const body:any = {}
75
+ if (args["compressedData"] !== undefined) body["compressedData"] = args["compressedData"]
76
+ if (args["ttl"] !== undefined) body["ttl"] = args["ttl"]
77
+ let path = '/api/v1/api/store'
78
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
79
+ }
80
+ }
81
+ class ConvertApi {
82
+ constructor(private c: UapiClient) {}
83
+ async getConvertUnixtime(args: any = {}): Promise<any> {
84
+ const params:any = {}
85
+ const body:any = {}
86
+ if (args["time"] !== undefined) params["time"] = args["time"]
87
+ let path = '/api/v1/convert/unixtime'
88
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
89
+ }
90
+ async postConvertJson(args: any = {}): Promise<any> {
91
+ const params:any = {}
92
+ const body:any = {}
93
+ if (args["content"] !== undefined) body["content"] = args["content"]
94
+ let path = '/api/v1/convert/json'
95
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
96
+ }
97
+ }
98
+ class DailyApi {
99
+ constructor(private c: UapiClient) {}
100
+ async getDailyNewsImage(args: any = {}): Promise<any> {
101
+ const params:any = {}
102
+ const body:any = {}
103
+ let path = '/api/v1/daily/news-image'
104
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
105
+ }
106
+ }
107
+ class GameApi {
108
+ constructor(private c: UapiClient) {}
109
+ async getGameEpicFree(args: any = {}): Promise<any> {
110
+ const params:any = {}
111
+ const body:any = {}
112
+ let path = '/api/v1/game/epic-free'
113
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
114
+ }
115
+ async getGameMinecraftHistoryid(args: any = {}): Promise<any> {
116
+ const params:any = {}
117
+ const body:any = {}
118
+ if (args["name"] !== undefined) params["name"] = args["name"]
119
+ if (args["uuid"] !== undefined) params["uuid"] = args["uuid"]
120
+ let path = '/api/v1/game/minecraft/historyid'
121
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
122
+ }
123
+ async getGameMinecraftServerstatus(args: any = {}): Promise<any> {
124
+ const params:any = {}
125
+ const body:any = {}
126
+ if (args["server"] !== undefined) params["server"] = args["server"]
127
+ let path = '/api/v1/game/minecraft/serverstatus'
128
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
129
+ }
130
+ async getGameMinecraftUserinfo(args: any = {}): Promise<any> {
131
+ const params:any = {}
132
+ const body:any = {}
133
+ if (args["username"] !== undefined) params["username"] = args["username"]
134
+ let path = '/api/v1/game/minecraft/userinfo'
135
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
136
+ }
137
+ async getGameSteamSummary(args: any = {}): Promise<any> {
138
+ const params:any = {}
139
+ const body:any = {}
140
+ if (args["steamid"] !== undefined) params["steamid"] = args["steamid"]
141
+ if (args["id"] !== undefined) params["id"] = args["id"]
142
+ if (args["id3"] !== undefined) params["id3"] = args["id3"]
143
+ if (args["key"] !== undefined) params["key"] = args["key"]
144
+ let path = '/api/v1/game/steam/summary'
145
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
146
+ }
147
+ }
148
+ class ImageApi {
149
+ constructor(private c: UapiClient) {}
150
+ async getAvatarGravatar(args: any = {}): Promise<any> {
151
+ const params:any = {}
152
+ const body:any = {}
153
+ if (args["email"] !== undefined) params["email"] = args["email"]
154
+ if (args["hash"] !== undefined) params["hash"] = args["hash"]
155
+ if (args["s"] !== undefined) params["s"] = args["s"]
156
+ if (args["d"] !== undefined) params["d"] = args["d"]
157
+ if (args["r"] !== undefined) params["r"] = args["r"]
158
+ let path = '/api/v1/avatar/gravatar'
159
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
160
+ }
161
+ async getImageBingDaily(args: any = {}): Promise<any> {
162
+ const params:any = {}
163
+ const body:any = {}
164
+ let path = '/api/v1/image/bing-daily'
165
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
166
+ }
167
+ async getImageMotou(args: any = {}): Promise<any> {
168
+ const params:any = {}
169
+ const body:any = {}
170
+ if (args["qq"] !== undefined) params["qq"] = args["qq"]
171
+ if (args["bg_color"] !== undefined) params["bg_color"] = args["bg_color"]
172
+ let path = '/api/v1/image/motou'
173
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
174
+ }
175
+ async getImageQrcode(args: any = {}): Promise<any> {
176
+ const params:any = {}
177
+ const body:any = {}
178
+ if (args["text"] !== undefined) params["text"] = args["text"]
179
+ if (args["size"] !== undefined) params["size"] = args["size"]
180
+ if (args["format"] !== undefined) params["format"] = args["format"]
181
+ let path = '/api/v1/image/qrcode'
182
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
183
+ }
184
+ async getImageTobase64(args: any = {}): Promise<any> {
185
+ const params:any = {}
186
+ const body:any = {}
187
+ if (args["url"] !== undefined) params["url"] = args["url"]
188
+ let path = '/api/v1/image/tobase64'
189
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
190
+ }
191
+ async postImageCompress(args: any = {}): Promise<any> {
192
+ const params:any = {}
193
+ const body:any = {}
194
+ if (args["level"] !== undefined) params["level"] = args["level"]
195
+ if (args["format"] !== undefined) params["format"] = args["format"]
196
+ if (args["file"] !== undefined) body["file"] = args["file"]
197
+ let path = '/api/v1/image/compress'
198
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
199
+ }
200
+ async postImageFrombase64(args: any = {}): Promise<any> {
201
+ const params:any = {}
202
+ const body:any = {}
203
+ if (args["imageData"] !== undefined) body["imageData"] = args["imageData"]
204
+ let path = '/api/v1/image/frombase64'
205
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
206
+ }
207
+ async postImageMotou(args: any = {}): Promise<any> {
208
+ const params:any = {}
209
+ const body:any = {}
210
+ if (args["bg_color"] !== undefined) body["bg_color"] = args["bg_color"]
211
+ if (args["file"] !== undefined) body["file"] = args["file"]
212
+ if (args["image_url"] !== undefined) body["image_url"] = args["image_url"]
213
+ let path = '/api/v1/image/motou'
214
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
215
+ }
216
+ async postImageSpeechless(args: any = {}): Promise<any> {
217
+ const params:any = {}
218
+ const body:any = {}
219
+ if (args["bottom_text"] !== undefined) body["bottom_text"] = args["bottom_text"]
220
+ if (args["top_text"] !== undefined) body["top_text"] = args["top_text"]
221
+ let path = '/api/v1/image/speechless'
222
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
223
+ }
224
+ async postImageSvg(args: any = {}): Promise<any> {
225
+ const params:any = {}
226
+ const body:any = {}
227
+ if (args["format"] !== undefined) params["format"] = args["format"]
228
+ if (args["width"] !== undefined) params["width"] = args["width"]
229
+ if (args["height"] !== undefined) params["height"] = args["height"]
230
+ if (args["quality"] !== undefined) params["quality"] = args["quality"]
231
+ if (args["file"] !== undefined) body["file"] = args["file"]
232
+ let path = '/api/v1/image/svg'
233
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
234
+ }
235
+ }
236
+ class MiscApi {
237
+ constructor(private c: UapiClient) {}
238
+ async getHistoryProgrammer(args: any = {}): Promise<any> {
239
+ const params:any = {}
240
+ const body:any = {}
241
+ if (args["month"] !== undefined) params["month"] = args["month"]
242
+ if (args["day"] !== undefined) params["day"] = args["day"]
243
+ let path = '/api/v1/history/programmer'
244
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
245
+ }
246
+ async getHistoryProgrammerToday(args: any = {}): Promise<any> {
247
+ const params:any = {}
248
+ const body:any = {}
249
+ let path = '/api/v1/history/programmer/today'
250
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
251
+ }
252
+ async getMiscHotboard(args: any = {}): Promise<any> {
253
+ const params:any = {}
254
+ const body:any = {}
255
+ if (args["type"] !== undefined) params["type"] = args["type"]
256
+ let path = '/api/v1/misc/hotboard'
257
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
258
+ }
259
+ async getMiscPhoneinfo(args: any = {}): Promise<any> {
260
+ const params:any = {}
261
+ const body:any = {}
262
+ if (args["phone"] !== undefined) params["phone"] = args["phone"]
263
+ let path = '/api/v1/misc/phoneinfo'
264
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
265
+ }
266
+ async getMiscRandomnumber(args: any = {}): Promise<any> {
267
+ const params:any = {}
268
+ const body:any = {}
269
+ if (args["min"] !== undefined) params["min"] = args["min"]
270
+ if (args["max"] !== undefined) params["max"] = args["max"]
271
+ if (args["count"] !== undefined) params["count"] = args["count"]
272
+ if (args["allow_repeat"] !== undefined) params["allow_repeat"] = args["allow_repeat"]
273
+ if (args["allow_decimal"] !== undefined) params["allow_decimal"] = args["allow_decimal"]
274
+ if (args["decimal_places"] !== undefined) params["decimal_places"] = args["decimal_places"]
275
+ let path = '/api/v1/misc/randomnumber'
276
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
277
+ }
278
+ async getMiscTimestamp(args: any = {}): Promise<any> {
279
+ const params:any = {}
280
+ const body:any = {}
281
+ if (args["ts"] !== undefined) params["ts"] = args["ts"]
282
+ let path = '/api/v1/misc/timestamp'
283
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
284
+ }
285
+ async getMiscTrackingCarriers(args: any = {}): Promise<any> {
286
+ const params:any = {}
287
+ const body:any = {}
288
+ let path = '/api/v1/misc/tracking/carriers'
289
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
290
+ }
291
+ async getMiscTrackingDetect(args: any = {}): Promise<any> {
292
+ const params:any = {}
293
+ const body:any = {}
294
+ if (args["tracking_number"] !== undefined) params["tracking_number"] = args["tracking_number"]
295
+ let path = '/api/v1/misc/tracking/detect'
296
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
297
+ }
298
+ async getMiscTrackingQuery(args: any = {}): Promise<any> {
299
+ const params:any = {}
300
+ const body:any = {}
301
+ if (args["tracking_number"] !== undefined) params["tracking_number"] = args["tracking_number"]
302
+ if (args["carrier_code"] !== undefined) params["carrier_code"] = args["carrier_code"]
303
+ let path = '/api/v1/misc/tracking/query'
304
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
305
+ }
306
+ async getMiscWeather(args: any = {}): Promise<any> {
307
+ const params:any = {}
308
+ const body:any = {}
309
+ if (args["city"] !== undefined) params["city"] = args["city"]
310
+ if (args["adcode"] !== undefined) params["adcode"] = args["adcode"]
311
+ if (args["extended"] !== undefined) params["extended"] = args["extended"]
312
+ if (args["indices"] !== undefined) params["indices"] = args["indices"]
313
+ if (args["forecast"] !== undefined) params["forecast"] = args["forecast"]
314
+ let path = '/api/v1/misc/weather'
315
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
316
+ }
317
+ async getMiscWorldtime(args: any = {}): Promise<any> {
318
+ const params:any = {}
319
+ const body:any = {}
320
+ if (args["city"] !== undefined) params["city"] = args["city"]
321
+ let path = '/api/v1/misc/worldtime'
322
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
323
+ }
324
+ async postMiscDateDiff(args: any = {}): Promise<any> {
325
+ const params:any = {}
326
+ const body:any = {}
327
+ if (args["end_date"] !== undefined) body["end_date"] = args["end_date"]
328
+ if (args["format"] !== undefined) body["format"] = args["format"]
329
+ if (args["start_date"] !== undefined) body["start_date"] = args["start_date"]
330
+ let path = '/api/v1/misc/date-diff'
331
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
332
+ }
333
+ }
334
+ class NetworkApi {
335
+ constructor(private c: UapiClient) {}
336
+ async getNetworkDns(args: any = {}): Promise<any> {
337
+ const params:any = {}
338
+ const body:any = {}
339
+ if (args["domain"] !== undefined) params["domain"] = args["domain"]
340
+ if (args["type"] !== undefined) params["type"] = args["type"]
341
+ let path = '/api/v1/network/dns'
342
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
343
+ }
344
+ async getNetworkIcp(args: any = {}): Promise<any> {
345
+ const params:any = {}
346
+ const body:any = {}
347
+ if (args["domain"] !== undefined) params["domain"] = args["domain"]
348
+ let path = '/api/v1/network/icp'
349
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
350
+ }
351
+ async getNetworkIpinfo(args: any = {}): Promise<any> {
352
+ const params:any = {}
353
+ const body:any = {}
354
+ if (args["ip"] !== undefined) params["ip"] = args["ip"]
355
+ if (args["source"] !== undefined) params["source"] = args["source"]
356
+ let path = '/api/v1/network/ipinfo'
357
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
358
+ }
359
+ async getNetworkMyip(args: any = {}): Promise<any> {
360
+ const params:any = {}
361
+ const body:any = {}
362
+ if (args["source"] !== undefined) params["source"] = args["source"]
363
+ let path = '/api/v1/network/myip'
364
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
365
+ }
366
+ async getNetworkPing(args: any = {}): Promise<any> {
367
+ const params:any = {}
368
+ const body:any = {}
369
+ if (args["host"] !== undefined) params["host"] = args["host"]
370
+ let path = '/api/v1/network/ping'
371
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
372
+ }
373
+ async getNetworkPingmyip(args: any = {}): Promise<any> {
374
+ const params:any = {}
375
+ const body:any = {}
376
+ let path = '/api/v1/network/pingmyip'
377
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
378
+ }
379
+ async getNetworkPortscan(args: any = {}): Promise<any> {
380
+ const params:any = {}
381
+ const body:any = {}
382
+ if (args["host"] !== undefined) params["host"] = args["host"]
383
+ if (args["port"] !== undefined) params["port"] = args["port"]
384
+ if (args["protocol"] !== undefined) params["protocol"] = args["protocol"]
385
+ let path = '/api/v1/network/portscan'
386
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
387
+ }
388
+ async getNetworkUrlstatus(args: any = {}): Promise<any> {
389
+ const params:any = {}
390
+ const body:any = {}
391
+ if (args["url"] !== undefined) params["url"] = args["url"]
392
+ let path = '/api/v1/network/urlstatus'
393
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
394
+ }
395
+ async getNetworkWhois(args: any = {}): Promise<any> {
396
+ const params:any = {}
397
+ const body:any = {}
398
+ if (args["domain"] !== undefined) params["domain"] = args["domain"]
399
+ if (args["format"] !== undefined) params["format"] = args["format"]
400
+ let path = '/api/v1/network/whois'
401
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
402
+ }
403
+ async getNetworkWxdomain(args: any = {}): Promise<any> {
404
+ const params:any = {}
405
+ const body:any = {}
406
+ if (args["domain"] !== undefined) params["domain"] = args["domain"]
407
+ let path = '/api/v1/network/wxdomain'
408
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
409
+ }
410
+ }
411
+ class PoemApi {
412
+ constructor(private c: UapiClient) {}
413
+ async getSaying(args: any = {}): Promise<any> {
414
+ const params:any = {}
415
+ const body:any = {}
416
+ let path = '/api/v1/saying'
417
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
418
+ }
419
+ }
420
+ class RandomApi {
421
+ constructor(private c: UapiClient) {}
422
+ async getAnswerbookAsk(args: any = {}): Promise<any> {
423
+ const params:any = {}
424
+ const body:any = {}
425
+ if (args["question"] !== undefined) params["question"] = args["question"]
426
+ let path = '/api/v1/answerbook/ask'
427
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
428
+ }
429
+ async getRandomImage(args: any = {}): Promise<any> {
430
+ const params:any = {}
431
+ const body:any = {}
432
+ if (args["category"] !== undefined) params["category"] = args["category"]
433
+ if (args["type"] !== undefined) params["type"] = args["type"]
434
+ let path = '/api/v1/random/image'
435
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
436
+ }
437
+ async getRandomString(args: any = {}): Promise<any> {
438
+ const params:any = {}
439
+ const body:any = {}
440
+ if (args["length"] !== undefined) params["length"] = args["length"]
441
+ if (args["type"] !== undefined) params["type"] = args["type"]
442
+ let path = '/api/v1/random/string'
443
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
444
+ }
445
+ async postAnswerbookAsk(args: any = {}): Promise<any> {
446
+ const params:any = {}
447
+ const body:any = {}
448
+ if (args["question"] !== undefined) body["question"] = args["question"]
449
+ let path = '/api/v1/answerbook/ask'
450
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
451
+ }
452
+ }
453
+ class SocialApi {
454
+ constructor(private c: UapiClient) {}
455
+ async getGithubRepo(args: any = {}): Promise<any> {
456
+ const params:any = {}
457
+ const body:any = {}
458
+ if (args["repo"] !== undefined) params["repo"] = args["repo"]
459
+ let path = '/api/v1/github/repo'
460
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
461
+ }
462
+ async getSocialBilibiliArchives(args: any = {}): Promise<any> {
463
+ const params:any = {}
464
+ const body:any = {}
465
+ if (args["mid"] !== undefined) params["mid"] = args["mid"]
466
+ if (args["keywords"] !== undefined) params["keywords"] = args["keywords"]
467
+ if (args["orderby"] !== undefined) params["orderby"] = args["orderby"]
468
+ if (args["ps"] !== undefined) params["ps"] = args["ps"]
469
+ if (args["pn"] !== undefined) params["pn"] = args["pn"]
470
+ let path = '/api/v1/social/bilibili/archives'
471
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
472
+ }
473
+ async getSocialBilibiliLiveroom(args: any = {}): Promise<any> {
474
+ const params:any = {}
475
+ const body:any = {}
476
+ if (args["mid"] !== undefined) params["mid"] = args["mid"]
477
+ if (args["room_id"] !== undefined) params["room_id"] = args["room_id"]
478
+ let path = '/api/v1/social/bilibili/liveroom'
479
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
480
+ }
481
+ async getSocialBilibiliReplies(args: any = {}): Promise<any> {
482
+ const params:any = {}
483
+ const body:any = {}
484
+ if (args["oid"] !== undefined) params["oid"] = args["oid"]
485
+ if (args["sort"] !== undefined) params["sort"] = args["sort"]
486
+ if (args["ps"] !== undefined) params["ps"] = args["ps"]
487
+ if (args["pn"] !== undefined) params["pn"] = args["pn"]
488
+ let path = '/api/v1/social/bilibili/replies'
489
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
490
+ }
491
+ async getSocialBilibiliUserinfo(args: any = {}): Promise<any> {
492
+ const params:any = {}
493
+ const body:any = {}
494
+ if (args["uid"] !== undefined) params["uid"] = args["uid"]
495
+ let path = '/api/v1/social/bilibili/userinfo'
496
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
497
+ }
498
+ async getSocialBilibiliVideoinfo(args: any = {}): Promise<any> {
499
+ const params:any = {}
500
+ const body:any = {}
501
+ if (args["aid"] !== undefined) params["aid"] = args["aid"]
502
+ if (args["bvid"] !== undefined) params["bvid"] = args["bvid"]
503
+ let path = '/api/v1/social/bilibili/videoinfo'
504
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
505
+ }
506
+ async getSocialQqGroupinfo(args: any = {}): Promise<any> {
507
+ const params:any = {}
508
+ const body:any = {}
509
+ if (args["group_id"] !== undefined) params["group_id"] = args["group_id"]
510
+ let path = '/api/v1/social/qq/groupinfo'
511
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
512
+ }
513
+ async getSocialQqUserinfo(args: any = {}): Promise<any> {
514
+ const params:any = {}
515
+ const body:any = {}
516
+ if (args["qq"] !== undefined) params["qq"] = args["qq"]
517
+ let path = '/api/v1/social/qq/userinfo'
518
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
519
+ }
520
+ }
521
+ class StatusApi {
522
+ constructor(private c: UapiClient) {}
523
+ async getStatusRatelimit(args: any = {}): Promise<any> {
524
+ const params:any = {}
525
+ const body:any = {}
526
+ let path = '/api/v1/status/ratelimit'
527
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
528
+ }
529
+ async getStatusUsage(args: any = {}): Promise<any> {
530
+ const params:any = {}
531
+ const body:any = {}
532
+ if (args["path"] !== undefined) params["path"] = args["path"]
533
+ let path = '/api/v1/status/usage'
534
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
535
+ }
536
+ }
537
+ class TextApi {
538
+ constructor(private c: UapiClient) {}
539
+ async getTextMd5(args: any = {}): Promise<any> {
540
+ const params:any = {}
541
+ const body:any = {}
542
+ if (args["text"] !== undefined) params["text"] = args["text"]
543
+ let path = '/api/v1/text/md5'
544
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
545
+ }
546
+ async postTextAesDecrypt(args: any = {}): Promise<any> {
547
+ const params:any = {}
548
+ const body:any = {}
549
+ if (args["key"] !== undefined) body["key"] = args["key"]
550
+ if (args["nonce"] !== undefined) body["nonce"] = args["nonce"]
551
+ if (args["text"] !== undefined) body["text"] = args["text"]
552
+ let path = '/api/v1/text/aes/decrypt'
553
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
554
+ }
555
+ async postTextAesDecryptAdvanced(args: any = {}): Promise<any> {
556
+ const params:any = {}
557
+ const body:any = {}
558
+ if (args["iv"] !== undefined) body["iv"] = args["iv"]
559
+ if (args["key"] !== undefined) body["key"] = args["key"]
560
+ if (args["mode"] !== undefined) body["mode"] = args["mode"]
561
+ if (args["padding"] !== undefined) body["padding"] = args["padding"]
562
+ if (args["text"] !== undefined) body["text"] = args["text"]
563
+ let path = '/api/v1/text/aes/decrypt-advanced'
564
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
565
+ }
566
+ async postTextAesEncrypt(args: any = {}): Promise<any> {
567
+ const params:any = {}
568
+ const body:any = {}
569
+ if (args["key"] !== undefined) body["key"] = args["key"]
570
+ if (args["text"] !== undefined) body["text"] = args["text"]
571
+ let path = '/api/v1/text/aes/encrypt'
572
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
573
+ }
574
+ async postTextAesEncryptAdvanced(args: any = {}): Promise<any> {
575
+ const params:any = {}
576
+ const body:any = {}
577
+ if (args["iv"] !== undefined) body["iv"] = args["iv"]
578
+ if (args["key"] !== undefined) body["key"] = args["key"]
579
+ if (args["mode"] !== undefined) body["mode"] = args["mode"]
580
+ if (args["output_format"] !== undefined) body["output_format"] = args["output_format"]
581
+ if (args["padding"] !== undefined) body["padding"] = args["padding"]
582
+ if (args["text"] !== undefined) body["text"] = args["text"]
583
+ let path = '/api/v1/text/aes/encrypt-advanced'
584
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
585
+ }
586
+ async postTextAnalyze(args: any = {}): Promise<any> {
587
+ const params:any = {}
588
+ const body:any = {}
589
+ if (args["text"] !== undefined) body["text"] = args["text"]
590
+ let path = '/api/v1/text/analyze'
591
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
592
+ }
593
+ async postTextBase64Decode(args: any = {}): Promise<any> {
594
+ const params:any = {}
595
+ const body:any = {}
596
+ if (args["text"] !== undefined) body["text"] = args["text"]
597
+ let path = '/api/v1/text/base64/decode'
598
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
599
+ }
600
+ async postTextBase64Encode(args: any = {}): Promise<any> {
601
+ const params:any = {}
602
+ const body:any = {}
603
+ if (args["text"] !== undefined) body["text"] = args["text"]
604
+ let path = '/api/v1/text/base64/encode'
605
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
606
+ }
607
+ async postTextConvert(args: any = {}): Promise<any> {
608
+ const params:any = {}
609
+ const body:any = {}
610
+ if (args["from"] !== undefined) body["from"] = args["from"]
611
+ if (args["options"] !== undefined) body["options"] = args["options"]
612
+ if (args["text"] !== undefined) body["text"] = args["text"]
613
+ if (args["to"] !== undefined) body["to"] = args["to"]
614
+ let path = '/api/v1/text/convert'
615
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
616
+ }
617
+ async postTextMd5(args: any = {}): Promise<any> {
618
+ const params:any = {}
619
+ const body:any = {}
620
+ if (args["text"] !== undefined) body["text"] = args["text"]
621
+ let path = '/api/v1/text/md5'
622
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
623
+ }
624
+ async postTextMd5Verify(args: any = {}): Promise<any> {
625
+ const params:any = {}
626
+ const body:any = {}
627
+ if (args["hash"] !== undefined) body["hash"] = args["hash"]
628
+ if (args["text"] !== undefined) body["text"] = args["text"]
629
+ let path = '/api/v1/text/md5/verify'
630
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
631
+ }
632
+ }
633
+ class TranslateApi {
634
+ constructor(private c: UapiClient) {}
635
+ async getAiTranslateLanguages(args: any = {}): Promise<any> {
636
+ const params:any = {}
637
+ const body:any = {}
638
+ let path = '/api/v1/ai/translate/languages'
639
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
640
+ }
641
+ async postAiTranslate(args: any = {}): Promise<any> {
642
+ const params:any = {}
643
+ const body:any = {}
644
+ if (args["target_lang"] !== undefined) params["target_lang"] = args["target_lang"]
645
+ if (args["context"] !== undefined) body["context"] = args["context"]
646
+ if (args["fast_mode"] !== undefined) body["fast_mode"] = args["fast_mode"]
647
+ if (args["max_concurrency"] !== undefined) body["max_concurrency"] = args["max_concurrency"]
648
+ if (args["preserve_format"] !== undefined) body["preserve_format"] = args["preserve_format"]
649
+ if (args["source_lang"] !== undefined) body["source_lang"] = args["source_lang"]
650
+ if (args["style"] !== undefined) body["style"] = args["style"]
651
+ if (args["text"] !== undefined) body["text"] = args["text"]
652
+ if (args["texts"] !== undefined) body["texts"] = args["texts"]
653
+ let path = '/api/v1/ai/translate'
654
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
655
+ }
656
+ async postTranslateStream(args: any = {}): Promise<any> {
657
+ const params:any = {}
658
+ const body:any = {}
659
+ if (args["from_lang"] !== undefined) body["from_lang"] = args["from_lang"]
660
+ if (args["query"] !== undefined) body["query"] = args["query"]
661
+ if (args["to_lang"] !== undefined) body["to_lang"] = args["to_lang"]
662
+ if (args["tone"] !== undefined) body["tone"] = args["tone"]
663
+ let path = '/api/v1/translate/stream'
664
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
665
+ }
666
+ async postTranslateText(args: any = {}): Promise<any> {
667
+ const params:any = {}
668
+ const body:any = {}
669
+ if (args["to_lang"] !== undefined) params["to_lang"] = args["to_lang"]
670
+ if (args["text"] !== undefined) body["text"] = args["text"]
671
+ let path = '/api/v1/translate/text'
672
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
673
+ }
674
+ }
675
+ class WebparseApi {
676
+ constructor(private c: UapiClient) {}
677
+ async getWebTomarkdownAsyncStatus(args: any = {}): Promise<any> {
678
+ const params:any = {}
679
+ const body:any = {}
680
+ let path = '/api/v1/web/tomarkdown/async/{task_id}'
681
+ if (args['task_id'] !== undefined) path = path.replace('{' + 'task_id' + '}', String(args['task_id']))
682
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
683
+ }
684
+ async getWebparseExtractimages(args: any = {}): Promise<any> {
685
+ const params:any = {}
686
+ const body:any = {}
687
+ if (args["url"] !== undefined) params["url"] = args["url"]
688
+ let path = '/api/v1/webparse/extractimages'
689
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
690
+ }
691
+ async getWebparseMetadata(args: any = {}): Promise<any> {
692
+ const params:any = {}
693
+ const body:any = {}
694
+ if (args["url"] !== undefined) params["url"] = args["url"]
695
+ let path = '/api/v1/webparse/metadata'
696
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
697
+ }
698
+ async postWebTomarkdownAsync(args: any = {}): Promise<any> {
699
+ const params:any = {}
700
+ const body:any = {}
701
+ if (args["url"] !== undefined) params["url"] = args["url"]
702
+ let path = '/api/v1/web/tomarkdown/async'
703
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
704
+ }
705
+ }
706
+ class MinGanCiShiBieApi {
707
+ constructor(private c: UapiClient) {}
708
+ async getSensitiveWordAnalyzeQuery(args: any = {}): Promise<any> {
709
+ const params:any = {}
710
+ const body:any = {}
711
+ if (args["keyword"] !== undefined) params["keyword"] = args["keyword"]
712
+ let path = '/api/v1/sensitive-word/analyze-query'
713
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
714
+ }
715
+ async postSensitiveWordAnalyze(args: any = {}): Promise<any> {
716
+ const params:any = {}
717
+ const body:any = {}
718
+ if (args["keywords"] !== undefined) body["keywords"] = args["keywords"]
719
+ let path = '/api/v1/sensitive-word/analyze'
720
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
721
+ }
722
+ async postSensitiveWordQuickCheck(args: any = {}): Promise<any> {
723
+ const params:any = {}
724
+ const body:any = {}
725
+ if (args["text"] !== undefined) body["text"] = args["text"]
726
+ let path = '/api/v1/text/profanitycheck'
727
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
728
+ }
729
+ }
730
+ class ZhiNengSouSuoApi {
731
+ constructor(private c: UapiClient) {}
732
+ async getSearchEngines(args: any = {}): Promise<any> {
733
+ const params:any = {}
734
+ const body:any = {}
735
+ let path = '/api/v1/search/engines'
736
+ return this.c._request('GET', path, params, Object.keys(body).length > 0 ? body : undefined)
737
+ }
738
+ async postSearchAggregate(args: any = {}): Promise<any> {
739
+ const params:any = {}
740
+ const body:any = {}
741
+ if (args["fetch_full"] !== undefined) body["fetch_full"] = args["fetch_full"]
742
+ if (args["filetype"] !== undefined) body["filetype"] = args["filetype"]
743
+ if (args["query"] !== undefined) body["query"] = args["query"]
744
+ if (args["site"] !== undefined) body["site"] = args["site"]
745
+ if (args["sort"] !== undefined) body["sort"] = args["sort"]
746
+ if (args["time_range"] !== undefined) body["time_range"] = args["time_range"]
747
+ if (args["timeout_ms"] !== undefined) body["timeout_ms"] = args["timeout_ms"]
748
+ let path = '/api/v1/search/aggregate'
749
+ return this.c._request('POST', path, params, Object.keys(body).length > 0 ? body : undefined)
750
+ }
751
+ }