Skip to content

Commit

Permalink
Merge pull request #7 from Kucoin/dev
Browse files Browse the repository at this point in the history
Stable version 1.0.0
  • Loading branch information
ISAAC-XXYYZZ authored Dec 31, 2024
2 parents b986b81 + e9a4639 commit 8790e7c
Show file tree
Hide file tree
Showing 338 changed files with 25,003 additions and 1,051 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ define generate-code
@echo "$(GREEN)lang: $(lang), done!$(NC)"
endef

define generate-postman
@make -f generate.mk generate-postman
endef


SUBDIRS := $(shell find ./sdk -mindepth 1 -maxdepth 1 -type d)
.PHONY: test $(SUBDIRS)
Expand All @@ -86,9 +90,14 @@ $(SUBDIRS):

.PHONY: generate
generate: setup-logs
$(call generate-postman)
$(call generate-code,golang,/pkg/generate)
$(call generate-code,python,/kucoin_universal_sdk/generate)

.PHONY: gen-postman
gen-postman: preprocessor
$(call generate-postman)

.PHONY: fastgen
fastgen: build-tools preprocessor
@make generate
Expand Down
22 changes: 8 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,24 @@ The **KuCoin Universal SDK** is the official SDK provided by KuCoin, offering a

## 🛠️ Installation

### Latest Version: `0.1.1-alpha`
**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.
### Latest Version: `1.0.0`

### Python Installation

```bash
pip install kucoin-universal-sdk==0.1.1a1
pip install kucoin-universal-sdk
```

### Golang Installation

```bash
go get github.com/Kucoin/kucoin-universal-sdk/sdk/golang@v0.1.1-alpha
go get github.com/Kucoin/kucoin-universal-sdk/sdk/golang
go mod tidy
```

### Postman Installation
Visit the [KuCoin API Collection on Postman](https://www.postman.com/kucoin-api/kucoin-api/overview)

## 📖 Getting Started

Here's a quick example to get you started with the SDK in **Python**.
Expand Down Expand Up @@ -122,6 +124,7 @@ For other languages, refer to the [Examples](#-examples) section.
- Official Documentation: [KuCoin API Docs](https://www.kucoin.com/docs-new)
- **[Python Documentation](sdk/python/README.md)**
- **[Go Documentation](sdk/golang/README.md)**
- **[Postman Documentation](sdk/postman/README.md)**

## 📂 Examples
Find usage examples for your desired language by selecting the corresponding link below:
Expand All @@ -131,6 +134,7 @@ Find usage examples for your desired language by selecting the corresponding lin
| Python | [sdk/python/examples/](sdk/python/example/)|
| Go | [sdk/go/examples/](sdk/golang/example/) |


## 🏗️ Technical Design

The KuCoin Universal SDK is built with a code-generation-first approach to ensure consistency, scalability, and rapid updates across all supported languages. By leveraging the OpenAPI Specification and a custom code generator, the SDK achieves the following advantages:
Expand Down Expand Up @@ -181,18 +185,8 @@ The following table describes the key components of the project directory:
| `README.md` | Main documentation file. |
| `generate.mk` | Additional Makefile specifically for code generation tasks. |
| `generator/` | Directory containing the code generation logic. |
| `generator/plugin/` | Custom plugins for generating SDKs. |
| `generator/preprocessor/`| Scripts or tools for preprocessing API specifications. |
| `sdk/` | Directory for generated SDKs organized by language. |
| `sdk/golang/` | Generated SDK for Golang. |
| `sdk/python/` | Generated SDK for Python. |
| `spec/` | Directory containing API specification files. |
| `spec/apis.csv` | List of all APIs. |
| `spec/original/` | Original unprocessed API specifications. |
| `spec/rest/` | REST API specifications. |
| `spec/ws/` | WebSocket API specifications. |
| `spec/ws.csv` | List of WebSocket-specific APIs.


## ⚙️ Build and Test Guide

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.1-alpha
v1.0.0
11 changes: 10 additions & 1 deletion generate.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ RED=\033[0;31m
GREEN=\033[0;32m
NC=\033[0m

define generate-postman-func
docker run --rm -v "${PWD}:/local" -w /local/generator/postman -e SDK_VERSION=$(VERSION) python:3.9.20-alpine3.20 \
python main.py

@echo "$(GREEN)lang: postman, done!$(NC)"
endef

define generate-api
@echo "$(GREEN)lang: $(2). generate api for $(service)...$(NC)"
Expand Down Expand Up @@ -79,7 +85,10 @@ REST_FILES := $(wildcard ./spec/rest/api/*.json)
ENTRY_FILES := $(wildcard ./spec/rest/entry/*.json)
WS_FILES := $(wildcard ./spec/ws/*.json)

.PHONY: generate $(REST_FILES) $(ENTRY_FILES) $(WS_FILES) force
.PHONY: generate $(REST_FILES) $(ENTRY_FILES) $(WS_FILES) generate-postman force

generate-postman:
$(call generate-postman-func)

generate: $(patsubst ./spec/rest/api/%.json,generate-rest-%, $(REST_FILES)) $(patsubst ./spec/rest/entry/%.json,generate-entry-%, $(ENTRY_FILES)) $(patsubst ./spec/ws/%.json,generate-ws-%, $(WS_FILES))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type {{classname}} interface {

// {{vendorExtensions.x-meta.method}} {{summary}}
// Description: {{notes}}
// Documentation: {{vendorExtensions.x-api-doc}}
{{#vendorExtensions.x-extra-comment}}
// {{.}}
{{/vendorExtensions.x-extra-comment}}{{#isDeprecated}} // Deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class {{classname}}(ABC):
"""
summary: {{summary}}
description: {{notes}}
documentation: {{vendorExtensions.x-api-doc}}
{{#vendorExtensions.x-extra-comment}}
{{.}}
{{/vendorExtensions.x-extra-comment}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class SdkGeneratorTest {

private static final String SDK_NAME = "golang-sdk";
private static final String SDK_NAME = "python-sdk";
private static final String SPEC_NAME = "../../spec/rest/api/openapi-account-fee.json";
private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-account.json";
private static final String WS_SPEC_NAME = "../../spec/ws/openapi-futures-private.json";
Expand Down
Loading

0 comments on commit 8790e7c

Please sign in to comment.