Skip to content

Commit 85dc620

Browse files
authored
Merge pull request #57 from Kucoin/dev
Add Java Implementation
2 parents 0ebb95e + 1c82c5e commit 85dc620

File tree

891 files changed

+93318
-10790
lines changed

Some content is hidden

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

891 files changed

+93318
-10790
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish Java Package to Maven Central
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
packages: write
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@v4
17+
18+
- name: Set up JDK
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '11'
22+
distribution: 'temurin'
23+
cache: 'maven'
24+
server-id: ossrh
25+
server-username: OSSRH_USERNAME
26+
server-password: OSSRH_PASSWORD
27+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
28+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
29+
30+
- name: Publish to Apache Maven Central
31+
run: mvn deploy -DskipTest
32+
working-directory: sdk/java
33+
env:
34+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
35+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
36+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ API documentation [Changelog](https://www.kucoin.com/docs-new/change-log)
44

55
Current synchronized API documentation version [20250529](https://www.kucoin.com/docs-new/change-log#20250529)
66

7+
## 2025-07-30(Java 0.1.0-alpha)
8+
- Release Java implementation
9+
710
## 2025-06-11(PHP 0.1.3-alpha)
811
- Add compatibility for PHP versions from 7.4 to 8.x
912

Dockerfile

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
# build plugin
2-
FROM amazoncorretto:11-alpine AS generator-builder
2+
FROM maven:3.9.10-amazoncorretto-17-debian-bookworm AS generator-builder
33

44
ENV MAVEN_VERSION=3.8.8
55
ENV MAVEN_HOME=/usr/share/maven
66
ENV PATH=${MAVEN_HOME}/bin:${PATH}
77

8-
RUN apk add --no-cache curl tar bash \
9-
&& echo ${MAVEN_HOME} \
10-
&& curl -fsSL https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz | tar -xzC /usr/share \
11-
&& mv /usr/share/apache-maven-${MAVEN_VERSION} ${MAVEN_HOME} \
12-
&& ln -s ${MAVEN_HOME}/bin/mvn /usr/bin/mvn \
13-
&& apk del curl tar
14-
15-
168
WORKDIR /build
179

1810
COPY ./generator/plugin /build
@@ -22,7 +14,7 @@ RUN --mount=type=cache,target=/root/.m2,sharing=locked mvn -U clean package -Dsk
2214
# build tools
2315
FROM openapitools/openapi-generator-cli:v7.7.0
2416

25-
RUN apt-get update && apt-get install python3 python3-pip python3.8-venv nodejs jq npm -y
17+
RUN apt-get update && apt-get install python3 python3-pip python3.8-venv nodejs jq npm clang-format -y
2618
RUN pip install yapf
2719
ENV GOLANG_VERSION=1.22.2
2820
RUN curl -OL https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz && \
@@ -49,6 +41,7 @@ ENV GO_POST_PROCESS_FILE="/usr/local/go/bin/gofmt -w"
4941
ENV PYTHON_POST_PROCESS_FILE="/usr/local/bin/yapf -i"
5042
ENV TS_POST_PROCESS_FILE="/usr/bin/prettier --write --semi --single-quote --tab-width 4 --trailing-comma all --bracket-spacing --arrow-parens always --end-of-line lf --print-width 100"
5143
ENV PHP_POST_PROCESS_FILE="php-prettier --write"
44+
ENV JAVA_POST_PROCESS_FILE="/usr/bin/clang-format -i"
5245

5346
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
5447

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,16 @@ define generate-code
6868
@echo "$(GREEN)lang: ${lang}, copy changelog...$(NC)"
6969
docker run --rm -v "${PWD}:/local" $(IMAGE_NAME):$(IMAGE_TAG) cp /local/CHANGELOG.md /local/sdk/$(lang)
7070

71-
@make -f generate.mk generate lang=$(1) subdir=$(2) USER_VERSION=$(3)
71+
@$(MAKE) -f generate.mk generate lang=$(1) subdir=$(2) USER_VERSION=$(3)
7272

7373
@echo "$(GREEN)lang: $(lang), clean...$(NC)"
7474
docker run --rm -v "${PWD}:/local" $(IMAGE_NAME):$(IMAGE_TAG) rm -rf $(outdir)/.openapi-generator
7575
docker run --rm -v "${PWD}:/local" $(IMAGE_NAME):$(IMAGE_TAG) rm -rf $(outdir)/.openapi-generator-ignore
7676

77+
@echo "$(GREEN)lang: $(lang), format project...$(NC)"
78+
@sleep 5
79+
@$(MAKE) -C sdk/$(lang) format
80+
7781
@echo "$(GREEN)lang: $(lang), done!$(NC)"
7882
endef
7983

@@ -88,7 +92,8 @@ generate: setup-logs
8892
$(call generate-code,golang,/pkg/generate)
8993
$(call generate-code,python,/kucoin_universal_sdk/generate)
9094
$(call generate-code,node,/src/generate)
91-
$(call generate-code,php,/src/Generate,0.1.2-alpha)
95+
$(call generate-code,php,/src/Generate,0.1.3-alpha)
96+
$(call generate-code,java,/src/main/java/com/kucoin/universal/sdk/generate,0.1.0-alpha)
9297

9398
.PHONY: gen-postman
9499
gen-postman: preprocessor

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ npm install kucoin-universal-sdk
5858
composer require kucoin/kucoin-universal-sdk=0.1.3-alpha
5959
```
6060

61+
### Java Installation(0.1.0-alpha)
62+
**Note**: This SDK is currently in the Alpha phase. We are actively iterating and improving its features, stability, and documentation. Feedback and contributions are highly encouraged to help us refine the SDK.
63+
```bash
64+
<dependency>
65+
<groupId>com.kucoin</groupId>
66+
<artifactId>kucoin-universal-sdk</artifactId>
67+
<version>0.1.0-alpha</version>
68+
</dependency>
69+
```
70+
6171
### Postman Installation
6272
Visit the [KuCoin API Collection on Postman](https://www.postman.com/kucoin-api/kucoin-api/overview)
6373

@@ -137,6 +147,7 @@ For other languages, refer to the [Examples](#-examples) section.
137147
- **[Go Documentation](sdk/golang/README.md)**
138148
- **[Node.js Documentation](sdk/node/README.md)**
139149
- **[PHP Documentation](sdk/php/README.md)**
150+
- **[Java Documentation](sdk/java/README.md)**
140151
- **[Postman Documentation](sdk/postman/README.md)**
141152

142153
## 📂 Examples
@@ -147,7 +158,8 @@ Find usage examples for your desired language by selecting the corresponding lin
147158
| Python | [sdk/python/examples/](sdk/python/example/)|
148159
| Go | [sdk/go/examples/](sdk/golang/example/) |
149160
| Node.js | [sdk/node/examples/](sdk/node/example/) |
150-
| PHP | [sdk/php/examples/](sdk/php/example/) |
161+
| PHP | [sdk/php/examples/](sdk/php/example/) |
162+
| Java | [sdk/java/examples/](sdk/java/example/) |
151163

152164
## 📋 Changelog
153165

@@ -236,12 +248,7 @@ Before you begin, ensure the following dependencies are installed:
236248

237249
5. **Run Tests**
238250
Run automatically generated tests for all SDKs.
239-
Command: `make test`
240-
241-
6. **Run All Steps**
242-
Execute the entire pipeline: build tools, preprocess specifications, validate, and generate code.
243-
Command: `make all`
244-
251+
Command: `make auto-test`
245252

246253
## 🤝 Contribution Guidelines
247254

generator/plugin/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<maven.compiler.plugin.version>3.6.1</maven.compiler.plugin.version>
1818
<ascii-table.version>1.8.0</ascii-table.version>
1919
<csv.version>5.7.1</csv.version>
20+
<commons-lang3.version>3.17.0</commons-lang3.version>
2021
</properties>
2122

2223
<dependencies>
@@ -43,6 +44,12 @@
4344
<version>${csv.version}</version>
4445
<scope>compile</scope>
4546
</dependency>
47+
<dependency>
48+
<groupId>org.apache.commons</groupId>
49+
<artifactId>commons-lang3</artifactId>
50+
<version>${commons-lang3.version}</version>
51+
<scope>compile</scope>
52+
</dependency>
4653
</dependencies>
4754

4855

0 commit comments

Comments
 (0)