Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# AGENTS.md — uapi-sdk-java

This file tells AI coding agents how to use the **official Java SDK** for
the [uapis.cn](https://uapis.cn) public API platform.

## What this artifact is

Idiomatic Java client for UAPI. Generated from the live OpenAPI 3.1 spec at
<https://uapis.cn/openapi.json> — class names, method names, and parameter
shapes track the real API.

## Install

Maven (`pom.xml`):

```xml
<dependency>
<groupId>cn.uapis</groupId>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fix the documented Maven coordinates

The groupId documented here does not match the artifact this repository builds: pom.xml still declares <groupId>AxT-Team</groupId>, and the existing README quickstart imports uapi.Client rather than any cn.uapis package. Agents following this new playbook will add cn.uapis:uapi-sdk-java:0.1.17, which this project does not produce, and then generate usage code that cannot resolve against the SDK.

Useful? React with 👍 / 👎.

<artifactId>uapi-sdk-java</artifactId>
<version>0.1.17</version>
</dependency>
```

Gradle (`build.gradle.kts`):

```kotlin
implementation("cn.uapis:uapi-sdk-java:0.1.17")
```

## Quick start

```java
import cn.uapis.UapiClient;
import cn.uapis.api.MiscApi;
import cn.uapis.model.GetMiscWeatherRequest;

UapiClient client = new UapiClient("https://uapis.cn");
MiscApi misc = new MiscApi(client);
var resp = misc.getMiscWeather(new GetMiscWeatherRequest().city("北京"));
System.out.println(resp);
```

The SDK is grouped by tag (`MiscApi`, `NetworkApi`, `TextApi`, `ImageApi`,
`SocialApi`, `TranslateApi`, `SearchApi`, …). Method names match the
OpenAPI `operationId`, camelCased.

## Authentication

Free-tier endpoints work with no key. Paid endpoints take a key:

```java
UapiClient client = new UapiClient("https://uapis.cn", "sk_…");
```

## Errors

Methods throw `UapiApiException` (subclass of `IOException`) on non-2xx
responses. The exception carries `code`, `error`, and `requestId` fields.
Surface `error` verbatim.

## Rate limits

Headers `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`,
`Retry-After` are exposed on response headers. Honor them.

## Related repos

- MCP server: <https://github.com/AxT-Team/uapi-mcp>.
- Skills bundle: <https://github.com/AxT-Team/uapi-agent-skills>.
- Other languages: `uapi-sdk-typescript`, `uapi-sdk-python`, `uapi-sdk-go`,
`uapi-sdk-rust`, `uapi-sdk-csharp`, `uapi-sdk-cpp`, `uapi-sdk-php`.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 AxT-Team / UAPI

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,29 @@
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
</properties>
<name>UAPI SDK for Java</name>
<description>Official Java SDK for UAPI / uapis.cn — typed Java 17+ wrapper around 100+ free public-API endpoints (network, text, image, social, translation, search). Generated from the live OpenAPI 3.1 spec.</description>
<url>https://uapis.cn/docs/sdk/java</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://github.com/AxT-Team/uapi-sdk-java/blob/main/LICENSE</url>
</license>
</licenses>
<developers>
<developer>
<id>uapi</id>
<name>UAPI</name>
<email>dev@uapis.cn</email>
<organization>AxT-Team</organization>
<organizationUrl>https://uapis.cn</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/AxT-Team/uapi-sdk-java.git</connection>
<developerConnection>scm:git:ssh://github.com:AxT-Team/uapi-sdk-java.git</developerConnection>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fix malformed SCM developer connection

When Maven release/deploy tooling uses this developerConnection, the SSH URL portion parses as host github.com with port AxT-Team; Java URI parsing rejects that non-numeric port, so SCM consumers cannot use it for developer checkouts or tags. Use a valid form such as scm:git:ssh://git@github.com/AxT-Team/uapi-sdk-java.git or scm:git:git@github.com:AxT-Team/uapi-sdk-java.git.

Useful? React with 👍 / 👎.

<url>https://github.com/AxT-Team/uapi-sdk-java/tree/main</url>
</scm>
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
Expand Down
Loading