uapi-browser-sdk 0.1.16 → 0.1.17
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/dist/src/index.d.ts +9 -7
- package/dist/src/index.js +196 -110
- package/package.json +1 -1
- package/src/index.ts +266 -101
package/src/index.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface UapiClientOptions {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
type RequestOptions = { disableCache?: boolean }
|
|
11
|
+
type RequestBodyPayload = Record<string, unknown> | FormData
|
|
12
|
+
export type BrowserUpload = Blob | File
|
|
11
13
|
|
|
12
14
|
const API_PREFIX = '/api/v1'
|
|
13
15
|
|
|
@@ -37,6 +39,13 @@ function applyCacheControl(
|
|
|
37
39
|
_t: Date.now(),
|
|
38
40
|
}
|
|
39
41
|
}
|
|
42
|
+
|
|
43
|
+
function toMultipartText(value: unknown): string {
|
|
44
|
+
if (typeof value === 'boolean') {
|
|
45
|
+
return value ? 'true' : 'false'
|
|
46
|
+
}
|
|
47
|
+
return String(value)
|
|
48
|
+
}
|
|
40
49
|
export type GetClipzyGetResponse =
|
|
41
50
|
Internal.GetClipzyGet200Response
|
|
42
51
|
export interface GetClipzyGetArgs {
|
|
@@ -285,7 +294,7 @@ export interface PostImageCompressArgs {
|
|
|
285
294
|
/** 输出图片格式,可以是 'png' 或 'jpeg'。 */
|
|
286
295
|
format?: string;
|
|
287
296
|
/** 支持PNG, JPG, JPEG等常见图片格式。文件大小不超过15MB。 */
|
|
288
|
-
file:
|
|
297
|
+
file: BrowserUpload;
|
|
289
298
|
}
|
|
290
299
|
export type PostImageDecodeResponse =
|
|
291
300
|
ArrayBuffer
|
|
@@ -319,7 +328,7 @@ export interface PostImageDecodeArgs {
|
|
|
319
328
|
/** 背景色。可以传 `black`、`white` 或 `#RRGGBB`,不传时默认是 `black`。 */
|
|
320
329
|
background?: string;
|
|
321
330
|
/** 要处理的图片文件。这个接口适合直接上传 JPG、JPEG、PNG、WebP、BMP 等常见格式。 */
|
|
322
|
-
file?:
|
|
331
|
+
file?: BrowserUpload;
|
|
323
332
|
/** 要处理的图片链接。适合不方便直接上传文件时使用。 */
|
|
324
333
|
url?: string;
|
|
325
334
|
}
|
|
@@ -349,7 +358,7 @@ export interface PostImageMotouArgs {
|
|
|
349
358
|
/** Same as `bgColor`. Kept for compatibility. */
|
|
350
359
|
"bg_color"?: string;
|
|
351
360
|
/** 上传的图片文件。支持JPG、PNG、GIF等常见格式。 */
|
|
352
|
-
file?:
|
|
361
|
+
file?: BrowserUpload;
|
|
353
362
|
/** 图片的URL地址。如果提供此项,将优先使用该URL的图片。 */
|
|
354
363
|
imageUrl?: string;
|
|
355
364
|
/** Same as `imageUrl`. Kept for compatibility. */
|
|
@@ -365,7 +374,7 @@ export interface PostImageNsfwArgs {
|
|
|
365
374
|
/** 手动指定缓存穿透时间戳。传入后会原样带到查询参数中。 */
|
|
366
375
|
_t?: string | number;
|
|
367
376
|
/** 要检测的图片文件。支持 JPG、JPEG、PNG、GIF、WebP 格式,最大 20MB。 */
|
|
368
|
-
file?:
|
|
377
|
+
file?: BrowserUpload;
|
|
369
378
|
/** 图片的 URL 地址。如果同时提供 file 和 url,将优先使用 file。 */
|
|
370
379
|
url?: string;
|
|
371
380
|
}
|
|
@@ -383,7 +392,7 @@ export interface PostImageOcrArgs {
|
|
|
383
392
|
/** Same as `enableCls`. Kept for compatibility. */
|
|
384
393
|
"enable_cls"?: string;
|
|
385
394
|
/** 待识别的图片文件。支持 JPG、JPEG、PNG、BMP、GIF、WebP 等常见格式,最大不超过 10MB。请勿与 url 或 image_base64 同时提交。 */
|
|
386
|
-
file?:
|
|
395
|
+
file?: BrowserUpload;
|
|
387
396
|
/** 图片的 Base64 字符串。可以传完整 Data URI,也可以只传纯 Base64 内容。请勿与 file 或 url 同时提交。 */
|
|
388
397
|
imageBase64?: string;
|
|
389
398
|
/** Same as `imageBase64`. Kept for compatibility. */
|
|
@@ -439,7 +448,7 @@ export interface PostImageSvgArgs {
|
|
|
439
448
|
/** JPEG 图像的压缩质量(1-100)。仅当 `format` 为 `jpeg` 或 `jpg` 时有效。 */
|
|
440
449
|
quality?: number;
|
|
441
450
|
/** 支持SVG文件 */
|
|
442
|
-
file?:
|
|
451
|
+
file?: BrowserUpload;
|
|
443
452
|
}
|
|
444
453
|
export type GetHistoryProgrammerResponse =
|
|
445
454
|
Internal.GetHistoryProgrammer200Response
|
|
@@ -1548,7 +1557,7 @@ export class UapiClient {
|
|
|
1548
1557
|
method: string,
|
|
1549
1558
|
path: string,
|
|
1550
1559
|
params?: Record<string, unknown>,
|
|
1551
|
-
body?:
|
|
1560
|
+
body?: RequestBodyPayload,
|
|
1552
1561
|
headers?: Record<string, string>,
|
|
1553
1562
|
responseKind: 'json' | 'text' | 'arrayBuffer' = 'json',
|
|
1554
1563
|
requestOptions?: RequestOptions,
|
|
@@ -1562,14 +1571,18 @@ export class UapiClient {
|
|
|
1562
1571
|
}
|
|
1563
1572
|
})
|
|
1564
1573
|
}
|
|
1574
|
+
const isFormDataBody = typeof FormData !== 'undefined' && body instanceof FormData
|
|
1575
|
+
const requestHeaders: Record<string, string> = {
|
|
1576
|
+
...(this.token ? { Authorization: `Bearer ${this.token}` } : {}),
|
|
1577
|
+
...(headers ?? {}),
|
|
1578
|
+
}
|
|
1579
|
+
if (!isFormDataBody && body !== undefined && requestHeaders['Content-Type'] === undefined) {
|
|
1580
|
+
requestHeaders['Content-Type'] = 'application/json'
|
|
1581
|
+
}
|
|
1565
1582
|
const res = await fetch(url.toString(), {
|
|
1566
1583
|
method,
|
|
1567
|
-
headers:
|
|
1568
|
-
|
|
1569
|
-
...(this.token ? { Authorization: `Bearer ${this.token}` } : {}),
|
|
1570
|
-
...(headers ?? {}),
|
|
1571
|
-
},
|
|
1572
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
1584
|
+
headers: requestHeaders,
|
|
1585
|
+
body: body === undefined ? undefined : (isFormDataBody ? body : JSON.stringify(body)),
|
|
1573
1586
|
})
|
|
1574
1587
|
if (!res.ok) {
|
|
1575
1588
|
let data: unknown = null
|
|
@@ -1656,9 +1669,13 @@ export class ClipzyZaiXianJianTieBanApi {
|
|
|
1656
1669
|
const argCacheBuster = args._t
|
|
1657
1670
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
1658
1671
|
const argCompressedData = args.compressedData
|
|
1659
|
-
if (argCompressedData !== undefined)
|
|
1672
|
+
if (argCompressedData !== undefined) {
|
|
1673
|
+
body["compressedData"] = argCompressedData
|
|
1674
|
+
}
|
|
1660
1675
|
const argTtl = args.ttl
|
|
1661
|
-
if (argTtl !== undefined)
|
|
1676
|
+
if (argTtl !== undefined) {
|
|
1677
|
+
body["ttl"] = argTtl
|
|
1678
|
+
}
|
|
1662
1679
|
let requestPath = '/api/v1/api/store'
|
|
1663
1680
|
const responseKind = 'json'
|
|
1664
1681
|
return await this.c._request(
|
|
@@ -1711,7 +1728,9 @@ export class ConvertApi {
|
|
|
1711
1728
|
const argCacheBuster = args._t
|
|
1712
1729
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
1713
1730
|
const argContent = args.content
|
|
1714
|
-
if (argContent !== undefined)
|
|
1731
|
+
if (argContent !== undefined) {
|
|
1732
|
+
body["content"] = argContent
|
|
1733
|
+
}
|
|
1715
1734
|
let requestPath = '/api/v1/convert/json'
|
|
1716
1735
|
const responseKind = 'json'
|
|
1717
1736
|
return await this.c._request(
|
|
@@ -2067,7 +2086,7 @@ export class ImageApi {
|
|
|
2067
2086
|
): Promise<PostImageCompressResponse> {
|
|
2068
2087
|
const query: Record<string, unknown> = {}
|
|
2069
2088
|
const headers: Record<string, string> = {}
|
|
2070
|
-
const body
|
|
2089
|
+
const body = new FormData()
|
|
2071
2090
|
let disableCache: boolean | undefined
|
|
2072
2091
|
disableCache = args.disableCache ?? args["disable_cache"]
|
|
2073
2092
|
const argCacheBuster = args._t
|
|
@@ -2077,14 +2096,16 @@ export class ImageApi {
|
|
|
2077
2096
|
const argFormat = args.format
|
|
2078
2097
|
if (argFormat !== undefined) query["format"] = argFormat
|
|
2079
2098
|
const argFile = args.file
|
|
2080
|
-
if (argFile !== undefined)
|
|
2099
|
+
if (argFile !== undefined) {
|
|
2100
|
+
body.append("file",argFile)
|
|
2101
|
+
}
|
|
2081
2102
|
let requestPath = '/api/v1/image/compress'
|
|
2082
2103
|
const responseKind = 'arrayBuffer'
|
|
2083
2104
|
return await this.c._request(
|
|
2084
2105
|
'POST',
|
|
2085
2106
|
requestPath,
|
|
2086
2107
|
Object.keys(query).length > 0 ? query : undefined,
|
|
2087
|
-
|
|
2108
|
+
body,
|
|
2088
2109
|
Object.keys(headers).length > 0 ? headers : undefined,
|
|
2089
2110
|
responseKind,
|
|
2090
2111
|
disableCache !== undefined ? { disableCache } : undefined,
|
|
@@ -2096,7 +2117,7 @@ export class ImageApi {
|
|
|
2096
2117
|
): Promise<PostImageDecodeResponse> {
|
|
2097
2118
|
const query: Record<string, unknown> = {}
|
|
2098
2119
|
const headers: Record<string, string> = {}
|
|
2099
|
-
const body
|
|
2120
|
+
const body = new FormData()
|
|
2100
2121
|
let disableCache: boolean | undefined
|
|
2101
2122
|
disableCache = args.disableCache ?? args["disable_cache"]
|
|
2102
2123
|
const argCacheBuster = args._t
|
|
@@ -2118,16 +2139,20 @@ export class ImageApi {
|
|
|
2118
2139
|
const argBackground = args.background
|
|
2119
2140
|
if (argBackground !== undefined) query["background"] = argBackground
|
|
2120
2141
|
const argFile = args.file
|
|
2121
|
-
if (argFile !== undefined)
|
|
2142
|
+
if (argFile !== undefined) {
|
|
2143
|
+
body.append("file",argFile)
|
|
2144
|
+
}
|
|
2122
2145
|
const argUrl = args.url
|
|
2123
|
-
if (argUrl !== undefined)
|
|
2146
|
+
if (argUrl !== undefined) {
|
|
2147
|
+
body.append("url", toMultipartText(argUrl))
|
|
2148
|
+
}
|
|
2124
2149
|
let requestPath = '/api/v1/image/decode'
|
|
2125
2150
|
const responseKind = 'arrayBuffer'
|
|
2126
2151
|
return await this.c._request(
|
|
2127
2152
|
'POST',
|
|
2128
2153
|
requestPath,
|
|
2129
2154
|
Object.keys(query).length > 0 ? query : undefined,
|
|
2130
|
-
|
|
2155
|
+
body,
|
|
2131
2156
|
Object.keys(headers).length > 0 ? headers : undefined,
|
|
2132
2157
|
responseKind,
|
|
2133
2158
|
disableCache !== undefined ? { disableCache } : undefined,
|
|
@@ -2145,7 +2170,9 @@ export class ImageApi {
|
|
|
2145
2170
|
const argCacheBuster = args._t
|
|
2146
2171
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
2147
2172
|
const argImageData = args.imageData
|
|
2148
|
-
if (argImageData !== undefined)
|
|
2173
|
+
if (argImageData !== undefined) {
|
|
2174
|
+
body["imageData"] = argImageData
|
|
2175
|
+
}
|
|
2149
2176
|
let requestPath = '/api/v1/image/frombase64'
|
|
2150
2177
|
const responseKind = 'json'
|
|
2151
2178
|
return await this.c._request(
|
|
@@ -2164,24 +2191,30 @@ export class ImageApi {
|
|
|
2164
2191
|
): Promise<PostImageMotouResponse> {
|
|
2165
2192
|
const query: Record<string, unknown> = {}
|
|
2166
2193
|
const headers: Record<string, string> = {}
|
|
2167
|
-
const body
|
|
2194
|
+
const body = new FormData()
|
|
2168
2195
|
let disableCache: boolean | undefined
|
|
2169
2196
|
disableCache = args.disableCache ?? args["disable_cache"]
|
|
2170
2197
|
const argCacheBuster = args._t
|
|
2171
2198
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
2172
2199
|
const argBgColor = args.bgColor ?? args["bg_color"]
|
|
2173
|
-
if (argBgColor !== undefined)
|
|
2200
|
+
if (argBgColor !== undefined) {
|
|
2201
|
+
body.append("bg_color", toMultipartText(argBgColor))
|
|
2202
|
+
}
|
|
2174
2203
|
const argFile = args.file
|
|
2175
|
-
if (argFile !== undefined)
|
|
2204
|
+
if (argFile !== undefined) {
|
|
2205
|
+
body.append("file",argFile)
|
|
2206
|
+
}
|
|
2176
2207
|
const argImageUrl = args.imageUrl ?? args["image_url"]
|
|
2177
|
-
if (argImageUrl !== undefined)
|
|
2208
|
+
if (argImageUrl !== undefined) {
|
|
2209
|
+
body.append("image_url", toMultipartText(argImageUrl))
|
|
2210
|
+
}
|
|
2178
2211
|
let requestPath = '/api/v1/image/motou'
|
|
2179
2212
|
const responseKind = 'arrayBuffer'
|
|
2180
2213
|
return await this.c._request(
|
|
2181
2214
|
'POST',
|
|
2182
2215
|
requestPath,
|
|
2183
2216
|
Object.keys(query).length > 0 ? query : undefined,
|
|
2184
|
-
|
|
2217
|
+
body,
|
|
2185
2218
|
Object.keys(headers).length > 0 ? headers : undefined,
|
|
2186
2219
|
responseKind,
|
|
2187
2220
|
disableCache !== undefined ? { disableCache } : undefined,
|
|
@@ -2193,22 +2226,26 @@ export class ImageApi {
|
|
|
2193
2226
|
): Promise<PostImageNsfwResponse> {
|
|
2194
2227
|
const query: Record<string, unknown> = {}
|
|
2195
2228
|
const headers: Record<string, string> = {}
|
|
2196
|
-
const body
|
|
2229
|
+
const body = new FormData()
|
|
2197
2230
|
let disableCache: boolean | undefined
|
|
2198
2231
|
disableCache = args.disableCache ?? args["disable_cache"]
|
|
2199
2232
|
const argCacheBuster = args._t
|
|
2200
2233
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
2201
2234
|
const argFile = args.file
|
|
2202
|
-
if (argFile !== undefined)
|
|
2235
|
+
if (argFile !== undefined) {
|
|
2236
|
+
body.append("file",argFile)
|
|
2237
|
+
}
|
|
2203
2238
|
const argUrl = args.url
|
|
2204
|
-
if (argUrl !== undefined)
|
|
2239
|
+
if (argUrl !== undefined) {
|
|
2240
|
+
body.append("url", toMultipartText(argUrl))
|
|
2241
|
+
}
|
|
2205
2242
|
let requestPath = '/api/v1/image/nsfw'
|
|
2206
2243
|
const responseKind = 'json'
|
|
2207
2244
|
return await this.c._request(
|
|
2208
2245
|
'POST',
|
|
2209
2246
|
requestPath,
|
|
2210
2247
|
Object.keys(query).length > 0 ? query : undefined,
|
|
2211
|
-
|
|
2248
|
+
body,
|
|
2212
2249
|
Object.keys(headers).length > 0 ? headers : undefined,
|
|
2213
2250
|
responseKind,
|
|
2214
2251
|
disableCache !== undefined ? { disableCache } : undefined,
|
|
@@ -2220,32 +2257,46 @@ export class ImageApi {
|
|
|
2220
2257
|
): Promise<PostImageOcrResponse> {
|
|
2221
2258
|
const query: Record<string, unknown> = {}
|
|
2222
2259
|
const headers: Record<string, string> = {}
|
|
2223
|
-
const body
|
|
2260
|
+
const body = new FormData()
|
|
2224
2261
|
let disableCache: boolean | undefined
|
|
2225
2262
|
disableCache = args.disableCache ?? args["disable_cache"]
|
|
2226
2263
|
const argCacheBuster = args._t
|
|
2227
2264
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
2228
2265
|
const argEnableCls = args.enableCls ?? args["enable_cls"]
|
|
2229
|
-
if (argEnableCls !== undefined)
|
|
2266
|
+
if (argEnableCls !== undefined) {
|
|
2267
|
+
body.append("enable_cls", toMultipartText(argEnableCls))
|
|
2268
|
+
}
|
|
2230
2269
|
const argFile = args.file
|
|
2231
|
-
if (argFile !== undefined)
|
|
2270
|
+
if (argFile !== undefined) {
|
|
2271
|
+
body.append("file",argFile)
|
|
2272
|
+
}
|
|
2232
2273
|
const argImageBase64 = args.imageBase64 ?? args["image_base64"]
|
|
2233
|
-
if (argImageBase64 !== undefined)
|
|
2274
|
+
if (argImageBase64 !== undefined) {
|
|
2275
|
+
body.append("image_base64", toMultipartText(argImageBase64))
|
|
2276
|
+
}
|
|
2234
2277
|
const argImageName = args.imageName ?? args["image_name"]
|
|
2235
|
-
if (argImageName !== undefined)
|
|
2278
|
+
if (argImageName !== undefined) {
|
|
2279
|
+
body.append("image_name", toMultipartText(argImageName))
|
|
2280
|
+
}
|
|
2236
2281
|
const argNeedLocation = args.needLocation ?? args["need_location"]
|
|
2237
|
-
if (argNeedLocation !== undefined)
|
|
2282
|
+
if (argNeedLocation !== undefined) {
|
|
2283
|
+
body.append("need_location", toMultipartText(argNeedLocation))
|
|
2284
|
+
}
|
|
2238
2285
|
const argReturnMarkdown = args.returnMarkdown ?? args["return_markdown"]
|
|
2239
|
-
if (argReturnMarkdown !== undefined)
|
|
2286
|
+
if (argReturnMarkdown !== undefined) {
|
|
2287
|
+
body.append("return_markdown", toMultipartText(argReturnMarkdown))
|
|
2288
|
+
}
|
|
2240
2289
|
const argUrl = args.url
|
|
2241
|
-
if (argUrl !== undefined)
|
|
2290
|
+
if (argUrl !== undefined) {
|
|
2291
|
+
body.append("url", toMultipartText(argUrl))
|
|
2292
|
+
}
|
|
2242
2293
|
let requestPath = '/api/v1/image/ocr'
|
|
2243
2294
|
const responseKind = 'json'
|
|
2244
2295
|
return await this.c._request(
|
|
2245
2296
|
'POST',
|
|
2246
2297
|
requestPath,
|
|
2247
2298
|
Object.keys(query).length > 0 ? query : undefined,
|
|
2248
|
-
|
|
2299
|
+
body,
|
|
2249
2300
|
Object.keys(headers).length > 0 ? headers : undefined,
|
|
2250
2301
|
responseKind,
|
|
2251
2302
|
disableCache !== undefined ? { disableCache } : undefined,
|
|
@@ -2263,9 +2314,13 @@ export class ImageApi {
|
|
|
2263
2314
|
const argCacheBuster = args._t
|
|
2264
2315
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
2265
2316
|
const argBottomText = args.bottomText ?? args["bottom_text"]
|
|
2266
|
-
if (argBottomText !== undefined)
|
|
2317
|
+
if (argBottomText !== undefined) {
|
|
2318
|
+
body["bottom_text"] = argBottomText
|
|
2319
|
+
}
|
|
2267
2320
|
const argTopText = args.topText ?? args["top_text"]
|
|
2268
|
-
if (argTopText !== undefined)
|
|
2321
|
+
if (argTopText !== undefined) {
|
|
2322
|
+
body["top_text"] = argTopText
|
|
2323
|
+
}
|
|
2269
2324
|
let requestPath = '/api/v1/image/speechless'
|
|
2270
2325
|
const responseKind = 'arrayBuffer'
|
|
2271
2326
|
return await this.c._request(
|
|
@@ -2284,7 +2339,7 @@ export class ImageApi {
|
|
|
2284
2339
|
): Promise<PostImageSvgResponse> {
|
|
2285
2340
|
const query: Record<string, unknown> = {}
|
|
2286
2341
|
const headers: Record<string, string> = {}
|
|
2287
|
-
const body
|
|
2342
|
+
const body = new FormData()
|
|
2288
2343
|
let disableCache: boolean | undefined
|
|
2289
2344
|
disableCache = args.disableCache ?? args["disable_cache"]
|
|
2290
2345
|
const argCacheBuster = args._t
|
|
@@ -2298,14 +2353,16 @@ export class ImageApi {
|
|
|
2298
2353
|
const argQuality = args.quality
|
|
2299
2354
|
if (argQuality !== undefined) query["quality"] = argQuality
|
|
2300
2355
|
const argFile = args.file
|
|
2301
|
-
if (argFile !== undefined)
|
|
2356
|
+
if (argFile !== undefined) {
|
|
2357
|
+
body.append("file",argFile)
|
|
2358
|
+
}
|
|
2302
2359
|
let requestPath = '/api/v1/image/svg'
|
|
2303
2360
|
const responseKind = 'arrayBuffer'
|
|
2304
2361
|
return await this.c._request(
|
|
2305
2362
|
'POST',
|
|
2306
2363
|
requestPath,
|
|
2307
2364
|
Object.keys(query).length > 0 ? query : undefined,
|
|
2308
|
-
|
|
2365
|
+
body,
|
|
2309
2366
|
Object.keys(headers).length > 0 ? headers : undefined,
|
|
2310
2367
|
responseKind,
|
|
2311
2368
|
disableCache !== undefined ? { disableCache } : undefined,
|
|
@@ -2736,11 +2793,17 @@ export class MiscApi {
|
|
|
2736
2793
|
const argCacheBuster = args._t
|
|
2737
2794
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
2738
2795
|
const argEndDate = args.endDate ?? args["end_date"]
|
|
2739
|
-
if (argEndDate !== undefined)
|
|
2796
|
+
if (argEndDate !== undefined) {
|
|
2797
|
+
body["end_date"] = argEndDate
|
|
2798
|
+
}
|
|
2740
2799
|
const argFormat = args.format
|
|
2741
|
-
if (argFormat !== undefined)
|
|
2800
|
+
if (argFormat !== undefined) {
|
|
2801
|
+
body["format"] = argFormat
|
|
2802
|
+
}
|
|
2742
2803
|
const argStartDate = args.startDate ?? args["start_date"]
|
|
2743
|
-
if (argStartDate !== undefined)
|
|
2804
|
+
if (argStartDate !== undefined) {
|
|
2805
|
+
body["start_date"] = argStartDate
|
|
2806
|
+
}
|
|
2744
2807
|
let requestPath = '/api/v1/misc/date-diff'
|
|
2745
2808
|
const responseKind = 'json'
|
|
2746
2809
|
return await this.c._request(
|
|
@@ -3128,7 +3191,9 @@ export class RandomApi {
|
|
|
3128
3191
|
const argCacheBuster = args._t
|
|
3129
3192
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
3130
3193
|
const argQuestion = args.question
|
|
3131
|
-
if (argQuestion !== undefined)
|
|
3194
|
+
if (argQuestion !== undefined) {
|
|
3195
|
+
body["question"] = argQuestion
|
|
3196
|
+
}
|
|
3132
3197
|
let requestPath = '/api/v1/answerbook/ask'
|
|
3133
3198
|
const responseKind = 'json'
|
|
3134
3199
|
return await this.c._request(
|
|
@@ -3486,11 +3551,17 @@ export class TextApi {
|
|
|
3486
3551
|
const argCacheBuster = args._t
|
|
3487
3552
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
3488
3553
|
const argKey = args.key
|
|
3489
|
-
if (argKey !== undefined)
|
|
3554
|
+
if (argKey !== undefined) {
|
|
3555
|
+
body["key"] = argKey
|
|
3556
|
+
}
|
|
3490
3557
|
const argNonce = args.nonce
|
|
3491
|
-
if (argNonce !== undefined)
|
|
3558
|
+
if (argNonce !== undefined) {
|
|
3559
|
+
body["nonce"] = argNonce
|
|
3560
|
+
}
|
|
3492
3561
|
const argText = args.text
|
|
3493
|
-
if (argText !== undefined)
|
|
3562
|
+
if (argText !== undefined) {
|
|
3563
|
+
body["text"] = argText
|
|
3564
|
+
}
|
|
3494
3565
|
let requestPath = '/api/v1/text/aes/decrypt'
|
|
3495
3566
|
const responseKind = 'json'
|
|
3496
3567
|
return await this.c._request(
|
|
@@ -3515,15 +3586,25 @@ export class TextApi {
|
|
|
3515
3586
|
const argCacheBuster = args._t
|
|
3516
3587
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
3517
3588
|
const argIv = args.iv
|
|
3518
|
-
if (argIv !== undefined)
|
|
3589
|
+
if (argIv !== undefined) {
|
|
3590
|
+
body["iv"] = argIv
|
|
3591
|
+
}
|
|
3519
3592
|
const argKey = args.key
|
|
3520
|
-
if (argKey !== undefined)
|
|
3593
|
+
if (argKey !== undefined) {
|
|
3594
|
+
body["key"] = argKey
|
|
3595
|
+
}
|
|
3521
3596
|
const argMode = args.mode
|
|
3522
|
-
if (argMode !== undefined)
|
|
3597
|
+
if (argMode !== undefined) {
|
|
3598
|
+
body["mode"] = argMode
|
|
3599
|
+
}
|
|
3523
3600
|
const argPadding = args.padding
|
|
3524
|
-
if (argPadding !== undefined)
|
|
3601
|
+
if (argPadding !== undefined) {
|
|
3602
|
+
body["padding"] = argPadding
|
|
3603
|
+
}
|
|
3525
3604
|
const argText = args.text
|
|
3526
|
-
if (argText !== undefined)
|
|
3605
|
+
if (argText !== undefined) {
|
|
3606
|
+
body["text"] = argText
|
|
3607
|
+
}
|
|
3527
3608
|
let requestPath = '/api/v1/text/aes/decrypt-advanced'
|
|
3528
3609
|
const responseKind = 'json'
|
|
3529
3610
|
return await this.c._request(
|
|
@@ -3548,9 +3629,13 @@ export class TextApi {
|
|
|
3548
3629
|
const argCacheBuster = args._t
|
|
3549
3630
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
3550
3631
|
const argKey = args.key
|
|
3551
|
-
if (argKey !== undefined)
|
|
3632
|
+
if (argKey !== undefined) {
|
|
3633
|
+
body["key"] = argKey
|
|
3634
|
+
}
|
|
3552
3635
|
const argText = args.text
|
|
3553
|
-
if (argText !== undefined)
|
|
3636
|
+
if (argText !== undefined) {
|
|
3637
|
+
body["text"] = argText
|
|
3638
|
+
}
|
|
3554
3639
|
let requestPath = '/api/v1/text/aes/encrypt'
|
|
3555
3640
|
const responseKind = 'json'
|
|
3556
3641
|
return await this.c._request(
|
|
@@ -3575,17 +3660,29 @@ export class TextApi {
|
|
|
3575
3660
|
const argCacheBuster = args._t
|
|
3576
3661
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
3577
3662
|
const argIv = args.iv
|
|
3578
|
-
if (argIv !== undefined)
|
|
3663
|
+
if (argIv !== undefined) {
|
|
3664
|
+
body["iv"] = argIv
|
|
3665
|
+
}
|
|
3579
3666
|
const argKey = args.key
|
|
3580
|
-
if (argKey !== undefined)
|
|
3667
|
+
if (argKey !== undefined) {
|
|
3668
|
+
body["key"] = argKey
|
|
3669
|
+
}
|
|
3581
3670
|
const argMode = args.mode
|
|
3582
|
-
if (argMode !== undefined)
|
|
3671
|
+
if (argMode !== undefined) {
|
|
3672
|
+
body["mode"] = argMode
|
|
3673
|
+
}
|
|
3583
3674
|
const argOutputFormat = args.outputFormat ?? args["output_format"]
|
|
3584
|
-
if (argOutputFormat !== undefined)
|
|
3675
|
+
if (argOutputFormat !== undefined) {
|
|
3676
|
+
body["output_format"] = argOutputFormat
|
|
3677
|
+
}
|
|
3585
3678
|
const argPadding = args.padding
|
|
3586
|
-
if (argPadding !== undefined)
|
|
3679
|
+
if (argPadding !== undefined) {
|
|
3680
|
+
body["padding"] = argPadding
|
|
3681
|
+
}
|
|
3587
3682
|
const argText = args.text
|
|
3588
|
-
if (argText !== undefined)
|
|
3683
|
+
if (argText !== undefined) {
|
|
3684
|
+
body["text"] = argText
|
|
3685
|
+
}
|
|
3589
3686
|
let requestPath = '/api/v1/text/aes/encrypt-advanced'
|
|
3590
3687
|
const responseKind = 'json'
|
|
3591
3688
|
return await this.c._request(
|
|
@@ -3610,7 +3707,9 @@ export class TextApi {
|
|
|
3610
3707
|
const argCacheBuster = args._t
|
|
3611
3708
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
3612
3709
|
const argText = args.text
|
|
3613
|
-
if (argText !== undefined)
|
|
3710
|
+
if (argText !== undefined) {
|
|
3711
|
+
body["text"] = argText
|
|
3712
|
+
}
|
|
3614
3713
|
let requestPath = '/api/v1/text/analyze'
|
|
3615
3714
|
const responseKind = 'json'
|
|
3616
3715
|
return await this.c._request(
|
|
@@ -3635,7 +3734,9 @@ export class TextApi {
|
|
|
3635
3734
|
const argCacheBuster = args._t
|
|
3636
3735
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
3637
3736
|
const argText = args.text
|
|
3638
|
-
if (argText !== undefined)
|
|
3737
|
+
if (argText !== undefined) {
|
|
3738
|
+
body["text"] = argText
|
|
3739
|
+
}
|
|
3639
3740
|
let requestPath = '/api/v1/text/base64/decode'
|
|
3640
3741
|
const responseKind = 'json'
|
|
3641
3742
|
return await this.c._request(
|
|
@@ -3660,7 +3761,9 @@ export class TextApi {
|
|
|
3660
3761
|
const argCacheBuster = args._t
|
|
3661
3762
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
3662
3763
|
const argText = args.text
|
|
3663
|
-
if (argText !== undefined)
|
|
3764
|
+
if (argText !== undefined) {
|
|
3765
|
+
body["text"] = argText
|
|
3766
|
+
}
|
|
3664
3767
|
let requestPath = '/api/v1/text/base64/encode'
|
|
3665
3768
|
const responseKind = 'json'
|
|
3666
3769
|
return await this.c._request(
|
|
@@ -3685,13 +3788,21 @@ export class TextApi {
|
|
|
3685
3788
|
const argCacheBuster = args._t
|
|
3686
3789
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
3687
3790
|
const argFrom = args.from
|
|
3688
|
-
if (argFrom !== undefined)
|
|
3791
|
+
if (argFrom !== undefined) {
|
|
3792
|
+
body["from"] = argFrom
|
|
3793
|
+
}
|
|
3689
3794
|
const argOptions = args.options
|
|
3690
|
-
if (argOptions !== undefined)
|
|
3795
|
+
if (argOptions !== undefined) {
|
|
3796
|
+
body["options"] = argOptions
|
|
3797
|
+
}
|
|
3691
3798
|
const argText = args.text
|
|
3692
|
-
if (argText !== undefined)
|
|
3799
|
+
if (argText !== undefined) {
|
|
3800
|
+
body["text"] = argText
|
|
3801
|
+
}
|
|
3693
3802
|
const argTo = args.to
|
|
3694
|
-
if (argTo !== undefined)
|
|
3803
|
+
if (argTo !== undefined) {
|
|
3804
|
+
body["to"] = argTo
|
|
3805
|
+
}
|
|
3695
3806
|
let requestPath = '/api/v1/text/convert'
|
|
3696
3807
|
const responseKind = 'json'
|
|
3697
3808
|
return await this.c._request(
|
|
@@ -3716,11 +3827,17 @@ export class TextApi {
|
|
|
3716
3827
|
const argCacheBuster = args._t
|
|
3717
3828
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
3718
3829
|
const argFormat = args.format
|
|
3719
|
-
if (argFormat !== undefined)
|
|
3830
|
+
if (argFormat !== undefined) {
|
|
3831
|
+
body["format"] = argFormat
|
|
3832
|
+
}
|
|
3720
3833
|
const argSanitize = args.sanitize
|
|
3721
|
-
if (argSanitize !== undefined)
|
|
3834
|
+
if (argSanitize !== undefined) {
|
|
3835
|
+
body["sanitize"] = argSanitize
|
|
3836
|
+
}
|
|
3722
3837
|
const argText = args.text
|
|
3723
|
-
if (argText !== undefined)
|
|
3838
|
+
if (argText !== undefined) {
|
|
3839
|
+
body["text"] = argText
|
|
3840
|
+
}
|
|
3724
3841
|
let requestPath = '/api/v1/text/markdown-to-html'
|
|
3725
3842
|
const responseKind = 'json'
|
|
3726
3843
|
return await this.c._request(
|
|
@@ -3745,11 +3862,17 @@ export class TextApi {
|
|
|
3745
3862
|
const argCacheBuster = args._t
|
|
3746
3863
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
3747
3864
|
const argPaperSize = args.paperSize ?? args["paper_size"]
|
|
3748
|
-
if (argPaperSize !== undefined)
|
|
3865
|
+
if (argPaperSize !== undefined) {
|
|
3866
|
+
body["paper_size"] = argPaperSize
|
|
3867
|
+
}
|
|
3749
3868
|
const argText = args.text
|
|
3750
|
-
if (argText !== undefined)
|
|
3869
|
+
if (argText !== undefined) {
|
|
3870
|
+
body["text"] = argText
|
|
3871
|
+
}
|
|
3751
3872
|
const argTheme = args.theme
|
|
3752
|
-
if (argTheme !== undefined)
|
|
3873
|
+
if (argTheme !== undefined) {
|
|
3874
|
+
body["theme"] = argTheme
|
|
3875
|
+
}
|
|
3753
3876
|
let requestPath = '/api/v1/text/markdown-to-pdf'
|
|
3754
3877
|
const responseKind = 'arrayBuffer'
|
|
3755
3878
|
return await this.c._request(
|
|
@@ -3774,7 +3897,9 @@ export class TextApi {
|
|
|
3774
3897
|
const argCacheBuster = args._t
|
|
3775
3898
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
3776
3899
|
const argText = args.text
|
|
3777
|
-
if (argText !== undefined)
|
|
3900
|
+
if (argText !== undefined) {
|
|
3901
|
+
body["text"] = argText
|
|
3902
|
+
}
|
|
3778
3903
|
let requestPath = '/api/v1/text/md5'
|
|
3779
3904
|
const responseKind = 'json'
|
|
3780
3905
|
return await this.c._request(
|
|
@@ -3799,9 +3924,13 @@ export class TextApi {
|
|
|
3799
3924
|
const argCacheBuster = args._t
|
|
3800
3925
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
3801
3926
|
const argHash = args.hash
|
|
3802
|
-
if (argHash !== undefined)
|
|
3927
|
+
if (argHash !== undefined) {
|
|
3928
|
+
body["hash"] = argHash
|
|
3929
|
+
}
|
|
3803
3930
|
const argText = args.text
|
|
3804
|
-
if (argText !== undefined)
|
|
3931
|
+
if (argText !== undefined) {
|
|
3932
|
+
body["text"] = argText
|
|
3933
|
+
}
|
|
3805
3934
|
let requestPath = '/api/v1/text/md5/verify'
|
|
3806
3935
|
const responseKind = 'json'
|
|
3807
3936
|
return await this.c._request(
|
|
@@ -3851,15 +3980,25 @@ export class TranslateApi {
|
|
|
3851
3980
|
const argTargetLang = args.targetLang ?? args["target_lang"]
|
|
3852
3981
|
if (argTargetLang !== undefined) query["target_lang"] = argTargetLang
|
|
3853
3982
|
const argContext = args.context
|
|
3854
|
-
if (argContext !== undefined)
|
|
3983
|
+
if (argContext !== undefined) {
|
|
3984
|
+
body["context"] = argContext
|
|
3985
|
+
}
|
|
3855
3986
|
const argPreserveFormat = args.preserveFormat ?? args["preserve_format"]
|
|
3856
|
-
if (argPreserveFormat !== undefined)
|
|
3987
|
+
if (argPreserveFormat !== undefined) {
|
|
3988
|
+
body["preserve_format"] = argPreserveFormat
|
|
3989
|
+
}
|
|
3857
3990
|
const argSourceLang = args.sourceLang ?? args["source_lang"]
|
|
3858
|
-
if (argSourceLang !== undefined)
|
|
3991
|
+
if (argSourceLang !== undefined) {
|
|
3992
|
+
body["source_lang"] = argSourceLang
|
|
3993
|
+
}
|
|
3859
3994
|
const argStyle = args.style
|
|
3860
|
-
if (argStyle !== undefined)
|
|
3995
|
+
if (argStyle !== undefined) {
|
|
3996
|
+
body["style"] = argStyle
|
|
3997
|
+
}
|
|
3861
3998
|
const argText = args.text
|
|
3862
|
-
if (argText !== undefined)
|
|
3999
|
+
if (argText !== undefined) {
|
|
4000
|
+
body["text"] = argText
|
|
4001
|
+
}
|
|
3863
4002
|
let requestPath = '/api/v1/ai/translate'
|
|
3864
4003
|
const responseKind = 'json'
|
|
3865
4004
|
return await this.c._request(
|
|
@@ -3884,13 +4023,21 @@ export class TranslateApi {
|
|
|
3884
4023
|
const argCacheBuster = args._t
|
|
3885
4024
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
3886
4025
|
const argFromLang = args.fromLang ?? args["from_lang"]
|
|
3887
|
-
if (argFromLang !== undefined)
|
|
4026
|
+
if (argFromLang !== undefined) {
|
|
4027
|
+
body["from_lang"] = argFromLang
|
|
4028
|
+
}
|
|
3888
4029
|
const argQuery = args.query
|
|
3889
|
-
if (argQuery !== undefined)
|
|
4030
|
+
if (argQuery !== undefined) {
|
|
4031
|
+
body["query"] = argQuery
|
|
4032
|
+
}
|
|
3890
4033
|
const argToLang = args.toLang ?? args["to_lang"]
|
|
3891
|
-
if (argToLang !== undefined)
|
|
4034
|
+
if (argToLang !== undefined) {
|
|
4035
|
+
body["to_lang"] = argToLang
|
|
4036
|
+
}
|
|
3892
4037
|
const argTone = args.tone
|
|
3893
|
-
if (argTone !== undefined)
|
|
4038
|
+
if (argTone !== undefined) {
|
|
4039
|
+
body["tone"] = argTone
|
|
4040
|
+
}
|
|
3894
4041
|
let requestPath = '/api/v1/translate/stream'
|
|
3895
4042
|
const responseKind = 'json'
|
|
3896
4043
|
return await this.c._request(
|
|
@@ -3917,7 +4064,9 @@ export class TranslateApi {
|
|
|
3917
4064
|
const argToLang = args.toLang ?? args["to_lang"]
|
|
3918
4065
|
if (argToLang !== undefined) query["to_lang"] = argToLang
|
|
3919
4066
|
const argText = args.text
|
|
3920
|
-
if (argText !== undefined)
|
|
4067
|
+
if (argText !== undefined) {
|
|
4068
|
+
body["text"] = argText
|
|
4069
|
+
}
|
|
3921
4070
|
let requestPath = '/api/v1/translate/text'
|
|
3922
4071
|
const responseKind = 'json'
|
|
3923
4072
|
return await this.c._request(
|
|
@@ -4073,7 +4222,9 @@ export class MinGanCiShiBieApi {
|
|
|
4073
4222
|
const argCacheBuster = args._t
|
|
4074
4223
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
4075
4224
|
const argKeywords = args.keywords
|
|
4076
|
-
if (argKeywords !== undefined)
|
|
4225
|
+
if (argKeywords !== undefined) {
|
|
4226
|
+
body["keywords"] = argKeywords
|
|
4227
|
+
}
|
|
4077
4228
|
let requestPath = '/api/v1/sensitive-word/analyze'
|
|
4078
4229
|
const responseKind = 'json'
|
|
4079
4230
|
return await this.c._request(
|
|
@@ -4098,7 +4249,9 @@ export class MinGanCiShiBieApi {
|
|
|
4098
4249
|
const argCacheBuster = args._t
|
|
4099
4250
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
4100
4251
|
const argText = args.text
|
|
4101
|
-
if (argText !== undefined)
|
|
4252
|
+
if (argText !== undefined) {
|
|
4253
|
+
body["text"] = argText
|
|
4254
|
+
}
|
|
4102
4255
|
let requestPath = '/api/v1/text/profanitycheck'
|
|
4103
4256
|
const responseKind = 'json'
|
|
4104
4257
|
return await this.c._request(
|
|
@@ -4146,17 +4299,29 @@ export class ZhiNengSouSuoApi {
|
|
|
4146
4299
|
const argCacheBuster = args._t
|
|
4147
4300
|
if (argCacheBuster !== undefined) query["_t"] = argCacheBuster
|
|
4148
4301
|
const argFetchFull = args.fetchFull ?? args["fetch_full"]
|
|
4149
|
-
if (argFetchFull !== undefined)
|
|
4302
|
+
if (argFetchFull !== undefined) {
|
|
4303
|
+
body["fetch_full"] = argFetchFull
|
|
4304
|
+
}
|
|
4150
4305
|
const argFiletype = args.filetype
|
|
4151
|
-
if (argFiletype !== undefined)
|
|
4306
|
+
if (argFiletype !== undefined) {
|
|
4307
|
+
body["filetype"] = argFiletype
|
|
4308
|
+
}
|
|
4152
4309
|
const argQuery = args.query
|
|
4153
|
-
if (argQuery !== undefined)
|
|
4310
|
+
if (argQuery !== undefined) {
|
|
4311
|
+
body["query"] = argQuery
|
|
4312
|
+
}
|
|
4154
4313
|
const argSite = args.site
|
|
4155
|
-
if (argSite !== undefined)
|
|
4314
|
+
if (argSite !== undefined) {
|
|
4315
|
+
body["site"] = argSite
|
|
4316
|
+
}
|
|
4156
4317
|
const argSort = args.sort
|
|
4157
|
-
if (argSort !== undefined)
|
|
4318
|
+
if (argSort !== undefined) {
|
|
4319
|
+
body["sort"] = argSort
|
|
4320
|
+
}
|
|
4158
4321
|
const argTimeRange = args.timeRange ?? args["time_range"]
|
|
4159
|
-
if (argTimeRange !== undefined)
|
|
4322
|
+
if (argTimeRange !== undefined) {
|
|
4323
|
+
body["time_range"] = argTimeRange
|
|
4324
|
+
}
|
|
4160
4325
|
let requestPath = '/api/v1/search/aggregate'
|
|
4161
4326
|
const responseKind = 'json'
|
|
4162
4327
|
return await this.c._request(
|