Skip to content

Commit f374c7f

Browse files
author
AxT-Team Bot
committed
chore: apply build fixes
0 parents  commit f374c7f

File tree

870 files changed

+131913
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

870 files changed

+131913
-0
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
root = true
2+
[*]
3+
charset = utf-8
4+
end_of_line = lf
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true

.github/workflows/release.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: release
2+
on:
3+
push:
4+
tags: ['v*.*.*']
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- run: echo "Release placeholder - customize per registry"

.github/workflows/test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: test
2+
on: [push, pull_request]
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- uses: actions/setup-java@v4
9+
with: { distribution: 'temurin', java-version: '17' }
10+
- run: mvn -q -DskipTests package

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.DS_Store
2+
.idea/
3+
.vscode/
4+
dist/
5+
build/
6+
coverage/

README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# uapi-sdk-java
2+
3+
![Banner](./banner.png)
4+
5+
[![Java](https://img.shields.io/badge/Java-17+-EA2D2F?style=flat-square&logo=openjdk&logoColor=white)](https://adoptium.net/)
6+
[![Docs](https://img.shields.io/badge/Docs-uapis.cn-2EAE5D?style=flat-square)](https://uapis.cn/)
7+
8+
> [!NOTE]
9+
> 所有接口的 Java 示例都可以在 [UApi](https://uapis.cn/docs/introduction) 的接口文档页面,向下滚动至 **快速启动** 区块后直接复制。
10+
11+
## 快速开始
12+
13+
```bash
14+
git clone https://github.com/AxT-Team/uapi-sdk-java.git
15+
cd uapi-sdk-java
16+
mvn -q package
17+
```
18+
19+
```java
20+
import uapi.Client;
21+
import java.util.Map;
22+
23+
public class Demo {
24+
public static void main(String[] args) throws Exception {
25+
var client = new Client("https://uapis.cn/api/v1", "");
26+
var info = client.social().getSocialQqUserinfo(Map.of("qq", "10001"));
27+
System.out.println(info);
28+
}
29+
}
30+
```
31+
32+
## 特性
33+
34+
现在你不再需要反反复复的查阅文档了。
35+
36+
只需在 IDE 中键入 `client.`,所有核心模块——如 `social()``game()``image()`——即刻同步展现。进一步输入即可直接定位到 `getSocialQqUserinfo` 这样的具体方法,其名称与文档的 `operationId` 严格保持一致,确保了开发过程的直观与高效。
37+
38+
所有方法签名只接受真实且必需的参数。当你在构建请求时,IDE 会即时提示 `qq``username` 等键名,这彻底杜绝了在 `Map<String, Object>` 中因键名拼写错误而导致的运行时错误。
39+
40+
针对 401、404、429 等标准 HTTP 响应,SDK 已将其统一映射为具名的异常类型(`UapiException.Unauthorized``UapiException.NotFound``UapiException.ServiceBusy` 等)。这些异常均附带 `status``code``details` 等关键上下文信息,确保你在日志中能第一时间准确、快速地诊断问题。
41+
42+
基础域名、请求超时和 `User-Agent` 已预设为合理的默认值。但你完全拥有控制权,可以通过 `new Client(baseUrl, token)` 结合 OkHttp 自定义拦截器,灵活覆盖 Token、BaseURL 等配置。
43+
44+
如果你需要查看字段细节或内部逻辑,仓库中的 `./internal` 目录同步保留了由 `openapi-generator` 生成的完整结构体,随时可供参考。
45+
46+
## 错误模型概览
47+
48+
| HTTP 状态码 | SDK 错误类型 | 附加信息 |
49+
|-------------|----------------------------------------------|------------------------------------------------------------------------------------|
50+
| 401/403 | `UapiException.Unauthorized` | `code``status` |
51+
| 404 | `UapiException.NotFound` / `UapiException.NoMatch` | `code``status` |
52+
| 400 | `UapiException.InvalidParameter` / `UapiException.InvalidParams` | `code``status``details` |
53+
| 429 | `UapiException.ServiceBusy` | `code``status``retry_after_seconds` |
54+
| 5xx | `UapiException.InternalServerError` / `UapiException.ApiError` | `code``status``details` |
55+
| 其他 4xx | `UapiException` | `code``status``details` |
56+
57+
## 其他 SDK
58+
59+
| 语言 | 仓库地址 |
60+
|-------------|--------------------------------------------------------------|
61+
| Go | https://github.com/AxT-Team/uapi-go-sdk |
62+
| Python | https://github.com/AxT-Team/uapi-python-sdk |
63+
| TypeScript| https://github.com/AxT-Team/uapi-typescript-sdk |
64+
| Browser (TypeScript/JavaScript)| https://github.com/AxT-Team/uapi-browser-sdk |
65+
| Java(当前) | https://github.com/AxT-Team/uapi-java-sdk |
66+
| PHP | https://github.com/AxT-Team/uapi-php-sdk |
67+
| C# | https://github.com/AxT-Team/uapi-csharp-sdk |
68+
| C++ | https://github.com/AxT-Team/uapi-cpp-sdk |
69+
| Rust | https://github.com/AxT-Team/uapi-rust-sdk |
70+
71+
## 文档
72+
73+
访问 [UApi文档首页](https://uapis.cn/docs/introduction) 并选择任意接口,向下滚动到 **快速启动** 区块即可看到最新的 Java 示例代码。

banner.png

2.53 MB
Loading
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
#
4+
# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech)
5+
6+
name: Java CI with Maven
7+
8+
on:
9+
push:
10+
branches: [ main, master ]
11+
pull_request:
12+
branches: [ main, master ]
13+
14+
jobs:
15+
build:
16+
name: Build UAPI
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
java: [ 17, 21 ]
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up JDK
24+
uses: actions/setup-java@v4
25+
with:
26+
java-version: ${{ matrix.java }}
27+
distribution: 'temurin'
28+
cache: maven
29+
- name: Build with Maven
30+
run: mvn -B package --no-transfer-progress --file pom.xml

internal/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*.class
2+
3+
# Mobile Tools for Java (J2ME)
4+
.mtj.tmp/
5+
6+
# Package Files #
7+
*.jar
8+
*.war
9+
*.ear
10+
11+
# exclude jar for gradle wrapper
12+
!gradle/wrapper/*.jar
13+
14+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
15+
hs_err_pid*
16+
17+
# build files
18+
**/target
19+
target
20+
.gradle
21+
build

internal/.openapi-generator-ignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md

0 commit comments

Comments
 (0)