Skip to content

Commit 9eb8186

Browse files
committed
Implement Maven Release Plugin for version management - Update pom.xml with maven-release-plugin and SCM config, sync versions across build.gradle, build.sbt, and api_spec.yaml to 0.1.0-SNAPSHOT, update README.md and api_spec.yaml with new version info, add VERSIONING.md with release process documentation, and add OpenAPI generator ignore file and Gradle properties.
1 parent 7e0541c commit 9eb8186

File tree

8 files changed

+423
-135
lines changed

8 files changed

+423
-135
lines changed

.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

README.md

Lines changed: 116 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,158 @@
1-
<div align="center">
2-
<a href="https://wavespeed.ai" target="_blank" rel="noopener noreferrer">
3-
<img src="https://raw.githubusercontent.com/WaveSpeedAI/waverless/main/docs/images/wavespeed-dark-logo.png" alt="WaveSpeedAI logo" width="200"/>
4-
</a>
1+
# openapi-java-client
52

6-
<h1>WaveSpeedAI Java SDK</h1>
3+
WaveSpeed AI API
4+
- API version: 0.1.0-SNAPSHOT
5+
- Build date: 2025-12-11T14:56:51.031680200+08:00[Asia/Shanghai]
6+
- Generator version: 7.10.0
77

8-
<p>
9-
<strong>Official Java SDK for the WaveSpeedAI inference platform</strong>
10-
</p>
8+
API for generating images using WaveSpeed AI
119

12-
<p>
13-
<a href="https://wavespeed.ai" target="_blank" rel="noopener noreferrer">🌐 Visit wavespeed.ai</a> •
14-
<a href="https://wavespeed.ai/docs">📖 Documentation</a> •
15-
<a href="https://github.com/WaveSpeedAI/wavespeed-java/issues">💬 Issues</a>
16-
</p>
17-
</div>
1810

19-
---
11+
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
12+
13+
14+
## Requirements
15+
16+
Building the API client library requires:
17+
1. Java 1.8+
18+
2. Maven (3.8.3+)/Gradle (7.2+)
2019

2120
## Installation
2221

23-
### Maven
22+
To install the API client library to your local Maven repository, simply execute:
2423

25-
Add this dependency to your project's `pom.xml`:
24+
```shell
25+
mvn clean install
26+
```
27+
28+
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
29+
30+
```shell
31+
mvn clean deploy
32+
```
33+
34+
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
35+
36+
### Maven users
37+
38+
Add this dependency to your project's POM:
2639

2740
```xml
2841
<dependency>
29-
<groupId>ai.wavespeed.maven</groupId>
30-
<artifactId>wavespeed</artifactId>
31-
<version>0.0.1</version>
42+
<groupId>org.openapitools</groupId>
43+
<artifactId>openapi-java-client</artifactId>
44+
<version>0.1.0-SNAPSHOT</version>
45+
<scope>compile</scope>
3246
</dependency>
3347
```
3448

35-
### Gradle
49+
### Gradle users
3650

37-
Add this dependency to your project's `build.gradle`:
51+
Add this dependency to your project's build file:
3852

3953
```groovy
40-
dependencies {
41-
implementation "ai.wavespeed.maven:wavespeed:0.0.1"
42-
}
54+
repositories {
55+
mavenCentral() // Needed if the 'openapi-java-client' jar has been published to maven central.
56+
mavenLocal() // Needed if the 'openapi-java-client' jar has been published to the local maven repo.
57+
}
58+
59+
dependencies {
60+
implementation "org.openapitools:openapi-java-client:0.1.0-SNAPSHOT"
61+
}
4362
```
4463

45-
## API Client
64+
### Others
4665

47-
Run WaveSpeed AI models with a simple API:
66+
At first generate the JAR by executing:
4867

49-
```java
50-
import ai.wavespeed.WaveSpeed;
51-
import ai.wavespeed.openapi.client.model.Prediction;
52-
import java.util.HashMap;
53-
import java.util.Map;
54-
55-
WaveSpeed client = new WaveSpeed("your-api-key");
56-
Map<String, Object> input = new HashMap<>();
57-
input.put("prompt", "Cat");
58-
59-
try {
60-
Prediction result = client.run("wavespeed-ai/z-image/turbo", input);
61-
System.out.println(result.getOutputs().get(0)); // Output URL
62-
} catch (Exception e) {
63-
e.printStackTrace();
64-
}
68+
```shell
69+
mvn clean package
6570
```
6671

67-
### Authentication
72+
Then manually install the following JARs:
6873

69-
Set your API key via environment variable (You can get your API key from [https://wavespeed.ai/accesskey](https://wavespeed.ai/accesskey)):
74+
* `target/openapi-java-client-0.1.0-SNAPSHOT.jar`
75+
* `target/lib/*.jar`
7076

71-
```bash
72-
export WAVESPEED_API_KEY="your-api-key"
73-
```
77+
## Getting Started
7478

75-
Or pass it directly:
79+
Please follow the [installation](#installation) instruction and execute the following Java code:
7680

7781
```java
78-
WaveSpeed client = new WaveSpeed("your-api-key");
79-
```
8082

81-
### Options
83+
// Import classes:
84+
import ai.wavespeed.openapi.client.ApiClient;
85+
import ai.wavespeed.openapi.client.ApiException;
86+
import ai.wavespeed.openapi.client.Configuration;
87+
import ai.wavespeed.openapi.client.auth.*;
88+
import ai.wavespeed.openapi.client.model.*;
89+
import ai.wavespeed.openapi.client.api.DefaultApi;
90+
91+
public class Example {
92+
public static void main(String[] args) {
93+
ApiClient defaultClient = Configuration.getDefaultApiClient();
94+
defaultClient.setBasePath("https://api.wavespeed.ai/api/v2");
95+
96+
// Configure HTTP bearer authorization: bearerAuth
97+
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
98+
bearerAuth.setBearerToken("BEARER TOKEN");
99+
100+
DefaultApi apiInstance = new DefaultApi(defaultClient);
101+
String modelId = "modelId_example"; // String | The ID of the model to use for image generation
102+
Map<String, Object> requestBody = null; // Map<String, Object> |
103+
String webhook = "webhook_example"; // String | The URL to which the webhook will be sent
104+
try {
105+
PredictionResponse result = apiInstance.createPredictionData(modelId, requestBody, webhook);
106+
System.out.println(result);
107+
} catch (ApiException e) {
108+
System.err.println("Exception when calling DefaultApi#createPredictionData");
109+
System.err.println("Status code: " + e.getCode());
110+
System.err.println("Reason: " + e.getResponseBody());
111+
System.err.println("Response headers: " + e.getResponseHeaders());
112+
e.printStackTrace();
113+
}
114+
}
115+
}
82116

83-
```java
84-
// Custom poll interval and timeout (seconds)
85-
WaveSpeed client = new WaveSpeed("your-api-key", 1.0, 36000.0);
86117
```
87118

88-
### Upload Files
119+
## Documentation for API Endpoints
89120

90-
Upload images, videos, or audio files:
121+
All URIs are relative to *https://api.wavespeed.ai/api/v2*
91122

92-
```java
93-
WaveSpeed client = new WaveSpeed("your-api-key");
123+
Class | Method | HTTP request | Description
124+
------------ | ------------- | ------------- | -------------
125+
*DefaultApi* | [**createPredictionData**](docs/DefaultApi.md#createPredictionData) | **POST** /{model_id} | Generate an image using the specified model
126+
*DefaultApi* | [**getPredictionData**](docs/DefaultApi.md#getPredictionData) | **GET** /predictions/{predictionId}/result | Retrieve the result of a prediction
94127

95-
try {
96-
String url = client.upload("/path/to/image.png");
97-
System.out.println(url);
98-
} catch (Exception e) {
99-
e.printStackTrace();
100-
}
101-
```
102128

103-
## Environment Variables
129+
## Documentation for Models
104130

105-
### API Client
131+
- [CreatePredictionData400Response](docs/CreatePredictionData400Response.md)
132+
- [CreatePredictionData400ResponseData](docs/CreatePredictionData400ResponseData.md)
133+
- [CreatePredictionData401Response](docs/CreatePredictionData401Response.md)
134+
- [CreatePredictionData500Response](docs/CreatePredictionData500Response.md)
135+
- [Prediction](docs/Prediction.md)
136+
- [PredictionResponse](docs/PredictionResponse.md)
137+
- [PredictionUrls](docs/PredictionUrls.md)
106138

107-
| Variable | Description |
108-
|----------|-------------|
109-
| `WAVESPEED_API_KEY` | WaveSpeed API key |
110-
| `WAVESPEED_BASE_URL` | API base URL without path (default: `https://api.wavespeed.ai`) |
111-
| `WAVESPEED_POLL_INTERVAL` | Poll interval seconds for `run` (default: `1.0`) |
112-
| `WAVESPEED_TIMEOUT` | Overall wait timeout seconds for `run` (default: `36000.0`) |
113139

114-
## Requirements
140+
<a id="documentation-for-authorization"></a>
141+
## Documentation for Authorization
142+
143+
144+
Authentication schemes defined for the API:
145+
<a id="bearerAuth"></a>
146+
### bearerAuth
147+
148+
- **Type**: HTTP Bearer Token authentication
149+
150+
151+
## Recommendation
152+
153+
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
154+
155+
## Author
115156

116-
- Java 1.8+
117-
- Maven 3.6+ or Gradle 7.2+
118157

119-
## License
120158

121-
Apache 2.0

VERSIONING.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Versioning with Maven Release Plugin
2+
3+
This project uses [Maven Release Plugin](https://maven.apache.org/maven-release/maven-release-plugin/) for automatic version management based on Git tags.
4+
5+
## Version Format
6+
7+
- **Development versions**: `0.1.0-SNAPSHOT` (current)
8+
- **Tagged release**: `0.1.0` (based on git tag `v0.1.0`)
9+
- **Next development**: `0.2.0-SNAPSHOT` (after release)
10+
11+
## How It Works
12+
13+
The Maven Release Plugin automatically:
14+
- Updates version numbers in all build files (pom.xml, build.gradle, build.sbt)
15+
- Creates Git tags for releases
16+
- Updates to next development version after release
17+
- Generates release notes and changelogs
18+
19+
## Release Process
20+
21+
### Automated Release (Recommended)
22+
23+
1. Ensure all changes are committed and pushed:
24+
```bash
25+
git add .
26+
git commit -m "Prepare for release"
27+
git push origin main
28+
```
29+
30+
2. Run the release prepare command:
31+
```bash
32+
mvn release:prepare
33+
```
34+
This will:
35+
- Ask for release version (e.g., `0.1.0`)
36+
- Ask for next development version (e.g., `0.2.0-SNAPSHOT`)
37+
- Update all version files
38+
- Create Git tag
39+
40+
3. Perform the release:
41+
```bash
42+
mvn release:perform
43+
```
44+
This will deploy artifacts to repository
45+
46+
### Manual Release Steps
47+
48+
If you need more control, you can do it manually:
49+
50+
1. Create and push a version tag:
51+
```bash
52+
git tag -a v0.1.0 -m "Release version 0.1.0"
53+
git push origin v0.1.0
54+
```
55+
56+
2. Update versions manually in all build files:
57+
- pom.xml: `<version>0.1.0</version>`
58+
- build.gradle: `version = '0.1.0'`
59+
- build.sbt: `version := "0.1.0"`
60+
61+
## Checking Current Version
62+
63+
The current version is defined in:
64+
- `pom.xml` (primary)
65+
- `build.gradle`
66+
- `build.sbt`
67+
68+
Run `mvn help:evaluate -Dexpression=project.version -q -DforceStdout` to check current version.
69+
70+
## Configuration
71+
72+
The release plugin is configured in `pom.xml` with:
73+
- SCM information pointing to the correct repository
74+
- Release profile that includes javadoc and sources
75+
- Automatic version management across submodules
76+
77+
## Notes
78+
79+
- Always use SNAPSHOT versions during development
80+
- Release versions should not have -SNAPSHOT suffix
81+
- The plugin automatically handles version increments
82+
- Make sure your Git repository is clean before running release commands

0 commit comments

Comments
 (0)