uapi-browser-sdk 0.1.1 → 0.1.3
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/README.md +42 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.js +82 -77
- package/internal/.openapi-generator/FILES +6 -0
- package/internal/docs/PostTranslateStream400Response.md +36 -0
- package/internal/docs/PostTranslateStream500Response.md +36 -0
- package/internal/docs/PostTranslateStreamRequest.md +40 -0
- package/internal/docs/TranslateApi.md +70 -0
- package/internal/src/apis/TranslateApi.ts +58 -0
- package/internal/src/models/PostTranslateStream400Response.ts +85 -0
- package/internal/src/models/PostTranslateStream500Response.ts +73 -0
- package/internal/src/models/PostTranslateStreamRequest.ts +112 -0
- package/internal/src/models/index.ts +3 -0
- package/package.json +4 -2
- package/src/index.ts +82 -77
package/README.md
CHANGED
|
@@ -23,6 +23,39 @@ const result = await client.social.getSocialQqUserinfo({ qq: '10001' })
|
|
|
23
23
|
console.log(result)
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
## CDN 引入
|
|
27
|
+
|
|
28
|
+
`uapi-browser-sdk` 发布在 npm,因而可以直接通过常见 CDN 以 ES Module 方式加载。建议在生产环境固定版本号(`@latest` 仅用于快速试用)。
|
|
29
|
+
|
|
30
|
+
### jsDelivr(推荐)
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<script type="module">
|
|
34
|
+
import { UapiClient } from 'https://cdn.jsdelivr.net/npm/uapi-browser-sdk@latest/dist/index.js';
|
|
35
|
+
|
|
36
|
+
const client = new UapiClient('https://uapis.cn/api/v1');
|
|
37
|
+
const data = await client.social.getSocialQqUserinfo({ qq: '10001' });
|
|
38
|
+
console.log(data);
|
|
39
|
+
</script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### UNPKG(原生 ESM)
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<script type="module">
|
|
46
|
+
import { UapiClient } from 'https://unpkg.com/uapi-browser-sdk@latest/dist/index.js?module';
|
|
47
|
+
// ...
|
|
48
|
+
</script>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### ESM CDN(esm.run / esm.sh)
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { UapiClient } from 'https://esm.run/uapi-browser-sdk@latest';
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
三种 CDN 均会返回同一份浏览器模块,可按自己的缓存/区域策略选择。
|
|
58
|
+
|
|
26
59
|
## 特性
|
|
27
60
|
|
|
28
61
|
现在你不再需要反反复复的查阅文档了。
|
|
@@ -51,17 +84,18 @@ SDK 采用原生 `fetch`,自动补上 `Authorization` 头且不依赖任何 No
|
|
|
51
84
|
|
|
52
85
|
| 语言 | 仓库地址 |
|
|
53
86
|
|-------------|--------------------------------------------------------------|
|
|
54
|
-
| Go | https://github.com/AxT-Team/uapi-go
|
|
55
|
-
| Python | https://github.com/AxT-Team/uapi-python
|
|
56
|
-
| TypeScript| https://github.com/AxT-Team/uapi-typescript
|
|
87
|
+
| Go | https://github.com/AxT-Team/uapi-sdk-go |
|
|
88
|
+
| Python | https://github.com/AxT-Team/uapi-sdk-python |
|
|
89
|
+
| TypeScript| https://github.com/AxT-Team/uapi-sdk-typescript |
|
|
57
90
|
| Browser (TypeScript/JavaScript)(当前)| https://github.com/AxT-Team/uapi-browser-sdk |
|
|
58
|
-
| Java | https://github.com/AxT-Team/uapi-java
|
|
59
|
-
| PHP | https://github.com/AxT-Team/uapi-php
|
|
60
|
-
| C# | https://github.com/AxT-Team/uapi-csharp
|
|
61
|
-
| C++ | https://github.com/AxT-Team/uapi-cpp
|
|
62
|
-
| Rust | https://github.com/AxT-Team/uapi-rust
|
|
91
|
+
| Java | https://github.com/AxT-Team/uapi-sdk-java |
|
|
92
|
+
| PHP | https://github.com/AxT-Team/uapi-sdk-php |
|
|
93
|
+
| C# | https://github.com/AxT-Team/uapi-sdk-csharp |
|
|
94
|
+
| C++ | https://github.com/AxT-Team/uapi-sdk-cpp |
|
|
95
|
+
| Rust | https://github.com/AxT-Team/uapi-sdk-rust |
|
|
63
96
|
|
|
64
97
|
## 文档
|
|
65
98
|
|
|
66
99
|
访问 [UApi文档首页](https://uapis.cn/docs/introduction) 并选择任意接口,向下滚动到 **快速启动** 区块即可看到最新的 Browser (TypeScript) 示例代码。
|
|
67
100
|
|
|
101
|
+
|
package/dist/index.d.ts
CHANGED
|
@@ -144,6 +144,7 @@ declare class TranslateApi {
|
|
|
144
144
|
constructor(c: UapiClient);
|
|
145
145
|
getAiTranslateLanguages(args?: any): Promise<any>;
|
|
146
146
|
postAiTranslate(args?: any): Promise<any>;
|
|
147
|
+
postTranslateStream(args?: any): Promise<any>;
|
|
147
148
|
postTranslateText(args?: any): Promise<any>;
|
|
148
149
|
}
|
|
149
150
|
declare class WebparseApi {
|