diff --git a/.gitignore b/.gitignore index 5c34472..f0c8337 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ *.tgz -*.whl \ No newline at end of file +*.whl +*.jar +*.zip +*.nupkg \ No newline at end of file diff --git a/Makefile b/Makefile index 5337085..025540e 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,161 @@ -.PHONY: build build-js build-go build-py +.PHONY: init-js init-go init-py init-java init-php init-dart -GO_SDK_VERSION=1.0.0 +init-js: + @cd javascript-sdk && pnpm install + +init-go: + @cd golang-sdk && go mod tidy + +init-py: + @cd python-sdk && uv sync --all-groups + +init-java: + @cd java-sdk && mvn install + +init-php: + @cd php-sdk && composer install + +init-dart: + @cd dart-sdk && dart pub get + +.PHONY: build build-js build-go build-py build-java build-php build-cs build-dart build: - @echo "清理已构建SDK包..." + @echo "清理已构建 SDK 包..." @echo "" - @rm -rf wikibroker*.tgz wikibroker*.whl + @rm -rf wikibroker*.tgz wikibroker*.whl wikibroker*.jar wikibroker*.zip WikiBroker*.nupkg @echo "" - @echo "开始构建所有SDK..." + @echo "开始构建所有 SDK ..." @echo "" - @$(MAKE) build-js && $(MAKE) build-go && $(MAKE) build-py + @echo "[1/8] 开始构建 JavaScript SDK..." && $(MAKE) build-js && echo "[1/8] JavaScript SDK 构建完成 ✓" + @echo "[2/8] 开始构建 Go SDK..." && $(MAKE) build-go && echo "[2/8] Go SDK 构建完成 ✓" + @echo "[3/8] 开始构建 Python SDK..." && $(MAKE) build-py && echo "[3/8] Python SDK 构建完成 ✓" + @echo "[4/8] 开始构建 Java SDK..." && $(MAKE) build-java && echo "[4/8] Java SDK 构建完成 ✓" + @echo "[5/8] 开始构建 PHP SDK..." && $(MAKE) build-php && echo "[5/8] PHP SDK 构建完成 ✓" + @echo "[6/8] 开始构建 .NET SDK..." && $(MAKE) build-cs && echo "[6/8] .NET SDK 构建完成 ✓" + @echo "[7/8] 开始构建 Dart SDK..." && $(MAKE) build-dart && echo "[7/8] Dart SDK 构建完成 ✓" + @echo "[8/8] 开始构建 Swift SDK..." && $(MAKE) build-sw && echo "[8/8] Swift SDK 构建完成 ✓" @echo "" @echo "所有SDK构建成功!" -build-js: - @echo "[1/3] 开始构建 JavaScript SDK..." +build-js: init-js @cd javascript-sdk && rm -rf dist && pnpm pack && rename 's/openapi-sdk/openapi-js-sdk/' wikibroker-*.tgz && mv wikibroker-*.tgz .. - @echo "[1/3] JavaScript SDK 构建完成 ✓" - @echo "" + +GO_SDK_VERSION = 1.0.1 build-go: - @echo "[2/3] 开始构建 Go SDK..." @cp -r golang-sdk wikibroker_openapi_sdk && tar zcf wikibroker-openapi-go-sdk-$(GO_SDK_VERSION).tgz wikibroker_openapi_sdk && rm -rf wikibroker_openapi_sdk - @echo "[2/3] Go SDK 构建完成 ✓" - @echo "" -build-py: - @echo "[3/3] 开始构建 Python SDK..." - @cd python-sdk && rm -rf dist && poetry build && mv dist/wikibroker*.whl .. - @echo "[3/3] Python SDK 构建完成 ✓" - @echo "" +build-py: init-py + @cd python-sdk && rm -rf dist && uv build && mv dist/wikibroker*.whl .. + +build-java: init-java + @cd java-sdk && rm -rf target && mvn package && mv target/wikibroker*.jar .. + +build-php: init-php + @cd php-sdk && composer build && rename 's/wikiglobal-wikibroker-openapi-sdk/wikibroker-openapi-php-sdk/' wikiglobal*.zip && mv wikibroker*.zip .. + +build-cs: + @cd dotnet-sdk/src && rm -rf bin/ obj/ && dotnet pack && mv bin/Release/WikiBroker*.nupkg ../.. + +SWIFT_SDK_VERSION = 0.1.0-alpha + +build-sw: + @cd swift-sdk && cp -r . WikibrokerOpenapiSdk && swift package archive-source --package-path=WikibrokerOpenapiSdk && zip -d WikibrokerOpenapiSdk/WikibrokerOpenapiSdk.zip "WikibrokerOpenapiSdk/.*/*" && mv WikibrokerOpenapiSdk/WikibrokerOpenapiSdk.zip ../wikibroker-openapi-swift-sdk-$(SWIFT_SDK_VERSION).zip && rm -rf WikibrokerOpenapiSdk/ + +DART_SDK_VERSION := $(shell yq '.version' dart-sdk/pubspec.yaml) + +build-dart: + @cp -r dart-sdk wikibroker_openapi_sdk && cd wikibroker_openapi_sdk && rm -rf .dart_tool .idea *.iml && cd .. && tar zcf wikibroker-openapi-dart-sdk-$(DART_SDK_VERSION).tgz wikibroker_openapi_sdk && rm -rf wikibroker_openapi_sdk + +.PHONY: test test-js test-go test-py test-java test-php test-cs test-dart + +test: + @echo "运行所有 SDK 测试..." + @echo "[1/8] 运行 JavaScript SDK 测试..." && $(MAKE) test-js && echo "[1/8] JavaScript SDK 测试通过 ✓" + @echo "[2/8] 运行 Go SDK 测试..." && $(MAKE) test-go && echo "[2/8] Go SDK 测试通过 ✓" + @echo "[3/8] 运行 Python SDK 测试..." && $(MAKE) test-py && echo "[3/8] Python SDK 测试通过 ✓" + @echo "[4/8] 运行 Java SDK 测试..." && $(MAKE) test-java && echo "[4/8] Java SDK 测试通过 ✓" + @echo "[5/8] 运行 PHP SDK 测试..." && $(MAKE) test-php && echo "[5/8] PHP SDK 测试通过 ✓" + @echo "[6/8] 运行 .NET SDK 测试..." && $(MAKE) test-cs && echo "[6/8] .NET SDK 测试通过 ✓" + @echo "[7/8] 运行 Dart SDK 测试..." && $(MAKE) test-dart && echo "[7/8] Dart SDK 测试通过 ✓" + @echo "[8/8] 运行 Swift SDK 测试..." && $(MAKE) test-sw && echo "[8/8] Swift SDK 测试通过 ✓" + @echo "所有 SDK 测试完成!" + +test-js: init-js + @cd javascript-sdk && pnpm test + +test-go: init-go + @cd golang-sdk && go test -v + +test-py: init-py + @cd python-sdk && uv run pytest + +test-java: init-java + @cd java-sdk && mvn test + +test-php: init-php + @cd php-sdk && composer test + +test-cs: + @cd dotnet-sdk/tests && dotnet test + +test-dart: init-dart + @cd dart-sdk && dart test + +test-sw: + @cd swift-sdk && swift test + +.PHONY: doc + +doc: + @echo "生成可视化文档..." + @cd docs && npx @redocly/cli build-docs openapi.json -o index.html + @echo "可视化文档生成完成!" + +.PHONY: cloc cloc-js cloc-go cloc-py cloc-java cloc-php cloc-cs cloc-dart + +cloc: + @echo "统计所有 SDK 核心逻辑代码行数..."; \ + TS=$$($(MAKE) cloc-js | grep TypeScript | awk '{print $$1 "\t" $$5}'); \ + GO=$$($(MAKE) cloc-go | grep "Go " | awk '{print $$1 "\t" $$5}'); \ + PY=$$($(MAKE) cloc-py | grep "Python " | awk '{print $$1 "\t" $$5}'); \ + JAVA=$$($(MAKE) cloc-java | grep "Java " | awk '{print $$1 "\t" $$5}'); \ + PHP=$$($(MAKE) cloc-php | grep "PHP " | awk '{print $$1 "\t" $$5}'); \ + CS=$$($(MAKE) cloc-cs | grep "C# " | awk '{print $$1 "\t" $$5}'); \ + DART=$$($(MAKE) cloc-dart | grep "Dart " | awk '{print $$1 "\t" $$5}'); \ + SW=$$($(MAKE) cloc-sw | grep "Swift " | awk '{print $$1 "\t" $$5}'); \ + printf "%-15s %15s\n" $$TS $$GO $$PY $$JAVA $$PHP $$CS $$DART $$SW + @echo "所有 SDK 代码行数统计完毕!" + +cloc-js: + @echo "统计 JavaScript SDK 核心逻辑代码行数..." + @cd javascript-sdk && cloc src/core.ts + +cloc-go: + @echo "统计 Go SDK 核心逻辑代码行数..." + @cd golang-sdk && cloc core.go + +cloc-py: + @echo "统计 Python SDK 核心逻辑代码行数..." + @cd python-sdk && cloc src/wikibroker_openapi_sdk/core.py + +cloc-java: + @echo "统计 Java SDK 核心逻辑代码行数..." + @cd java-sdk && cloc src/main/java/com/wikiglobal/wikibroker/openapi/Core.java + +cloc-php: + @echo "统计 PHP SDK 核心逻辑代码行数..." + @cd php-sdk && cloc src/Core.php + +cloc-cs: + @echo "统计 .NET SDK 核心逻辑代码行数..." + @cd dotnet-sdk && cloc src/Core.cs + +cloc-dart: + @echo "统计 Dart SDK 核心逻辑代码行数..." + @cd dart-sdk && cloc lib/src/core.dart + +cloc-sw: + @echo "统计 Swift SDK 核心逻辑代码行数..." + @cd swift-sdk && cloc Sources/WikibrokerOpenapiSdk/Core.swift \ No newline at end of file diff --git a/README.md b/README.md index 3492be5..becf889 100644 --- a/README.md +++ b/README.md @@ -27,17 +27,17 @@ WikiBroker的OpenAPI接口都会校验请求
npm - npm install ./wikibroker-openapi-js-sdk-1.0.0.tgz + npm install ./wikibroker-openapi-js-sdk-1.0.1.tgz
yarn - yarn add ./wikibroker-openapi-js-sdk-1.0.0.tgz + yarn add ./wikibroker-openapi-js-sdk-1.0.1.tgz
pnpm - pnpm add ./wikibroker-openapi-js-sdk-1.0.0.tgz + pnpm add ./wikibroker-openapi-js-sdk-1.0.1.tgz

@@ -89,7 +89,7 @@ axios.post( **安装** ```bash -tar zxf wikibroker-openapi-go-sdk-1.0.0.tgz +tar zxf wikibroker-openapi-go-sdk-1.0.1.tgz go mod edit -replace=wikibroker_openapi_sdk=./wikibroker_openapi_sdk go get wikibroker_openapi_sdk ``` @@ -117,12 +117,27 @@ client.Post( `resty` ```golang -import sdk "wikibroker_openapi_sdk" +import ( + "bytes" + "encoding/json" + "io" + sdk "wikibroker_openapi_sdk" +) const apiKey = "ef05e5b0-9daf-49e3-a0f4-9a3c13f55c3b" const apiSecret = "4ae4bf20-0afa-4122-ade8-c0beca7bd5e4" client := resty.New() -m := sdk.NewRestyRequestMiddleware(apiKey, apiSecret) +m := sdk.NewRestyRequestMiddleware( + apiKey, + apiSecret, + func(body any) (io.ReadCloser, error) { + data, err := json.Marshal(body) + if err != nil { + return nil, err + } + return io.NopCloser(bytes.NewBuffer(data)), nil + }, +) client.AddRequestMiddleware(m) client.R().SetBody( @@ -186,17 +201,17 @@ agent.Post("https://api.example.com/test?q1=c&q2=b&q1=a").Send(body).End()
pip - pip install ./wikibroker_openapi_sdk-1.0.0a0-py3-none-any.whl + pip install ./wikibroker_openapi_sdk-1.0.1-py3-none-any.whl
poetry - poetry add ./wikibroker_openapi_sdk-1.0.0a0-py3-none-any.whl + poetry add ./wikibroker_openapi_sdk-1.0.1-py3-none-any.whl
uv - uv add ./wikibroker_openapi_sdk-1.0.0a0-py3-none-any.whl + uv add ./wikibroker_openapi_sdk-1.0.1-py3-none-any.whl

@@ -260,6 +275,352 @@ async def send_request(): send_request() ``` +#### `Java`接入 + +**安装** + +`maven` + +1. 第一步:安装jar包 + + ```bash + mvn install:install-file \ + -Dfile=./wikibroker-openapi-sdk-0.1.0-alpha.jar \ + -DgroupId=com.wikiglobal \ + -DartifactId=wikibroker-openapi-sdk \ + -Dversion=0.1.0-alpha \ + -Dpackaging=jar + ``` + +2. 第二步:声明maven依赖 + + ```xml + + com.wikiglobal + wikibroker-openapi-sdk + 0.1.0-alpha + compile + ``` + +`gradle` + +1. 方式一:使用Groovy声明依赖 + + `build.gradle` + + ```groovy + dependencies { + implementation files('./wikibroker-openapi-sdk-0.1.0-alpha.jar') + } + ``` + +2. 方式二:使用Kotlin声明依赖 + + `build.gradle.kts` + + ```kotlin + dependencies { + implementation(files('./wikibroker-openapi-sdk-0.1.0-alpha.jar')) + } + ``` + +**示例** + +`java.net.http` + +```java +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import com.wikiglobal.wikibroker.openapi.WikiBrokerOpenApi.RequestBuilderFactory; +// ... +final String API_KEY = "ef05e5b0-9daf-49e3-a0f4-9a3c13f55c3b"; +final String API_SECRET = "4ae4bf20-0afa-4122-ade8-c0beca7bd5e4"; +final var factory = new RequestBuilderFactory( + API_KEY, + API_SECRET, + RequestBuilderFactory.Type.Native +); + +try (var client = HttpClient.newHttpClient()) { + var builder = factory.create(); + var req = builder.method("POST") + .url("https://api.example.com/test?q1=c&q2=b&q1=a") + .body("{\"key\":\"value\"") + .build(); + client.send(req, HttpResponse.BodyHandlers.ofString()); +} catch (Exception e) { + // Handle Exception +} +``` + +`okhttp` + +```java +import okhttp3.OkHttpClient; +import okhttp3.Request; +import com.wikiglobal.wikibroker.openapi.WikiBrokerOpenApi.RequestBuilderFactory; +// ... +final String API_KEY = "ef05e5b0-9daf-49e3-a0f4-9a3c13f55c3b"; +final String API_SECRET = "4ae4bf20-0afa-4122-ade8-c0beca7bd5e4"; +final var factory = new RequestBuilderFactory( + API_KEY, + API_SECRET, + RequestBuilderFactory.Type.OkHttp +); + +var client = new OkHttpClient(); +try { + var builder = factory.create(); + var req = builder.method("POST") + .url("https://api.example.com/test?q1=c&q2=b&q1=a") + .body("{\"key\":\"value\"") + .build(); + try (var resp = client.newCall(req).execute()) { + // Handle Response + } +} catch (Exception e) { + // Handle Exception +} +``` + +`apache httpclient` + +```java +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.core5.http.ClassicHttpRequest; +import com.wikiglobal.wikibroker.openapi.WikiBrokerOpenApi.RequestBuilderFactory; +// ... +final String API_KEY = "ef05e5b0-9daf-49e3-a0f4-9a3c13f55c3b"; +final String API_SECRET = "4ae4bf20-0afa-4122-ade8-c0beca7bd5e4"; +final var factory = new RequestBuilderFactory( + API_KEY, + API_SECRET, + RequestBuilderFactory.Type.Apache +); + +try (var client = HttpClients.createDefault()) { + var builder = factory.create(); + var req = builder.method("POST") + .url("https://api.example.com/test?q1=c&q2=b&q1=a") + .body("{\"key\":\"value\"") + .build(); + client.execute( + req, resp -> { + // Handle Response + return null; + } + ); +} catch (Exception e) { + // Handle Exception +} +``` + +#### `PHP`接入 + +**安装** + +```bash +mv wikibroker-openapi-php-sdk-0.1.0-alpha.zip ./ +composer config repositories.local artifact ./ +composer require wikiglobal/wikibroker-openapi-sdk:0.1.0-alpha +``` + +**示例** + +`guzzle` + +```php +use GuzzleHttp\Client; +use GuzzleHttp\Handler\CurlHandler; +use GuzzleHttp\HandlerStack; +use WikibrokerOpenapiSdk\Api; + +const API_KEY = "ef05e5b0-9daf-49e3-a0f4-9a3c13f55c3b"; +const API_SECRET = "4ae4bf20-0afa-4122-ade8-c0beca7bd5e4"; +$stack = new HandlerStack(); +$stack->setHandler(new CurlHandler()); +$middleware = Api::createGuzzleSignMiddleware(API_KEY, API_SECRET); +$stack->push($middleware); +$client = new Client(['handler' => $stack]); + +$client->post( + "https://api.example.com/test?q1=c&q2=b&q1=a", + [ + 'query' => [ + "q1" => ["c", "a"], + "q2" => ["b"] + ], + 'json' => [ + "key" => "value" + ] + ] +); +``` + +`symfony/http-client` + +```php +use Symfony\Component\HttpClient\Psr18Client; +use WikibrokerOpenapiSdk\Api; + +const API_KEY = "ef05e5b0-9daf-49e3-a0f4-9a3c13f55c3b"; +const API_SECRET = "4ae4bf20-0afa-4122-ade8-c0beca7bd5e4"; +$rawClient = new Psr18Client(); +$client = Api::createPsrHttpClientWithSign(API_KEY, API_SECRET)->setClient($rawClient); + +$body = $rawClient->createStream(json_encode(["key" => "value"])); +$request = $rawClient->createRequest( + "POST", + "https://api.example.com/test?q1=c&q2=b&q1=a" +)->withBody($body); +$client->sendRequest($request); +``` + +#### `C#` 接入 + +**安装** + +```bash +# 把WikiBroker.OpenApi.Sdk.0.1.0-alpha.nupkg放在项目根目录下并执行以下命令 +dotnet add package WikiBroker.OpenApi.Sdk --source ./ --version 0.1.0-alpha +``` + +**示例** + +`System.Net.Http` + +```cs +using System.Net.Http; +using System.Net.Http.Json; +using WikiBroker.OpenApi.Sdk; + +var ApiKey = Guid.Parse("ef05e5b0-9daf-49e3-a0f4-9a3c13f55c3b"); +var ApiSecret = "4ae4bf20-0afa-4122-ade8-c0beca7bd5e4"; +var withSign = WikiBrokerOpenApi.CreateDelegatingHandlerConstructor(ApiKey, ApiSecret); +var client = new HttpClient(withSign(new HttpClientHandler())); + +client.PostAsync( + "https://api.example.com/test?q1=c&q2=b&q1=a", + JsonContent.Create(new { key = "value" }) +); +``` + +#### `Dart` 接入 + +**安装** + +1. 第一步:解压tgz包 + + ```bash + tar zxf wikibroker-openapi-dart-sdk-0.1.0-alpha.tgz + ``` + +2. 第二步:声明pubspec依赖 + + ```yaml + dependencies: + # ...其它依赖项 + wikibroker_openapi_sdk: + path: ./wikibroker_openapi_sdk + ``` + +**示例** + +`http` + +```dart +import 'package:http/http.dart' as http; +import 'package:wikibroker_openapi_sdk/wikibroker_openapi_sdk.dart'; + +const apiKey = 'ef05e5b0-9daf-49e3-a0f4-9a3c13f55c3b'; +const apiSecret = '4ae4bf20-0afa-4122-ade8-c0beca7bd5e4'; +final client = createHttpClient(http.Client(), apiKey, apiSecret); + +client.post( + Uri.parse("https://api.example.com/test?q1=c&q2=b&q1=a"), + body: {"key": "value"}, +); +``` + +`dio` + +```dart +import 'package:dio/dio.dart'; +import 'package:wikibroker_openapi_sdk/wikibroker_openapi_sdk.dart'; + +const apiKey = 'ef05e5b0-9daf-49e3-a0f4-9a3c13f55c3b'; +const apiSecret = '4ae4bf20-0afa-4122-ade8-c0beca7bd5e4'; +final client = Dio(); +final interceptor = createDioRequestInterceptor( + apiKey, + apiSecret, + jsonEncode, +); +client.interceptors.add(interceptor); + +client.post( + "https://api.example.com/test?q1=c&q2=b&q1=a", + data: {"key": "value"}, +); +``` + +#### `Swift` 接入 + +**安装** + +1. 第一步:解压zip包 + + ```bash + unzip wikibroker-openapi-swift-sdk-0.1.0-alpha.zip + ``` + +2. 第二步:在XCode中将解压后目录作为项目依赖包添加 + +**示例** + +`URLSession` + +```swift +import Foundation +import WikibrokerOpenapiSdk + +let apiKey = "ef05e5b0-9daf-49e3-a0f4-9a3c13f55c3b" +let apiSecret = "4ae4bf20-0afa-4122-ade8-c0beca7bd5e4" +let s = URLSession.shared +s.setAuth(apiKey: apiKey, apiSecret: apiSecret) + +var req = URLRequest(URL("https://api.example.com/test?q1=c&q2=b&q1=a")) +req.httpMethod = "POST" +req.httpBody = try JSONSerialization.data(withJSONObject: [ + "key": "value" +]) +s.dataWithAuth(for: &req) +``` + +`Alamofire` + +```swift +import Alamofire +import Foundation +import WikibrokerOpenapiSdk + +let apiKey = "ef05e5b0-9daf-49e3-a0f4-9a3c13f55c3b" +let apiSecret = "4ae4bf20-0afa-4122-ade8-c0beca7bd5e4" +let interceptor = makeAlamofireAuthInterceptor( + apiKey: apiKey, + apiSecret: apiSecret +) +let s = Session(interceptor: interceptor) + +let resp = s.request( + "https://api.example.com/test?q1=c&q2=b&q1=a", + method: HTTPMethod(rawValue: "POST"), + parameters: ["key": "value"], + encoding: JSONEncoding.default +).response +``` + ### 通过API接入 如果你使用的编程语言没有可用的SDK,可以按照以下方式自行编写接入代码。 @@ -274,3 +635,16 @@ send_request() 1. 将请求查询参数按`key`的字典序升序排列,对于相同`key`则再按`value`的字典序升序排列,然后按`{key}={value}`的格式用`&`拼接,构成规范化查询字符串`canonical_query`。 2. 计算请求体的`sha256`哈希并转换为16进制编码字符串`body_hash`。 3. 用换行符拼接大写请求方法、请求相对路径、`canonical_query`、`X-Api-Key`、`X-Timestamp`、`X-Nonce`、`body_hash`,然后生成`hmac-sha256`哈希并转换为16进制编码字符串,得到请求签名`X-Signature`。 + +## 兼容性说明 + +| SDK包 | 开发语言版本 | +| --- | --- | +| JavaScript SDK | Node 22 | +| Python SDK | Python 3.12 | +| Golang SDK | Go 1.23 | +| Java SDK | Java 21 | +| PHP SDK | PHP 8.3 | +| .NET SDK | C# 12 | +| Dart SDK | Dart 3.11 | +| Swift SDK | Swift 6.3 | diff --git a/dart-sdk/.gitignore b/dart-sdk/.gitignore new file mode 100644 index 0000000..92af3c9 --- /dev/null +++ b/dart-sdk/.gitignore @@ -0,0 +1,6 @@ +# 编辑器配置 +.idea/ +*.iml + +# 构建产物 +.dart_tool/ diff --git a/dart-sdk/CHANGELOG.md b/dart-sdk/CHANGELOG.md new file mode 100644 index 0000000..71993f7 --- /dev/null +++ b/dart-sdk/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.1.0-alpha + +- Internal release version for test. diff --git a/dart-sdk/LICENSE b/dart-sdk/LICENSE new file mode 100644 index 0000000..8cf0b4d --- /dev/null +++ b/dart-sdk/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 WikiGlobal Lab + +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. diff --git a/dart-sdk/README.md b/dart-sdk/README.md new file mode 100644 index 0000000..e09dbba --- /dev/null +++ b/dart-sdk/README.md @@ -0,0 +1,3 @@ +# WikiBroker OpenAPI SDK + +接入说明见[此处]() \ No newline at end of file diff --git a/dart-sdk/lib/src/adapters/dio.dart b/dart-sdk/lib/src/adapters/dio.dart new file mode 100644 index 0000000..6da147e --- /dev/null +++ b/dart-sdk/lib/src/adapters/dio.dart @@ -0,0 +1,55 @@ +import 'package:dio/dio.dart'; +import 'package:uuid/uuid.dart'; +import 'package:wikibroker_openapi_sdk/src/common/types.dart'; + +class DioRequest implements RequestLike { + final RequestOptions _raw; + String Function(dynamic) _serializer; + + DioRequest(this._raw, this._serializer); + + @override + HeadersLike get headers => _raw.headers; + + @override + String get method => _raw.method; + + @override + Uri get url => _raw.uri; + + @override + String get data => _serializer(_raw.data); +} + +class DioRequestInterceptor extends Interceptor { + final String Function(dynamic) _serializer; + final UuidValue _apiKey; + final String _apiSecret; + final LoadHeaders _loadHeaders; + final Sign _sign; + final DateTime Function() _timestampGenerator; + final UuidValue Function() _idGenerator; + + DioRequestInterceptor( + this._serializer, + this._apiKey, + this._apiSecret, + this._loadHeaders, + this._sign, + this._timestampGenerator, + this._idGenerator, + ); + + @override + void onRequest(RequestOptions options, RequestInterceptorHandler handler) { + final proxy = DioRequest(options, _serializer); + _loadHeaders( + proxy.headers, + _apiKey, + _timestampGenerator(), + _idGenerator().uuid, + ); + _sign(proxy, _apiSecret); + super.onRequest(options, handler); + } +} diff --git a/dart-sdk/lib/src/adapters/http.dart b/dart-sdk/lib/src/adapters/http.dart new file mode 100644 index 0000000..b84fd7d --- /dev/null +++ b/dart-sdk/lib/src/adapters/http.dart @@ -0,0 +1,55 @@ +import 'package:http/http.dart' as http; +import 'package:uuid/uuid.dart'; +import 'package:wikibroker_openapi_sdk/src/common/types.dart'; + +class HttpRequest implements RequestLike { + final http.BaseRequest _raw; + + HttpRequest(this._raw); + + @override + HeadersLike get headers => _raw.headers; + + @override + String get method => _raw.method; + + @override + Uri get url => _raw.url; + + @override + String get data => + _raw is http.Request ? _raw.encoding.decode(_raw.bodyBytes) : ''; +} + +class HttpClient extends http.BaseClient { + final http.Client _inner; + final UuidValue _apiKey; + final String _apiSecret; + final LoadHeaders _loadHeaders; + final Sign _sign; + final DateTime Function() _timestampGenerator; + final UuidValue Function() _idGenerator; + + HttpClient( + this._inner, + this._apiKey, + this._apiSecret, + this._loadHeaders, + this._sign, + this._timestampGenerator, + this._idGenerator, + ); + + @override + Future send(http.BaseRequest request) async { + final proxy = HttpRequest(request); + _loadHeaders( + proxy.headers, + _apiKey, + _timestampGenerator(), + _idGenerator().uuid, + ); + _sign(proxy, _apiSecret); + return _inner.send(request); + } +} diff --git a/dart-sdk/lib/src/common/enums.dart b/dart-sdk/lib/src/common/enums.dart new file mode 100644 index 0000000..8e4151c --- /dev/null +++ b/dart-sdk/lib/src/common/enums.dart @@ -0,0 +1,10 @@ +enum CustomHeaders { + apiKey(value: 'X-Api-Key'), + timestamp(value: 'X-Timestamp'), + nonce(value: 'X-Nonce'), + signature(value: 'X-Signature'); + + const CustomHeaders({required this.value}); + + final String value; +} diff --git a/dart-sdk/lib/src/common/hash.dart b/dart-sdk/lib/src/common/hash.dart new file mode 100644 index 0000000..804f100 --- /dev/null +++ b/dart-sdk/lib/src/common/hash.dart @@ -0,0 +1,17 @@ +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:crypto/crypto.dart'; + +Digest sha256Hash(Uint8List message) { + return _calculateHash(sha256, message); +} + +Digest hmacSha256(Uint8List key, Uint8List message) { + final h = Hmac(sha256, key); + return _calculateHash(h, message); +} + +Digest _calculateHash(Converter, Digest> h, Uint8List data) { + return h.convert(data); +} diff --git a/dart-sdk/lib/src/common/types.dart b/dart-sdk/lib/src/common/types.dart new file mode 100644 index 0000000..affb67f --- /dev/null +++ b/dart-sdk/lib/src/common/types.dart @@ -0,0 +1,17 @@ +import 'package:uuid/uuid.dart'; + +typedef HeadersLike = Map; + +abstract interface class RequestLike { + HeadersLike get headers; + + String get method; + + Uri get url; + + String get data; +} + +typedef LoadHeaders = void Function(HeadersLike, UuidValue, DateTime, String); + +typedef Sign = void Function(RequestLike, String); diff --git a/dart-sdk/lib/src/common/utils.dart b/dart-sdk/lib/src/common/utils.dart new file mode 100644 index 0000000..389ae72 --- /dev/null +++ b/dart-sdk/lib/src/common/utils.dart @@ -0,0 +1,11 @@ +import 'package:uuid/uuid.dart'; + +bool isRequestUsePostMethod(String method) { + return method.toUpperCase() == 'POST'; +} + +final _uuid = Uuid(); + +UuidValue newUuid() { + return UuidValue.withValidation(_uuid.v4()); +} diff --git a/dart-sdk/lib/src/core.dart b/dart-sdk/lib/src/core.dart new file mode 100644 index 0000000..ddac3b7 --- /dev/null +++ b/dart-sdk/lib/src/core.dart @@ -0,0 +1,46 @@ +import 'dart:convert'; + +import 'package:wikibroker_openapi_sdk/src/common/enums.dart'; +import 'package:wikibroker_openapi_sdk/src/common/hash.dart'; +import 'package:wikibroker_openapi_sdk/src/common/types.dart'; +import 'package:wikibroker_openapi_sdk/src/common/utils.dart'; + +String generateSignature(String key, String message) { + return hmacSha256(utf8.encode(key), utf8.encode(message)).toString(); +} + +String generateCanonicalString(RequestLike req) { + final method = req.method; + final path = req.url.path; + final canonicalQuery = _buildCanonicalQuery(req); + final apiKey = req.headers[CustomHeaders.apiKey.value] ?? ''; + final timestamp = req.headers[CustomHeaders.timestamp.value] ?? ''; + final nonce = req.headers[CustomHeaders.nonce.value] ?? ''; + final bodyHash = _calculateBodyHash(req); + return [ + method, + path, + canonicalQuery, + apiKey, + timestamp, + nonce, + bodyHash, + ].join('\n'); +} + +String _calculateBodyHash(RequestLike req) { + final body = isRequestUsePostMethod(req.method) ? req.data : ''; + return sha256Hash(utf8.encode(body)).toString(); +} + +String _buildCanonicalQuery(RequestLike req) { + final query = req.url.queryParametersAll; + var pairs = >{}; + query.entries.forEach( + (pair) => pairs[pair.key] = List.from(pair.value)..sort(), + ); + var parts = pairs.entries.toList()..sort((a, b) => a.key.compareTo(b.key)); + return parts + .map((pair) => pair.value.map((v) => '${pair.key}=$v').join('&')) + .join('&'); +} diff --git a/dart-sdk/lib/src/wikibroker_openapi_sdk_base.dart b/dart-sdk/lib/src/wikibroker_openapi_sdk_base.dart new file mode 100644 index 0000000..84e29b4 --- /dev/null +++ b/dart-sdk/lib/src/wikibroker_openapi_sdk_base.dart @@ -0,0 +1,54 @@ +import 'package:http/http.dart' as http; +import 'package:uuid/uuid.dart'; +import 'package:wikibroker_openapi_sdk/src/adapters/dio.dart'; +import 'package:wikibroker_openapi_sdk/src/adapters/http.dart'; +import 'package:wikibroker_openapi_sdk/src/common/enums.dart'; +import 'package:wikibroker_openapi_sdk/src/common/types.dart'; +import 'package:wikibroker_openapi_sdk/src/common/utils.dart'; +import 'package:wikibroker_openapi_sdk/src/core.dart'; + +void addXHeaders( + HeadersLike headers, + UuidValue apiKey, + DateTime timestamp, + String nonce, +) { + headers[CustomHeaders.apiKey.value] = apiKey.uuid; + headers[CustomHeaders.timestamp.value] = timestamp.millisecondsSinceEpoch + .toString(); + headers[CustomHeaders.nonce.value] = nonce; +} + +void sign(RequestLike req, String key) { + final canonicalString = generateCanonicalString(req); + final signature = generateSignature(key, canonicalString); + req.headers[CustomHeaders.signature.value] = signature; +} + +HttpClient createHttpClient(http.Client raw, String apiKey, String apiSecret) { + return HttpClient( + raw, + UuidValue.withValidation(apiKey), + apiSecret, + addXHeaders, + sign, + DateTime.now, + newUuid, + ); +} + +DioRequestInterceptor createDioRequestInterceptor( + String apiKey, + String apiSecret, + String Function(dynamic)? serializer, +) { + return DioRequestInterceptor( + serializer ?? (x) => x as String, + UuidValue.withValidation(apiKey), + apiSecret, + addXHeaders, + sign, + DateTime.now, + newUuid, + ); +} diff --git a/dart-sdk/lib/wikibroker_openapi_sdk.dart b/dart-sdk/lib/wikibroker_openapi_sdk.dart new file mode 100644 index 0000000..c0032e4 --- /dev/null +++ b/dart-sdk/lib/wikibroker_openapi_sdk.dart @@ -0,0 +1,9 @@ +/// Support for doing something awesome. +/// +/// More dartdocs go here. +library; + +export 'src/wikibroker_openapi_sdk_base.dart'; +export 'src/common/enums.dart'; + +// TODO: Export any libraries intended for clients of this package. diff --git a/dart-sdk/pubspec.lock b/dart-sdk/pubspec.lock new file mode 100644 index 0000000..821d533 --- /dev/null +++ b/dart-sdk/pubspec.lock @@ -0,0 +1,429 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "8d718c5c58904f9937290fd5dbf2d6a0e02456867706bfb6cd7b81d394e738d5" + url: "https://pub.dev" + source: hosted + version: "98.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "6141ad5d092d1e1d13929c0504658bbeccc1703505830d7c26e859908f5efc88" + url: "https://pub.dev" + source: hosted + version: "12.0.0" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + cli_config: + dependency: transitive + description: + name: cli_config + sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec + url: "https://pub.dev" + source: hosted + version: "0.2.0" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + coverage: + dependency: transitive + description: + name: coverage + sha256: "5da775aa218eaf2151c721b16c01c7676fbfdd99cebba2bf64e8b807a28ff94d" + url: "https://pub.dev" + source: hosted + version: "1.15.0" + crypto: + dependency: "direct main" + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + dio: + dependency: "direct main" + description: + name: dio + sha256: aff32c08f92787a557dd5c0145ac91536481831a01b4648136373cddb0e64f8c + url: "https://pub.dev" + source: hosted + version: "5.9.2" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "2f9e64323a7c3c7ef69567d5c800424a11f8337b8b228bad02524c9fb3c1f340" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de + url: "https://pub.dev" + source: hosted + version: "2.1.3" + http: + dependency: "direct main" + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + io: + dependency: transitive + description: + name: io + sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b + url: "https://pub.dev" + source: hosted + version: "1.0.5" + lints: + dependency: "direct dev" + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 + url: "https://pub.dev" + source: hosted + version: "0.12.19" + meta: + dependency: transitive + description: + name: meta + sha256: df0c643f44ad098eb37988027a8e2b2b5a031fd3977f06bbfd3a76637e8df739 + url: "https://pub.dev" + source: hosted + version: "1.18.2" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + pool: + dependency: transitive + description: + name: pool + sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d" + url: "https://pub.dev" + source: hosted + version: "1.5.2" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + shelf: + dependency: transitive + description: + name: shelf + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 + url: "https://pub.dev" + source: hosted + version: "1.4.2" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 + url: "https://pub.dev" + source: hosted + version: "1.1.3" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812" + url: "https://pub.dev" + source: hosted + version: "0.10.13" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test: + dependency: "direct dev" + description: + name: test + sha256: "8d9ceddbab833f180fbefed08afa76d7c03513dfdba87ffcec2718b02bbcbf20" + url: "https://pub.dev" + source: hosted + version: "1.31.0" + test_api: + dependency: transitive + description: + name: test_api + sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e" + url: "https://pub.dev" + source: hosted + version: "0.7.11" + test_core: + dependency: transitive + description: + name: test_core + sha256: "1991d4cfe85d5043241acac92962c3977c8d2f2add1ee73130c7b286417d1d34" + url: "https://pub.dev" + source: hosted + version: "0.6.17" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + uuid: + dependency: "direct main" + description: + name: uuid + sha256: "1fef9e8e11e2991bb773070d4656b7bd5d850967a2456cfc83cf47925ba79489" + url: "https://pub.dev" + source: hosted + version: "4.5.3" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" + url: "https://pub.dev" + source: hosted + version: "15.0.2" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" +sdks: + dart: ">=3.11.4 <4.0.0" diff --git a/dart-sdk/pubspec.yaml b/dart-sdk/pubspec.yaml new file mode 100644 index 0000000..d709fb6 --- /dev/null +++ b/dart-sdk/pubspec.yaml @@ -0,0 +1,17 @@ +name: wikibroker_openapi_sdk +description: A starting point for Dart libraries or applications. +version: 0.1.0-alpha +repository: https://github.com/WikiGlobal-Lab/wikibroker-openapi/tree/dev/dart-sdk + +environment: + sdk: ^3.11.4 + +dependencies: + uuid: ^4.5.3 + crypto: ^3.0.7 + http: ^1.6.0 + dio: ^5.9.2 + +dev_dependencies: + lints: ^6.0.0 + test: ^1.25.6 diff --git a/dart-sdk/test/wikibroker_openapi_sdk_test.dart b/dart-sdk/test/wikibroker_openapi_sdk_test.dart new file mode 100644 index 0000000..f1304dc --- /dev/null +++ b/dart-sdk/test/wikibroker_openapi_sdk_test.dart @@ -0,0 +1,76 @@ +import 'dart:convert'; +import 'package:http/http.dart' as http; +import 'package:dio/dio.dart'; + +import 'package:test/test.dart'; +import 'package:uuid/uuid.dart'; +import 'package:wikibroker_openapi_sdk/src/adapters/dio.dart'; +import 'package:wikibroker_openapi_sdk/src/adapters/http.dart'; +import 'package:wikibroker_openapi_sdk/wikibroker_openapi_sdk.dart'; + +void main() { + group('Test sign', () { + final baseURL = 'https://api.example.com'; + final path = 'test?q1=c&q2=b&q1=a'; + final url = '$baseURL/$path'; + final body = {'key': 'value'}; + final method = 'POST'; + final apiKey = UuidValue.withValidation( + "ef05e5b0-9daf-49e3-a0f4-9a3c13f55c3b", + ); + final apiSecret = "4ae4bf20-0afa-4122-ade8-c0beca7bd5e4"; + final nonce = UuidValue.withValidation( + "4428a206-1afd-4b15-a98d-43e91f49a08d", + ); + final timestamp = DateTime.fromMillisecondsSinceEpoch(1798115622000); + final expectedSignature = + "1b0c80dbbc30905719559ab5526dfd59bae04d7337c8843efd9e51ff0af6dfb4"; + + setUp(() { + // Additional setup goes here. + }); + + test('http test', () async { + final client = HttpClient( + http.Client(), + apiKey, + apiSecret, + addXHeaders, + sign, + () => timestamp, + () => nonce, + ); + final req = http.Request(method, Uri.parse(url))..body = jsonEncode(body); + try { + await client.send(req).timeout(Duration(milliseconds: 1)); + } catch (_) {} + final signature = req.headers[CustomHeaders.signature.value]; + expect(signature, expectedSignature); + }); + + test('dio test', () async { + final dio = Dio(BaseOptions(connectTimeout: Duration(milliseconds: 1))); + final interceptor = DioRequestInterceptor( + jsonEncode, + apiKey, + apiSecret, + addXHeaders, + sign, + () => timestamp, + () => nonce, + ); + dio.interceptors.add(interceptor); + try { + await dio.request( + url, + options: Options(method: method), + data: body, + ); + } on DioException catch (e) { + final signature = + e.requestOptions.headers[CustomHeaders.signature.value]; + expect(signature, expectedSignature); + } + }); + }); +} diff --git a/docs/index.html b/docs/index.html index 2138d53..837b6f4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,7 +3,7 @@ - wlink + WikiBroker - + -

wlink (v1)

Download OpenAPI specification:

crm saas

-

公共接口(28)

修改密码-认证接口

修改密码

-
Request Body schema: application/json
email_code
string

邮箱验证码

-
new_password
required
string

新密码

-
old_password
required
string

原密码

-

Responses

Request samples

Content type
application/json
{
  • "email_code": "string",
  • "new_password": "string",
  • "old_password": "string"
}

Response samples

Content type
application/json
{ }

登录-认证接口

登录

-
header Parameters
Captcha-Token
string
Captcha-Action
string
Captcha-Randstr
string
Request Body schema: application/json
email
required
string
password
required
string

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "token": "string",
  • "user_info": {
    }
}

登出-认证接口

登出

-

Responses

Response samples

Content type
application/json
{ }

重置密码-认证接口

重置密码

-
Request Body schema: application/json
password
required
string
token
required
string

Responses

Request samples

Content type
application/json
{
  • "password": "string",
  • "token": "string"
}

Response samples

Content type
application/json
{ }

重置密码发送邮件-认证接口

重置密码发送邮件

-
Request Body schema: application/json
email
required
string

Responses

Request samples

Content type
application/json
{
  • "email": "string"
}

Response samples

Content type
application/json
{ }

重置密码Token是否过期-认证接口

重置密码Token是否过期

-
query Parameters
token
required
string

Responses

Response samples

Content type
application/json
{
  • "expired": true
}

获取用户安全设置-认证接口

获取用户安全设置

-

Responses

Response samples

Content type
application/json
{
  • "email": "string",
  • "password": "string",
  • "required_password": "string"
}

获取登陆用户的按钮权限-权限管理模块

获取登陆用户的按钮权限

-

Responses

Response samples

Content type
application/json
{
  • "actions": {
    },
  • "menus": [
    ]
}

获取所有的菜单以及button列表用户的菜单列表-权限管理模块

获取所有的菜单以及button列表用户的菜单列表

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ]
}

获取投放列表-投放管理

获取投放列表(Client/IB端)

-
header Parameters
X-Language
string
Default: zh-CN

国际化语言,默认为zh-CN

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ]
}

屏蔽弹窗(不再展示)-弹窗管理

屏蔽弹窗(不再展示)

-
Request Body schema: application/json
ids
required
Array of integers

Responses

Request samples

Content type
application/json
{
  • "ids": [
    ]
}

Response samples

Content type
application/json
{ }

获取弹窗列表-弹窗管理

获取弹窗列表(Client/IB端)

-
header Parameters
X-Language
string
Default: zh-CN

国际化语言,默认为zh-CN

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ]
}

腾讯验证码验证-公共服务

腾讯验证码验证

-
Request Body schema: application/json
app_id
required
integer
rand_str
required
string
ticket
required
string
user_ip
required
string

Responses

Request samples

Content type
application/json
{
  • "app_id": 0,
  • "rand_str": "string",
  • "ticket": "string",
  • "user_ip": "string"
}

Response samples

Content type
application/json
{
  • "is_valid": true
}

发送邮箱验证码-验证码接口

发送邮箱验证码

-
Request Body schema: application/json
email
string

邮箱地址

-
received_at
required
integer

接收时间戳(Unix时间戳,单位:秒)

-
scene
required
string
Enum: "register" "withdrawal" "transfer" "password_change"

使用场景

-

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "received_at": 0,
  • "scene": "register"
}

Response samples

Content type
application/json
{
  • "can_resend_at": 0,
  • "expired_at": 0
}

校验邮箱是否已注册-验证码接口

校验邮箱是否已注册

-
Request Body schema: application/json
email
required
string

邮箱地址

-

Responses

Request samples

Content type
application/json
{
  • "email": "string"
}

Response samples

Content type
application/json
{
  • "is_registered": true
}

获取AliyunOss临时访问凭证-公共服务

获取AliyunOss临时访问凭证

-

Responses

Response samples

Content type
application/json
{
  • "access_key_id": "string",
  • "access_key_secret": "string",
  • "bucket_dir": "string",
  • "bucket_name": "string",
  • "bucket_region": "string",
  • "expiration": "string",
  • "security_token": "string"
}

查询APP key配置-公开设置接口

查询APP key配置

-

Responses

Response samples

Content type
application/json
{
  • "recaptcha_android_key": "string",
  • "recaptcha_web_key": "string",
  • "tencent_android_app_id": 0,
  • "tencent_ios_app_id": 0,
  • "tencent_web_app_id": 0
}

获取外观设置-公开设置接口

获取外观设置

-

Responses

Response samples

Content type
application/json
{
  • "admin_login_bg_image_url": "string",
  • "admin_login_copy_i18n": {
    },
  • "admin_login_layout": "string",
  • "client_login_bg_image_url": "string",
  • "client_login_copy_i18n": {
    },
  • "client_login_layout": "string",
  • "ib_login_bg_image_url": "string",
  • "ib_login_copy_i18n": {
    },
  • "ib_login_layout": "string"
}

获取公司设置-公开设置接口

获取公司设置

-

Responses

Response samples

Content type
application/json
{
  • "broker_name_i18n": {
    },
  • "company_logo_url": "string",
  • "email": "string",
  • "login_page_logo_url": "string",
  • "support_phone": "string",
  • "timezone": "string",
  • "watermark_logo_url": "string"
}

获取国家-公开设置接口

获取国家

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ]
}

获取所有可用的货币-公开设置接口

获取所有可用的货币

-
query Parameters
method
string
Enum: "all" "bank_transfer" "international_wire_transfer" "cryptocurrency"

出入金方式: normal为全部,bank_transfer为银行转账,international_wire_transfer为国际电汇,cryptocurrency为加密货币

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

查询全局杠杆列表-公开设置接口

查询全局杠杆列表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取语言设置-公开设置接口

获取语言设置

-

Responses

Response samples

Content type
application/json
{
  • "language": [
    ]
}

获取安全设置-公开设置接口

获取安全设置

-

Responses

Response samples

Content type
application/json
{
  • "email_verification_scenarios": [
    ],
  • "google_two_factor_enabled": true,
  • "re_captcha_enabled": true,
  • "required_password_strength": "string",
  • "tencent_two_factor_enabled": true
}

获取当前租户版本号-公开设置接口

获取当前租户版本号

-

Responses

Response samples

Content type
application/json
{
  • "version": "string"
}

出金报表导出-报表接口

出金报表导出

-
Request Body schema: application/json
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-
method
required
string
Enum: "all" "bank_transfer" "international_wire_transfer" "cryptocurrency"

出金方式: all为全部,bank_transfer为银行转账,international_wire_transfer为国际电汇,cryptocurrency为加密货币

-
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
status
required
string
Enum: "all" "auditing" "approved" "disapproved"

状态:all为全部(包含审核中和批准,不批准),auditing为审核中,approved为同意,disapproved为拒绝

-

Responses

Request samples

Content type
application/json
{
  • "end_time": "string",
  • "method": "all",
  • "start_time": "string",
  • "status": "all"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

出金报表-报表接口

出金报表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-
status
required
string
Enum: "all" "auditing" "approved" "disapproved"

状态:all为全部(包含审核中和批准,不批准),auditing为审核中,approved为批准,disapproved为拒绝

-
method
required
string
Enum: "all" "bank_transfer" "international_wire_transfer" "cryptocurrency"

出金方式: all为全部,bank_transfer为银行转账,international_wire_transfer为国际电汇,cryptocurrency为加密货币

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取当前登录用户的菜单权限(自动区分IB)-权限验证

获取当前登录用户的菜单权限(自动区分IB/Client)

-

Responses

Response samples

Content type
application/json
{
  • "actions": {
    },
  • "menus": [
    ]
}

Client接口(65)

查询所持账户的余额-申请接口

查询所持账户的余额

-
query Parameters
type
required
Array of strings

记录类型:只能入金(deposit_only)、只能出金(withdrawal_only),入金出金都可以(normal),入金传入deposit_only和normal,出金传入withdrawal_only和normal

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

创建开户申请-申请接口

创建开户申请-Client端接口

-
Request Body schema: application/json
currency
required
string
Value: "USD"

账户货币,目前只支持USD

-
leverage
required
integer

账户杠杆

-
observe_password
string

观摩密码

-
password
required
string

交易密码

-
trading_account_type_id
required
integer

交易账号类型ID

-
trading_platform
required
string
Enum: "MT4" "MT5"

交易平台,目前仅支持MT4

-

Responses

Request samples

Content type
application/json
{
  • "currency": "USD",
  • "leverage": 0,
  • "observe_password": "string",
  • "password": "string",
  • "trading_account_type_id": 0,
  • "trading_platform": "MT4"
}

Response samples

Content type
application/json
{
  • "application_account_id": 0
}

创建转账申请-申请接口

创建转账申请

-
Request Body schema: application/json
amount
required
string

转账金额

-
email_code
string

邮箱验证码

-
remark
required
string

注释

-
source_trading_account_id
required
integer

转出交易账户ID

-
target_trading_account_id
required
integer

转入交易账户ID

-

Responses

Request samples

Content type
application/json
{
  • "amount": "string",
  • "email_code": "string",
  • "remark": "string",
  • "source_trading_account_id": 0,
  • "target_trading_account_id": 0
}

Response samples

Content type
application/json
{
  • "audit_id": 0,
  • "audit_status": "string"
}

查询转账历史列表-申请接口

查询转账历史列表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

创建电子认证会话-电子认证

创建电子认证会话

-
Request Body schema: application/json
failed_url
required
string

认证失败跳转URL

-
success_url
required
string

认证成功跳转URL

-

Responses

Request samples

Content type
application/json
{
  • "failed_url": "string",
  • "success_url": "string"
}

Response samples

Content type
application/json
{
  • "expire_at": "string",
  • "redirect_url": "string",
  • "session_id": "string"
}

查询电子认证结果-电子认证

查询电子认证结果

-
query Parameters
session_id
required
string

会话ID

-

Responses

Response samples

Content type
application/json
{
  • "attempt_times": 0,
  • "reason_code": "string",
  • "reason_msg": "string",
  • "retry_times": 0,
  • "status": "string"
}

消息详情-消息中心

消息详情

-
query Parameters
id
required
integer

消息ID

-

Responses

Response samples

Content type
application/json
{
  • "content": "string",
  • "created_at": "string",
  • "id": 0,
  • "sender": "string",
  • "title": "string"
}

隐藏消息-消息中心

隐藏消息

-
Request Body schema: application/json
id
required
integer

消息ID

-

Responses

Request samples

Content type
application/json
{
  • "id": 0
}

Response samples

Content type
application/json
{ }

消息列表-消息中心

消息列表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

标记消息已读-消息中心

标记消息已读

-
Request Body schema: application/json
id
required
integer

消息ID

-

Responses

Request samples

Content type
application/json
{
  • "id": 0
}

Response samples

Content type
application/json
{ }

获取未读消息数量-消息中心

获取未读消息数量

-

Responses

Response samples

Content type
application/json
{
  • "count": 0
}

查询Client用户问卷答案-客户接口

查询Client用户问卷答案

-
query Parameters
id
required
integer

答卷记录ID

-

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "items": [
    ],
  • "name": "string"
}

保存Client用户问卷答案-客户接口

保存Client用户问卷答案

-
Request Body schema: application/json
required
Array of objects

答案列表

-
questionnaire_id
required
integer

问卷ID

-

Responses

Request samples

Content type
application/json
{
  • "answers": [
    ],
  • "questionnaire_id": 0
}

Response samples

Content type
application/json
{ }

获取软件下载工具列表-客户接口

获取软件下载工具列表

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取交易工具栏目多语言详情-交易工具

获取交易工具栏目多语言详情

-
query Parameters
column_id
required
integer

主表column_id

-

Responses

Response samples

Content type
application/json
{
  • "column_id": 0,
  • "id": 0,
  • "iframe_link": "string",
  • "is_read": true,
  • "language": "string",
  • "popup_content": "string",
  • "popup_title": "string",
  • "title": "string"
}

检查弹框是否已读-交易工具

检查弹框是否已读

-
query Parameters
column_id
required
integer

栏目ID

-

Responses

Response samples

Content type
application/json
{
  • "is_read": true
}

标记弹框已读-交易工具

标记弹框已读

-
Request Body schema: application/json
column_id
required
integer

栏目ID

-

Responses

Request samples

Content type
application/json
{
  • "column_id": 0
}

Response samples

Content type
application/json
{ }

获取加密货币USDT可用网络-申请接口

获取加密货币USDT可用网络

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

基于货币对返回汇率-申请接口

基于货币对返回汇率

-
query Parameters
from_currency
required
string

源货币

-
to_currency
required
string

目标货币

-

Responses

Response samples

Content type
application/json
{
  • "exchange_rate": "string"
}

获取可用货币列表-申请接口

获取可用货币列表

-
query Parameters
remittance_id
required
integer

汇款方式ID

-
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

虚拟账户入金-申请接口

虚拟账户入金

-
Request Body schema: application/json
amount
required
string

金额

-
trading_account_id
required
integer

交易账号ID

-

Responses

Request samples

Content type
application/json
{
  • "amount": "string",
  • "trading_account_id": 0
}

Response samples

Content type
application/json
{ }

取消入金申请-申请接口

取消入金申请

-
Request Body schema: application/json
order_number
required
string

入金订单号

-

Responses

Request samples

Content type
application/json
{
  • "order_number": "string"
}

Response samples

Content type
application/json
{
  • "order_number": "string",
  • "status": "string"
}

获取可用的入金渠道-申请接口

获取可用的入金渠道

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

创建入金申请草稿-申请接口

创建入金申请草稿

-
Request Body schema: application/json
deposit_amount
required
string

入金金额

-
remark
string

备注,可选

-
remittance_id
required
integer

汇款方式id

-
trading_account_id
required
integer

入金交易账号id(用户关联的交易账号ID(多选一))

-

Responses

Request samples

Content type
application/json
{
  • "deposit_amount": "string",
  • "remark": "string",
  • "remittance_id": 0,
  • "trading_account_id": 0
}

Response samples

Content type
application/json
{
  • "order_number": "string",
  • "pay_data": "string",
  • "pay_type": "string",
  • "pay_url": "string",
  • "status": "string"
}

获取未提交入金申请草稿-申请接口

获取未提交入金申请草稿

-
query Parameters
order_number
required
string

入金订单号

-

Responses

Response samples

Content type
application/json
{
  • "account_info": "string",
  • "deposit_amount": "string",
  • "order_number": "string",
  • "receipt_url": "string"
}

获取未处理入金申请订单的数量-申请接口

获取未处理入金申请订单的数量

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-

Responses

Response samples

Content type
application/json
{
  • "count": 0
}

提交入金申请(支付确认)-申请接口

提交入金申请(支付确认)

-
Request Body schema: application/json
order_number
required
string

入金订单号

-
receipt_url
required
string

收据图片地址

-

Responses

Request samples

Content type
application/json
{
  • "order_number": "string",
  • "receipt_url": "string"
}

Response samples

Content type
application/json
{
  • "order_number": "string",
  • "status": "string"
}

查询入金历史记录-申请接口

查询入金历史记录

-
query Parameters
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

查询出金历史记录-申请接口

查询出金历史记录

-
query Parameters
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取可用的汇率列表-申请接口

获取可用的汇率列表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取可用的出金渠道-申请接口

获取可用的出金渠道

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

创建出金申请-申请接口

创建出金申请

-
Request Body schema: application/json
object

银行转账信息

-
object

加密货币信息

-
currency
required
string

交易货币类型

-
email_code
string

邮箱验证码

-
exchange_rate
required
string

汇率

-
fee
required
string

手续费

-
object

国际电汇信息

-
method
required
string

汇款方式

-
remark
string

备注

-
remittance_amount
required
string

汇款金额

-
remittance_id
required
integer

汇款id 获取支付方式、最高最低出金,手续费等信息

-
trading_account_id
required
integer

出金交易账号id

-
withdrawal_amount
required
string

出金金额

-

Responses

Request samples

Content type
application/json
{
  • "bank_transfer_info": {
    },
  • "cryptocurrency_info": {
    },
  • "currency": "string",
  • "email_code": "string",
  • "exchange_rate": "string",
  • "fee": "string",
  • "international_wire_info": {
    },
  • "method": "string",
  • "remark": "string",
  • "remittance_amount": "string",
  • "remittance_id": 0,
  • "trading_account_id": 0,
  • "withdrawal_amount": "string"
}

Response samples

Content type
application/json
{
  • "order_number": "string"
}

Client用户信息-客户接口

Client用户信息

-

Responses

Response samples

Content type
application/json
{
  • "agreement_status": "filling",
  • "apply_status": "filling",
  • "completed_module": [
    ],
  • "identity_status": "filling",
  • "kyc_approved_at": "string",
  • "kyc_data": {
    },
  • "kyc_status": "filling",
  • "kyc_way": "string",
  • "register_datetime": "string"
}

获取Client用户注册模板-客户接口

获取Client用户注册模板

-

Responses

Response samples

Content type
application/json
{
  • "agreement": {
    },
  • "apply_status": "pending",
  • "e_verify": {
    },
  • "identity": {
    },
  • "kyc": {
    },
  • "remark": "string"
}

注册Client用户-客户接口

注册Client用户(Client端接口)

-
Request Body schema: application/json
email
required
string
email_code
string

邮箱验证码

-
invite_code
string
password
required
string

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "email_code": "string",
  • "invite_code": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "token": "string",
  • "user_info": {
    }
}

保存Client用户身份信息-客户接口

保存Client用户身份信息

-
Request Body schema: application/json
current_module
required
string
Enum: "identity" "questionnaire" "family" "contact" "job" "authentication_accessory" "authentication" "agreement" "e_verify" "all"

当前模块: identity: 身份信息, questionnaire: 问卷调查, family: 家庭信息, contact: 联络信息, job: 工作信息, authentication_accessory: 证明文件, authentication: 认证信息, e_verify: 电子验证, all: 全部

-
required
object

当前需要提交保存的KYC数据, key1: {module_key}, key2: {field_key}

-

Responses

Request samples

Content type
application/json
{
  • "current_module": "identity",
  • "kyc_data": {
    }
}

Response samples

Content type
application/json
{ }

创建收款账户-申请接口

创建收款账户

-
Request Body schema: application/json
object

银行转账信息

-
object

加密货币信息

-
object

国际电汇信息

-
payment_method
required
string

必填:支付方式 international_wire_transfer|bank_transfer|cryptocurrency

-
remark
string

选填:备注

-

Responses

Request samples

Content type
application/json
{
  • "bank_transfer_info": {
    },
  • "cryptocurrency_info": {
    },
  • "international_wire_info": {
    },
  • "payment_method": "string",
  • "remark": "string"
}

Response samples

Content type
application/json
{
  • "id": 0
}

删除收款账户-申请接口

删除收款账户

-
Request Body schema: application/json
id
required
integer

账户ID

-

Responses

Request samples

Content type
application/json
{
  • "id": 0
}

Response samples

Content type
application/json
{ }

获取收款账户详情-申请接口

获取收款账户详情

-
query Parameters
id
required
integer

账户ID

-

Responses

Response samples

Content type
application/json
{
  • "account_holder_name": "string",
  • "bank_transfer_info": {
    },
  • "created_at": "string",
  • "cryptocurrency_info": {
    },
  • "id": 0,
  • "international_wire_info": {
    },
  • "payment_method": "string",
  • "remark": "string",
  • "updated_at": "string"
}

获取收款账户列表-申请接口

获取收款账户列表

-
query Parameters
payment_method
string

选填:筛选支付方式(international_wire_transfer|bank_transfer|cryptocurrency)

-
start_time
string

选填:创建开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
end_time
string

选填:创建结束时间(格式:YYYY-MM-DD HH:MM:SS)

-

Responses

Response samples

Content type
application/json
{
  • "bank_transfer": [
    ],
  • "cryptocurrency": [
    ],
  • "international_wire_transfer": [
    ],
  • "total": 0
}

更新收款账户-申请接口

更新收款账户

-
Request Body schema: application/json
object

银行转账信息(更新时提供)

-
object

加密货币信息(更新时提供)

-
id
required
integer

账户ID

-
object

国际电汇信息(更新时提供)

-
is_default
boolean

是否设置为默认账户(true-设为默认,false-取消默认,不传-不修改)

-
remark
string

备注

-

Responses

Request samples

Content type
application/json
{
  • "bank_transfer_info": {
    },
  • "cryptocurrency_info": {
    },
  • "id": 0,
  • "international_wire_info": {
    },
  • "is_default": true,
  • "remark": "string"
}

Response samples

Content type
application/json
{ }

入金报表导出-报表接口

入金报表导出

-
Request Body schema: application/json
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
status
required
string
Enum: "all" "auditing" "approved" "disapproved"

状态:all为全部(包含审核中和批准,不批准),auditing为审核中,approved为同意,disapproved为拒绝

-

Responses

Request samples

Content type
application/json
{
  • "end_time": "string",
  • "start_time": "string",
  • "status": "all"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

入金报表-报表接口

入金报表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-
status
required
string
Enum: "all" "auditing" "approved" "disapproved"

状态:all为全部(包含审核中和批准,不批准),auditing为审核中,approved为批准,disapproved为拒绝

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

导出历史订单报表-报表接口

导出历史订单报表

-
Request Body schema: application/json
account
string

交易账号

-
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-
order_number
string

订单号

-
page
required
integer
Default: 1

页码

-
server_id
integer

交易服务器ID

-
size
required
integer
Default: 20

每页数量

-
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
symbol
string

交易品种

-
time_type
string
Default: "open"
Enum: "open" "close"

时间类型,open为开仓时间,close为闭仓时间

-
trading_account_id
integer

交易账号的业务ID

-
trading_type
required
string
Enum: "all" "BUY" "SELL"

交易类型

-

Responses

Request samples

Content type
application/json
{
  • "account": "string",
  • "end_time": "string",
  • "order_number": "string",
  • "page": 1,
  • "server_id": 0,
  • "size": 20,
  • "start_time": "string",
  • "symbol": "string",
  • "time_type": "open",
  • "trading_account_id": 0,
  • "trading_type": "all"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

查询历史订单报表-报表接口

查询历史订单报表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-
time_type
string
Default: "open"
Enum: "open" "close"

时间类型,open为开仓时间,close为闭仓时间

-
order_number
string

订单号

-
account
string

交易账号

-
trading_type
required
string
Enum: "all" "BUY" "SELL"

交易类型

-
symbol
string

交易品种

-
server_id
integer

交易服务器ID

-
trading_account_id
integer

交易账号的业务ID

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

导出持仓报表-报表接口

导出持仓报表

-
Request Body schema: application/json
account
string

交易账号

-
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-
order_number
string

订单号

-
page
required
integer
Default: 1

页码

-
server_id
integer

交易服务器ID

-
size
required
integer
Default: 20

每页数量

-
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
symbol
string

交易品种

-
trading_account_id
integer

交易账号的业务ID

-
trading_type
required
string
Enum: "all" "BUY" "SELL"

交易类型

-

Responses

Request samples

Content type
application/json
{
  • "account": "string",
  • "end_time": "string",
  • "order_number": "string",
  • "page": 1,
  • "server_id": 0,
  • "size": 20,
  • "start_time": "string",
  • "symbol": "string",
  • "trading_account_id": 0,
  • "trading_type": "all"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

查询持仓报表-报表接口

查询持仓报表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-
order_number
string

订单号

-
account
string

交易账号

-
trading_type
required
string
Enum: "all" "BUY" "SELL"

交易类型

-
symbol
string

交易品种

-
server_id
integer

交易服务器ID

-
trading_account_id
integer

交易账号的业务ID

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

导出挂单报表-报表接口

导出挂单报表

-
Request Body schema: application/json
account
string

交易账号

-
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-
order_number
string

订单号

-
page
required
integer
Default: 1

页码

-
server_id
integer

交易服务器ID

-
size
required
integer
Default: 20

每页数量

-
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
symbol
string

交易品种

-
trading_account_id
integer

交易账号的业务ID

-
trading_type
required
string
Enum: "all" "BUY_LIMIT" "SELL_LIMIT" "BUY_STOP" "SELL_STOP" "BUY_STOP_LIMIT" "SELL_STOP_LIMIT"

交易类型

-

Responses

Request samples

Content type
application/json
{
  • "account": "string",
  • "end_time": "string",
  • "order_number": "string",
  • "page": 1,
  • "server_id": 0,
  • "size": 20,
  • "start_time": "string",
  • "symbol": "string",
  • "trading_account_id": 0,
  • "trading_type": "all"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

查询挂单报表-报表接口

查询挂单报表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-
order_number
string

订单号

-
account
string

交易账号

-
trading_type
required
string
Enum: "all" "BUY_LIMIT" "SELL_LIMIT" "BUY_STOP" "SELL_STOP" "BUY_STOP_LIMIT" "SELL_STOP_LIMIT"

交易类型

-
symbol
string

交易品种

-
server_id
integer

交易服务器ID

-
trading_account_id
integer

交易账号的业务ID

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取交易服务器选项列表-报表接口

获取交易服务器选项列表

-
query Parameters
order_type
required
string
Enum: "holding" "history" "pending"

订单类型

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

查询用户交易过的品种列表-报表接口

查询用户交易过的品种列表

-
query Parameters
order_type
required
string
Enum: "holding" "history" "pending"

订单类型

-
server_id
integer

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

导出转账报表-报表接口

导出转账报表

-
Request Body schema: application/json
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-
order_number
string

订单号

-
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
status
required
string
Enum: "all" "pending" "auditing" "approved" "disapproved"

审核状态:all为全部,pending为待审核,auditing为审核中,approved为批准,disapproved为拒绝

-

Responses

Request samples

Content type
application/json
{
  • "end_time": "string",
  • "order_number": "string",
  • "page": 1,
  • "size": 20,
  • "start_time": "string",
  • "status": "all"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

查询转账报表-报表接口

查询转账报表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

-
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

-
order_number
string

订单号

-
status
required
string
Enum: "all" "pending" "auditing" "approved" "disapproved"

审核状态:all为全部,pending为待审核,auditing为审核中,approved为批准,disapproved为拒绝

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

申请交易账号-用户ID从token获取-交易接口

申请交易账号-用户ID从token获取

-
Request Body schema: application/json
currency
required
string
Value: "USD"

账户货币,目前只支持USD

-
is_demo
required
boolean

是否为模拟账户

-
leverage
required
integer

账户杠杆

-
observe_password
string

观摩密码

-
password
required
string

交易密码

-
trading_account_type_id
required
integer

交易账号类型ID

-
trading_platform
required
string
Enum: "MT4" "MT5"

交易平台,目前仅支持MT4

-

Responses

Request samples

Content type
application/json
{
  • "currency": "USD",
  • "is_demo": true,
  • "leverage": 0,
  • "observe_password": "string",
  • "password": "string",
  • "trading_account_type_id": 0,
  • "trading_platform": "MT4"
}

Response samples

Content type
application/json
{
  • "id": 0
}

查询交易账号-交易接口

查询交易账号

-
query Parameters
id
required
integer

交易账户的业务ID

-

Responses

Response samples

Content type
application/json
{
  • "account": "string",
  • "balance": "string",
  • "credit": "string",
  • "currency": "USD",
  • "equity": "string",
  • "id": 0,
  • "is_demo": true,
  • "leverage": 0,
  • "observe_password": "string",
  • "password": "string",
  • "server_name": "string",
  • "trading_account_type_name": "string",
  • "trading_platform": "MT4"
}

查询是否允许开通模拟账户-交易接口

查询是否允许开通模拟账户

-

Responses

Response samples

Content type
application/json
{
  • "enabled": true
}

查询交易账户可用杠杆-交易接口

查询交易账户可用杠杆

-
query Parameters
id
required
integer

交易账户的业务ID

-

Responses

Response samples

Content type
application/json
{
  • "leverage_options": [
    ]
}

查询交易账号杠杆更新状态-交易接口

查询交易账号杠杆更新状态

-
query Parameters
id
required
integer

交易账号的业务ID

-

Responses

Response samples

Content type
application/json
{
  • "audit_id": 0,
  • "audit_status": "string"
}

查询可用交易账号类型列表-通过token获取用户ID匹配注册流程再查询-交易接口

查询可用交易账号类型列表-通过token获取用户ID匹配注册流程再查询

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
is_demo
boolean
trading_platform
required
string
Enum: "MT4" "MT5"

交易平台

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

查询交易账号列表-交易接口

查询交易账号列表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
is_demo
boolean

是否为模拟账户

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

查询交易账号选项列表-交易接口

查询交易账号选项列表

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取可用交易平台选项列表-交易接口

获取可用交易平台选项列表

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

更新交易账号杠杆-交易接口

更新交易账号杠杆

-
Request Body schema: application/json
id
required
integer

交易账号的业务ID

-
leverage
required
integer

杠杆

-
remark
required
string

注释

-

Responses

Request samples

Content type
application/json
{
  • "id": 0,
  • "leverage": 0,
  • "remark": "string"
}

Response samples

Content type
application/json
{ }

更新交易账号密码-交易接口

更新交易账号密码

-
Request Body schema: application/json
id
required
integer

交易账号的业务ID

-
password
required
string

密码

-
type
required
string
Enum: "observe" "trade"

密码类型:observe表示只读密码,trade表示交易密码

-

Responses

Request samples

Content type
application/json
{
  • "id": 0,
  • "password": "string",
  • "type": "observe"
}

Response samples

Content type
application/json
{ }

检查当前用户是否有待审核的出金订单-交易接口

检查当前用户是否有待审核的出金订单

-

Responses

Response samples

Content type
application/json
{
  • "has_pending": true
}

IB接口(19)

IB的Client详情-代理接口

IB的Client详情

-
query Parameters
client_user_id
required
integer

客户用户id

-

Responses

Response samples

Content type
application/json
{
  • "agreement_status": "filling",
  • "apply_status": "filling",
  • "completed_module": [
    ],
  • "identity_status": "filling",
  • "kyc_approved_at": "string",
  • "kyc_data": {
    },
  • "kyc_status": "filling",
  • "kyc_way": "string",
  • "register_datetime": "string"
}

IB的Client列表-代理接口

IB的Client列表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
client_user_id
integer

客户用户ID

-
kyc_status
string
Enum: "approved" "disapproved"

KYC认证状态: approved: 已验证, disapproved: 未验证

-
status
string
Enum: "enabled" "disabled"

用户状态: enabled: 启用, disabled: 禁用

-
email
string

邮箱(模糊查询)

-
client_name
string

姓名(模糊查询)

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

IB端-面板数据-仪表盘接口

IB端-面板数据

-
query Parameters
date_type
string

日期类型

-

Responses

Response samples

Content type
application/json
{
  • "cards": {
    }
}

IB端-面板数据-获取最后更新时间-仪表盘接口

IB端-面板数据-获取最后更新时间

-

Responses

Response samples

Content type
application/json
{
  • "last_update_time": "string"
}

ib查看返佣记录-资金接口

ib查看返佣记录

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

消息详情-消息中心

消息详情

-
query Parameters
id
required
integer

消息ID

-

Responses

Response samples

Content type
application/json
{
  • "content": "string",
  • "created_at": "string",
  • "id": 0,
  • "sender": "string",
  • "title": "string"
}

隐藏消息-消息中心

隐藏消息

-
Request Body schema: application/json
id
required
integer

消息ID

-

Responses

Request samples

Content type
application/json
{
  • "id": 0
}

Response samples

Content type
application/json
{ }

消息列表-消息中心

消息列表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

标记消息已读-消息中心

标记消息已读

-
Request Body schema: application/json
id
required
integer

消息ID

-

Responses

Request samples

Content type
application/json
{
  • "id": 0
}

Response samples

Content type
application/json
{ }

获取未读消息数量-消息中心

获取未读消息数量

-

Responses

Response samples

Content type
application/json
{
  • "count": 0
}

查询返佣账号列表-代理接口

查询返佣账号列表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
account_id
string

交易账户在MT4的ID

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

更改返佣账户权限-代理接口

更改返佣账户权限

-
Request Body schema: application/json
enabled
required
boolean

是否启用权限

-
id
required
integer

交易账户的业务ID

-

Responses

Request samples

Content type
application/json
{
  • "enabled": true,
  • "id": 0
}

Response samples

Content type
application/json
{
  • "account": "string"
}

获取软件下载工具列表-代理接口

获取软件下载工具列表

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

查询客户交易账户列表-代理接口

查询客户交易账户列表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
user_name
string

姓名

-
account_id
string

交易账户在MT4的ID

-
trading_account_type_name
string

交易账号类型名称

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取IB用户信息-代理接口

获取IB用户信息

-

Responses

Response samples

Content type
application/json
{
  • "QRCodeURL": "string",
  • "ReferralCode": "string",
  • "ReferralLink": "string",
  • "agreement_status": "filling",
  • "apply_status": "filling",
  • "completed_module": [
    ],
  • "identity_status": "filling",
  • "kyc_approved_at": "string",
  • "kyc_data": {
    },
  • "kyc_status": "filling",
  • "kyc_way": "string",
  • "register_datetime": "string"
}

导出佣金明细报表-报表接口

导出佣金明细报表

-
Request Body schema: application/json
client_user_name
string

客户用户名

-
end_time
string

结束日期 (格式: YYYY-MM-DD)

-
rebate_aggregation_id
string
start_time
string

开始日期 (格式: YYYY-MM-DD)

-
time_search_type
string
Enum: "calculate_at" "grant_at"

Responses

Request samples

Content type
application/json
{
  • "client_user_name": "string",
  • "end_time": "string",
  • "rebate_aggregation_id": "string",
  • "start_time": "string",
  • "time_search_type": "calculate_at"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

查询佣金明细报表-报表接口

查询佣金明细报表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
rebate_aggregation_id
integer
time_search_type
string
Enum: "calculate_at" "grant_at"
start_time
string

开始日期 (格式: YYYY-MM-DD)

-
end_time
string

结束日期 (格式: YYYY-MM-DD)

-
client_user_name
string

客户用户名

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

导出佣金报表-报表接口

导出佣金报表

-
Request Body schema: application/json
end_time
string

自定义结束时间 (格式: YYYY-MM-DD HH:MM:SS)

-
start_time
string

自定义开始时间 (格式: YYYY-MM-DD HH:MM:SS)

-
time_search_type
string
Enum: "calculate_at" "grant_at"

Responses

Request samples

Content type
application/json
{
  • "end_time": "string",
  • "start_time": "string",
  • "time_search_type": "calculate_at"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

查询佣金报表-报表接口

查询佣金报表

-
query Parameters
page
required
integer
Default: 1

页码

-
size
required
integer
Default: 20

每页数量

-
time_search_type
string
Enum: "calculate_at" "grant_at"
start_time
string

自定义开始时间 (格式: YYYY-MM-DD HH:MM:SS)

-
end_time
string

自定义结束时间 (格式: YYYY-MM-DD HH:MM:SS)

-

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}
+ " fill="currentColor">

WikiBroker (v1.4)

Download OpenAPI specification:

crm saas

+

公共接口(28)

修改密码-认证接口

修改密码

+
Request Body schema: application/json
email_code
string

邮箱验证码

+
new_password
required
string

新密码

+
old_password
required
string

原密码

+

Responses

Request samples

Content type
application/json
{
  • "email_code": "string",
  • "new_password": "string",
  • "old_password": "string"
}

Response samples

Content type
application/json
{ }

登录-认证接口

登录

+
header Parameters
Captcha-Token
string
Captcha-Action
string
Captcha-Randstr
string
Request Body schema: application/json
email
required
string
password
required
string

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "token": "string",
  • "user_info": {
    }
}

登出-认证接口

登出

+

Responses

Response samples

Content type
application/json
{ }

重置密码-认证接口

重置密码

+
Request Body schema: application/json
password
required
string
token
required
string

Responses

Request samples

Content type
application/json
{
  • "password": "string",
  • "token": "string"
}

Response samples

Content type
application/json
{ }

重置密码发送邮件-认证接口

重置密码发送邮件

+
Request Body schema: application/json
email
required
string

Responses

Request samples

Content type
application/json
{
  • "email": "string"
}

Response samples

Content type
application/json
{ }

重置密码Token是否过期-认证接口

重置密码Token是否过期

+
query Parameters
token
required
string

Responses

Response samples

Content type
application/json
{
  • "expired": true
}

获取用户安全设置-认证接口

获取用户安全设置

+

Responses

Response samples

Content type
application/json
{
  • "email": "string",
  • "password": "string",
  • "required_password": "string"
}

获取登陆用户的按钮权限-权限管理模块

获取登陆用户的按钮权限

+

Responses

Response samples

Content type
application/json
{
  • "actions": {
    },
  • "menus": [
    ]
}

获取所有的菜单以及button列表用户的菜单列表-权限管理模块

获取所有的菜单以及button列表用户的菜单列表

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ]
}

获取投放列表-投放管理

获取投放列表(Client/IB端)

+
header Parameters
X-Language
string
Default: zh-CN

国际化语言,默认为zh-CN

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ]
}

屏蔽弹窗(不再展示)-弹窗管理

屏蔽弹窗(不再展示)

+
Request Body schema: application/json
ids
required
Array of integers

Responses

Request samples

Content type
application/json
{
  • "ids": [
    ]
}

Response samples

Content type
application/json
{ }

获取弹窗列表-弹窗管理

获取弹窗列表(Client/IB端)

+
header Parameters
X-Language
string
Default: zh-CN

国际化语言,默认为zh-CN

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ]
}

腾讯验证码验证-公共服务

腾讯验证码验证

+
Request Body schema: application/json
app_id
required
integer
rand_str
required
string
ticket
required
string
user_ip
required
string

Responses

Request samples

Content type
application/json
{
  • "app_id": 0,
  • "rand_str": "string",
  • "ticket": "string",
  • "user_ip": "string"
}

Response samples

Content type
application/json
{
  • "is_valid": true
}

发送邮箱验证码-验证码接口

发送邮箱验证码

+
Request Body schema: application/json
email
string

邮箱地址

+
received_at
required
integer

接收时间戳(Unix时间戳,单位:秒)

+
scene
required
string
Enum: "register" "withdrawal" "transfer" "password_change"

使用场景

+

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "received_at": 0,
  • "scene": "register"
}

Response samples

Content type
application/json
{
  • "can_resend_at": 0,
  • "expired_at": 0
}

校验邮箱是否已注册-验证码接口

校验邮箱是否已注册

+
Request Body schema: application/json
email
required
string

邮箱地址

+

Responses

Request samples

Content type
application/json
{
  • "email": "string"
}

Response samples

Content type
application/json
{
  • "is_registered": true
}

获取AliyunOss临时访问凭证-公共服务

获取AliyunOss临时访问凭证

+

Responses

Response samples

Content type
application/json
{
  • "access_key_id": "string",
  • "access_key_secret": "string",
  • "bucket_dir": "string",
  • "bucket_name": "string",
  • "bucket_region": "string",
  • "expiration": "string",
  • "security_token": "string"
}

查询APP key配置-公开设置接口

查询APP key配置

+

Responses

Response samples

Content type
application/json
{
  • "recaptcha_android_key": "string",
  • "recaptcha_web_key": "string",
  • "tencent_android_app_id": 0,
  • "tencent_ios_app_id": 0,
  • "tencent_web_app_id": 0
}

获取外观设置-公开设置接口

获取外观设置

+

Responses

Response samples

Content type
application/json
{
  • "admin_login_bg_image_url": "string",
  • "admin_login_copy_i18n": {
    },
  • "admin_login_layout": "string",
  • "client_login_bg_image_url": "string",
  • "client_login_copy_i18n": {
    },
  • "client_login_layout": "string",
  • "ib_login_bg_image_url": "string",
  • "ib_login_copy_i18n": {
    },
  • "ib_login_layout": "string"
}

获取公司设置-公开设置接口

获取公司设置

+

Responses

Response samples

Content type
application/json
{
  • "broker_name_i18n": {
    },
  • "company_logo_url": "string",
  • "email": "string",
  • "login_page_logo_url": "string",
  • "support_phone": "string",
  • "timezone": "string",
  • "watermark_logo_url": "string"
}

获取国家-公开设置接口

获取国家

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ]
}

获取所有可用的货币-公开设置接口

获取所有可用的货币

+
query Parameters
method
string
Enum: "all" "bank_transfer" "international_wire_transfer" "cryptocurrency"

出入金方式: normal为全部,bank_transfer为银行转账,international_wire_transfer为国际电汇,cryptocurrency为加密货币

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

查询全局杠杆列表-公开设置接口

查询全局杠杆列表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取语言设置-公开设置接口

获取语言设置

+

Responses

Response samples

Content type
application/json
{
  • "language": [
    ]
}

获取安全设置-公开设置接口

获取安全设置

+

Responses

Response samples

Content type
application/json
{
  • "email_verification_scenarios": [
    ],
  • "google_two_factor_enabled": true,
  • "re_captcha_enabled": true,
  • "required_password_strength": "string",
  • "tencent_two_factor_enabled": true
}

获取当前租户版本号-公开设置接口

获取当前租户版本号

+

Responses

Response samples

Content type
application/json
{
  • "version": "string"
}

出金报表导出-报表接口

出金报表导出

+
Request Body schema: application/json
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
method
required
string
Enum: "all" "bank_transfer" "international_wire_transfer" "cryptocurrency"

出金方式: all为全部,bank_transfer为银行转账,international_wire_transfer为国际电汇,cryptocurrency为加密货币

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
status
required
string
Enum: "all" "auditing" "approved" "disapproved"

状态:all为全部(包含审核中和批准,不批准),auditing为审核中,approved为同意,disapproved为拒绝

+

Responses

Request samples

Content type
application/json
{
  • "end_time": "string",
  • "method": "all",
  • "start_time": "string",
  • "status": "all"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

出金报表-报表接口

出金报表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
status
required
string
Enum: "all" "auditing" "approved" "disapproved"

状态:all为全部(包含审核中和批准,不批准),auditing为审核中,approved为批准,disapproved为拒绝

+
method
required
string
Enum: "all" "bank_transfer" "international_wire_transfer" "cryptocurrency"

出金方式: all为全部,bank_transfer为银行转账,international_wire_transfer为国际电汇,cryptocurrency为加密货币

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取当前登录用户的菜单权限(自动区分IB)-权限验证

获取当前登录用户的菜单权限(自动区分IB/Client)

+

Responses

Response samples

Content type
application/json
{
  • "actions": {
    },
  • "menus": [
    ]
}

Client接口(68)

查询所持账户的余额-申请接口

查询所持账户的余额

+
query Parameters
type
required
Array of arrays
Items Enum: "deposit_only" "withdrawal_only" "normal" "wallet"

记录类型:只能入金(deposit_only)、只能出金(withdrawal_only),入金出金都可以(normal),入金传入deposit_only和normal,出金/转账转出传入withdrawal_only、normal和wallet,转账转入传入deposit_only、normal和wallet

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

创建开户申请-申请接口

创建开户申请-Client端接口

+
Request Body schema: application/json
currency
required
string
Value: "USD"

账户货币,目前只支持USD

+
leverage
required
integer

账户杠杆

+
observe_password
string

观摩密码

+
password
required
string

交易密码

+
trading_account_type_id
required
integer

交易账号类型ID

+
trading_platform
required
string
Enum: "MT4" "MT5"

交易平台,目前仅支持MT4

+

Responses

Request samples

Content type
application/json
{
  • "currency": "USD",
  • "leverage": 0,
  • "observe_password": "string",
  • "password": "string",
  • "trading_account_type_id": 0,
  • "trading_platform": "MT4"
}

Response samples

Content type
application/json
{
  • "application_account_id": 0
}

创建转账申请-申请接口

创建转账申请

+
Request Body schema: application/json
amount
required
string

转账金额

+
email_code
string

邮箱验证码

+
remark
required
string

注释

+
source_account_type
required
string
Default: "trading"
Enum: "trading" "wallet"

转出账户类型

+
source_trading_account_id
required
integer

转出交易账户ID

+
target_account_type
required
string
Default: "trading"
Enum: "trading" "wallet"

转入账户类型

+
target_trading_account_id
required
integer

转入交易账户ID

+

Responses

Request samples

Content type
application/json
{
  • "amount": "string",
  • "email_code": "string",
  • "remark": "string",
  • "source_account_type": "trading",
  • "source_trading_account_id": 0,
  • "target_account_type": "trading",
  • "target_trading_account_id": 0
}

Response samples

Content type
application/json
{
  • "audit_id": 0,
  • "audit_status": "string"
}

查询转账历史列表-申请接口

查询转账历史列表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

创建电子认证会话-电子认证

创建电子认证会话

+
Request Body schema: application/json
failed_url
required
string

认证失败跳转URL

+
success_url
required
string

认证成功跳转URL

+

Responses

Request samples

Content type
application/json
{
  • "failed_url": "string",
  • "success_url": "string"
}

Response samples

Content type
application/json
{
  • "expire_at": "string",
  • "redirect_url": "string",
  • "session_id": "string"
}

查询电子认证结果-电子认证

查询电子认证结果

+
query Parameters
session_id
required
string

会话ID

+

Responses

Response samples

Content type
application/json
{
  • "attempt_times": 0,
  • "reason_code": "string",
  • "reason_msg": "string",
  • "retry_times": 0,
  • "status": "string"
}

消息详情-消息中心

消息详情

+
query Parameters
id
required
integer

消息ID

+

Responses

Response samples

Content type
application/json
{
  • "content": "string",
  • "created_at": "string",
  • "id": 0,
  • "sender": "string",
  • "title": "string"
}

隐藏消息-消息中心

隐藏消息

+
Request Body schema: application/json
id
required
integer

消息ID

+

Responses

Request samples

Content type
application/json
{
  • "id": 0
}

Response samples

Content type
application/json
{ }

消息列表-消息中心

消息列表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

标记消息已读-消息中心

标记消息已读

+
Request Body schema: application/json
id
required
integer

消息ID

+

Responses

Request samples

Content type
application/json
{
  • "id": 0
}

Response samples

Content type
application/json
{ }

获取未读消息数量-消息中心

获取未读消息数量

+

Responses

Response samples

Content type
application/json
{
  • "count": 0
}

查询Client用户问卷答案-客户接口

查询Client用户问卷答案

+
query Parameters
id
required
integer

答卷记录ID

+

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "items": [
    ],
  • "name": "string"
}

保存Client用户问卷答案-客户接口

保存Client用户问卷答案

+
Request Body schema: application/json
required
Array of objects

答案列表

+
questionnaire_id
required
integer

问卷ID

+

Responses

Request samples

Content type
application/json
{
  • "answers": [
    ],
  • "questionnaire_id": 0
}

Response samples

Content type
application/json
{ }

获取软件下载工具列表-客户接口

获取软件下载工具列表

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取交易工具栏目多语言详情-交易工具

获取交易工具栏目多语言详情

+
query Parameters
column_id
required
integer

主表column_id

+

Responses

Response samples

Content type
application/json
{
  • "column_id": 0,
  • "id": 0,
  • "iframe_link": "string",
  • "is_read": true,
  • "language": "string",
  • "popup_content": "string",
  • "popup_title": "string",
  • "title": "string"
}

检查弹框是否已读-交易工具

检查弹框是否已读

+
query Parameters
column_id
required
integer

栏目ID

+

Responses

Response samples

Content type
application/json
{
  • "is_read": true
}

标记弹框已读-交易工具

标记弹框已读

+
Request Body schema: application/json
column_id
required
integer

栏目ID

+

Responses

Request samples

Content type
application/json
{
  • "column_id": 0
}

Response samples

Content type
application/json
{ }

获取加密货币USDT可用网络-申请接口

获取加密货币USDT可用网络

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

基于货币对返回汇率-申请接口

基于货币对返回汇率

+
query Parameters
from_currency
required
string

源货币

+
to_currency
required
string

目标货币

+

Responses

Response samples

Content type
application/json
{
  • "exchange_rate": "string"
}

获取可用货币列表-申请接口

获取可用货币列表

+
query Parameters
remittance_id
required
integer

汇款方式ID

+
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

虚拟账户入金-申请接口

虚拟账户入金

+
Request Body schema: application/json
amount
required
string

金额

+
trading_account_id
required
integer

交易账号ID

+

Responses

Request samples

Content type
application/json
{
  • "amount": "string",
  • "trading_account_id": 0
}

Response samples

Content type
application/json
{ }

取消入金申请-申请接口

取消入金申请

+
Request Body schema: application/json
order_number
required
string

入金订单号

+

Responses

Request samples

Content type
application/json
{
  • "order_number": "string"
}

Response samples

Content type
application/json
{
  • "order_number": "string",
  • "status": "string"
}

获取可用的入金渠道-申请接口

获取可用的入金渠道

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

创建入金申请草稿-申请接口

创建入金申请草稿

+
Request Body schema: application/json
deposit_amount
required
string

入金金额

+
remark
string

备注,可选

+
remittance_id
required
integer

汇款方式id

+
trading_account_id
required
integer

入金交易账号id(用户关联的交易账号ID(多选一))

+

Responses

Request samples

Content type
application/json
{
  • "deposit_amount": "string",
  • "remark": "string",
  • "remittance_id": 0,
  • "trading_account_id": 0
}

Response samples

Content type
application/json
{
  • "order_number": "string",
  • "pay_data": "string",
  • "pay_type": "string",
  • "pay_url": "string",
  • "status": "string"
}

获取未提交入金申请草稿-申请接口

获取未提交入金申请草稿

+
query Parameters
order_number
required
string

入金订单号

+

Responses

Response samples

Content type
application/json
{
  • "account_info": "string",
  • "deposit_amount": "string",
  • "order_number": "string",
  • "receipt_url": "string"
}

获取未处理入金申请订单的数量-申请接口

获取未处理入金申请订单的数量

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+

Responses

Response samples

Content type
application/json
{
  • "count": 0
}

提交入金申请(支付确认)-申请接口

提交入金申请(支付确认)

+
Request Body schema: application/json
order_number
required
string

入金订单号

+
receipt_url
required
string

收据图片地址

+

Responses

Request samples

Content type
application/json
{
  • "order_number": "string",
  • "receipt_url": "string"
}

Response samples

Content type
application/json
{
  • "order_number": "string",
  • "status": "string"
}

查询入金历史记录-申请接口

查询入金历史记录

+
query Parameters
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

查询出金历史记录-申请接口

查询出金历史记录

+
query Parameters
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取可用的汇率列表-申请接口

获取可用的汇率列表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取可用的出金渠道-申请接口

获取可用的出金渠道

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

创建出金申请-申请接口

创建出金申请

+
Request Body schema: application/json
object

银行转账信息

+
object

加密货币信息

+
currency
required
string

交易货币类型

+
email_code
string

邮箱验证码

+
exchange_rate
required
string

汇率

+
fee
required
string

手续费

+
object

国际电汇信息

+
method
required
string

汇款方式

+
remark
string

备注

+
remittance_amount
required
string

汇款金额

+
remittance_id
required
integer

汇款id 获取支付方式、最高最低出金,手续费等信息

+
trading_account_id
required
integer

出金交易账号id

+
withdrawal_amount
required
string

出金金额

+

Responses

Request samples

Content type
application/json
{
  • "bank_transfer_info": {
    },
  • "cryptocurrency_info": {
    },
  • "currency": "string",
  • "email_code": "string",
  • "exchange_rate": "string",
  • "fee": "string",
  • "international_wire_info": {
    },
  • "method": "string",
  • "remark": "string",
  • "remittance_amount": "string",
  • "remittance_id": 0,
  • "trading_account_id": 0,
  • "withdrawal_amount": "string"
}

Response samples

Content type
application/json
{
  • "order_number": "string"
}

Client用户信息-客户接口

Client用户信息

+

Responses

Response samples

Content type
application/json
{
  • "agreement_status": "filling",
  • "apply_status": "filling",
  • "completed_module": [
    ],
  • "identity_status": "filling",
  • "kyc_approved_at": "string",
  • "kyc_data": {
    },
  • "kyc_status": "filling",
  • "kyc_way": "string",
  • "register_datetime": "string"
}

获取Client用户注册模板-客户接口

获取Client用户注册模板

+

Responses

Response samples

Content type
application/json
{
  • "agreement": {
    },
  • "apply_status": "pending",
  • "e_verify": {
    },
  • "identity": {
    },
  • "kyc": {
    },
  • "remark": "string"
}

注册Client用户-客户接口

注册Client用户(Client端接口)

+
Request Body schema: application/json
email
required
string
email_code
string

邮箱验证码

+
invite_code
string
password
required
string

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "email_code": "string",
  • "invite_code": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "token": "string",
  • "user_info": {
    }
}

保存Client用户身份信息-客户接口

保存Client用户身份信息

+
Request Body schema: application/json
current_module
required
string
Enum: "identity" "questionnaire" "family" "contact" "job" "authentication_accessory" "authentication" "agreement" "e_verify" "all"

当前模块: identity: 身份信息, questionnaire: 问卷调查, family: 家庭信息, contact: 联络信息, job: 工作信息, authentication_accessory: 证明文件, authentication: 认证信息, e_verify: 电子验证, all: 全部

+
required
object

当前需要提交保存的KYC数据, key1: {module_key}, key2: {field_key}

+

Responses

Request samples

Content type
application/json
{
  • "current_module": "identity",
  • "kyc_data": {
    }
}

Response samples

Content type
application/json
{ }

创建收款账户-申请接口

创建收款账户

+
Request Body schema: application/json
object

银行转账信息

+
object

加密货币信息

+
object

国际电汇信息

+
payment_method
required
string

必填:支付方式 international_wire_transfer|bank_transfer|cryptocurrency

+
remark
string

选填:备注

+

Responses

Request samples

Content type
application/json
{
  • "bank_transfer_info": {
    },
  • "cryptocurrency_info": {
    },
  • "international_wire_info": {
    },
  • "payment_method": "string",
  • "remark": "string"
}

Response samples

Content type
application/json
{
  • "id": 0
}

删除收款账户-申请接口

删除收款账户

+
Request Body schema: application/json
id
required
integer

账户ID

+

Responses

Request samples

Content type
application/json
{
  • "id": 0
}

Response samples

Content type
application/json
{ }

获取收款账户详情-申请接口

获取收款账户详情

+
query Parameters
id
required
integer

账户ID

+

Responses

Response samples

Content type
application/json
{
  • "account_holder_name": "string",
  • "bank_transfer_info": {
    },
  • "created_at": "string",
  • "cryptocurrency_info": {
    },
  • "id": 0,
  • "international_wire_info": {
    },
  • "payment_method": "string",
  • "remark": "string",
  • "updated_at": "string"
}

获取收款账户列表-申请接口

获取收款账户列表

+
query Parameters
payment_method
string

选填:筛选支付方式(international_wire_transfer|bank_transfer|cryptocurrency)

+
start_time
string

选填:创建开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
end_time
string

选填:创建结束时间(格式:YYYY-MM-DD HH:MM:SS)

+

Responses

Response samples

Content type
application/json
{
  • "bank_transfer": [
    ],
  • "cryptocurrency": [
    ],
  • "international_wire_transfer": [
    ],
  • "total": 0
}

更新收款账户-申请接口

更新收款账户

+
Request Body schema: application/json
object

银行转账信息(更新时提供)

+
object

加密货币信息(更新时提供)

+
id
required
integer

账户ID

+
object

国际电汇信息(更新时提供)

+
is_default
boolean

是否设置为默认账户(true-设为默认,false-取消默认,不传-不修改)

+
remark
string

备注

+

Responses

Request samples

Content type
application/json
{
  • "bank_transfer_info": {
    },
  • "cryptocurrency_info": {
    },
  • "id": 0,
  • "international_wire_info": {
    },
  • "is_default": true,
  • "remark": "string"
}

Response samples

Content type
application/json
{ }

入金报表导出-报表接口

入金报表导出

+
Request Body schema: application/json
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
status
required
string
Enum: "all" "auditing" "approved" "disapproved"

状态:all为全部(包含审核中和批准,不批准),auditing为审核中,approved为同意,disapproved为拒绝

+

Responses

Request samples

Content type
application/json
{
  • "end_time": "string",
  • "start_time": "string",
  • "status": "all"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

入金报表-报表接口

入金报表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
status
required
string
Enum: "all" "auditing" "approved" "disapproved"

状态:all为全部(包含审核中和批准,不批准),auditing为审核中,approved为批准,disapproved为拒绝

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

导出历史订单报表-报表接口

导出历史订单报表

+
Request Body schema: application/json
account
string

交易账号

+
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
order_number
string

订单号

+
page
required
integer
Default: 1

页码

+
server_id
integer

交易服务器ID

+
size
required
integer
Default: 20

每页数量

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
symbol
string

交易品种

+
time_type
string
Default: "open"
Enum: "open" "close"

时间类型,open为开仓时间,close为闭仓时间

+
trading_account_id
integer

交易账号的业务ID

+
trading_type
required
string
Enum: "all" "BUY" "SELL"

交易类型

+

Responses

Request samples

Content type
application/json
{
  • "account": "string",
  • "end_time": "string",
  • "order_number": "string",
  • "page": 1,
  • "server_id": 0,
  • "size": 20,
  • "start_time": "string",
  • "symbol": "string",
  • "time_type": "open",
  • "trading_account_id": 0,
  • "trading_type": "all"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

查询历史订单报表-报表接口

查询历史订单报表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
time_type
string
Default: "open"
Enum: "open" "close"

时间类型,open为开仓时间,close为闭仓时间

+
order_number
string

订单号

+
account
string

交易账号

+
trading_type
required
string
Enum: "all" "BUY" "SELL"

交易类型

+
symbol
string

交易品种

+
server_id
integer

交易服务器ID

+
trading_account_id
integer

交易账号的业务ID

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

导出持仓报表-报表接口

导出持仓报表

+
Request Body schema: application/json
account
string

交易账号

+
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
order_number
string

订单号

+
page
required
integer
Default: 1

页码

+
server_id
integer

交易服务器ID

+
size
required
integer
Default: 20

每页数量

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
symbol
string

交易品种

+
trading_account_id
integer

交易账号的业务ID

+
trading_type
required
string
Enum: "all" "BUY" "SELL"

交易类型

+

Responses

Request samples

Content type
application/json
{
  • "account": "string",
  • "end_time": "string",
  • "order_number": "string",
  • "page": 1,
  • "server_id": 0,
  • "size": 20,
  • "start_time": "string",
  • "symbol": "string",
  • "trading_account_id": 0,
  • "trading_type": "all"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

查询持仓报表-报表接口

查询持仓报表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
order_number
string

订单号

+
account
string

交易账号

+
trading_type
required
string
Enum: "all" "BUY" "SELL"

交易类型

+
symbol
string

交易品种

+
server_id
integer

交易服务器ID

+
trading_account_id
integer

交易账号的业务ID

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

导出挂单报表-报表接口

导出挂单报表

+
Request Body schema: application/json
account
string

交易账号

+
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
order_number
string

订单号

+
page
required
integer
Default: 1

页码

+
server_id
integer

交易服务器ID

+
size
required
integer
Default: 20

每页数量

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
symbol
string

交易品种

+
trading_account_id
integer

交易账号的业务ID

+
trading_type
required
string
Enum: "all" "BUY_LIMIT" "SELL_LIMIT" "BUY_STOP" "SELL_STOP" "BUY_STOP_LIMIT" "SELL_STOP_LIMIT"

交易类型

+

Responses

Request samples

Content type
application/json
{
  • "account": "string",
  • "end_time": "string",
  • "order_number": "string",
  • "page": 1,
  • "server_id": 0,
  • "size": 20,
  • "start_time": "string",
  • "symbol": "string",
  • "trading_account_id": 0,
  • "trading_type": "all"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

查询挂单报表-报表接口

查询挂单报表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
order_number
string

订单号

+
account
string

交易账号

+
trading_type
required
string
Enum: "all" "BUY_LIMIT" "SELL_LIMIT" "BUY_STOP" "SELL_STOP" "BUY_STOP_LIMIT" "SELL_STOP_LIMIT"

交易类型

+
symbol
string

交易品种

+
server_id
integer

交易服务器ID

+
trading_account_id
integer

交易账号的业务ID

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取交易服务器选项列表-报表接口

获取交易服务器选项列表

+
query Parameters
order_type
required
string
Enum: "holding" "history" "pending"

订单类型

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

查询用户交易过的品种列表-报表接口

查询用户交易过的品种列表

+
query Parameters
order_type
required
string
Enum: "holding" "history" "pending"

订单类型

+
server_id
integer

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

导出转账报表-报表接口

导出转账报表

+
Request Body schema: application/json
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
order_number
string

订单号

+
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
status
required
string
Enum: "all" "pending" "auditing" "approved" "disapproved"

审核状态:all为全部,pending为待审核,auditing为审核中,approved为批准,disapproved为拒绝

+

Responses

Request samples

Content type
application/json
{
  • "end_time": "string",
  • "order_number": "string",
  • "page": 1,
  • "size": 20,
  • "start_time": "string",
  • "status": "all"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

查询转账报表-报表接口

查询转账报表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
order_number
string

订单号

+
status
required
string
Enum: "all" "pending" "auditing" "approved" "disapproved"

审核状态:all为全部,pending为待审核,auditing为审核中,approved为批准,disapproved为拒绝

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

申请交易账号-用户ID从token获取-交易接口

申请交易账号-用户ID从token获取

+
Request Body schema: application/json
currency
required
string
Value: "USD"

账户货币,目前只支持USD

+
is_demo
required
boolean

是否为模拟账户

+
leverage
required
integer

账户杠杆

+
observe_password
string

观摩密码

+
password
required
string

交易密码

+
trading_account_type_id
required
integer

交易账号类型ID

+
trading_platform
required
string
Enum: "MT4" "MT5"

交易平台,目前仅支持MT4

+

Responses

Request samples

Content type
application/json
{
  • "currency": "USD",
  • "is_demo": true,
  • "leverage": 0,
  • "observe_password": "string",
  • "password": "string",
  • "trading_account_type_id": 0,
  • "trading_platform": "MT4"
}

Response samples

Content type
application/json
{
  • "id": 0
}

查询交易账号-交易接口

查询交易账号

+
query Parameters
id
required
integer

交易账户的业务ID

+

Responses

Response samples

Content type
application/json
{
  • "account": "string",
  • "balance": "string",
  • "credit": "string",
  • "currency": "USD",
  • "equity": "string",
  • "id": 0,
  • "is_demo": true,
  • "leverage": 0,
  • "observe_password": "string",
  • "password": "string",
  • "server_name": "string",
  • "trading_account_type_name": "string",
  • "trading_platform": "MT4"
}

查询是否允许开通模拟账户-交易接口

查询是否允许开通模拟账户

+

Responses

Response samples

Content type
application/json
{
  • "enabled": true
}

查询交易账户可用杠杆-交易接口

查询交易账户可用杠杆

+
query Parameters
id
required
integer

交易账户的业务ID

+

Responses

Response samples

Content type
application/json
{
  • "leverage_options": [
    ]
}

查询交易账号杠杆更新状态-交易接口

查询交易账号杠杆更新状态

+
query Parameters
id
required
integer

交易账号的业务ID

+

Responses

Response samples

Content type
application/json
{
  • "audit_id": 0,
  • "audit_status": "string"
}

查询可用交易账号类型列表-通过token获取用户ID匹配注册流程再查询-交易接口

查询可用交易账号类型列表-通过token获取用户ID匹配注册流程再查询

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
is_demo
boolean
trading_platform
required
string
Enum: "MT4" "MT5"

交易平台

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

查询交易账号列表-交易接口

查询交易账号列表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
is_demo
boolean

是否为模拟账户

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

查询交易账号选项列表-交易接口

查询交易账号选项列表

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取可用交易平台选项列表-交易接口

获取可用交易平台选项列表

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

更新交易账号杠杆-交易接口

更新交易账号杠杆

+
Request Body schema: application/json
id
required
integer

交易账号的业务ID

+
leverage
required
integer

杠杆

+
remark
required
string

注释

+

Responses

Request samples

Content type
application/json
{
  • "id": 0,
  • "leverage": 0,
  • "remark": "string"
}

Response samples

Content type
application/json
{ }

更新交易账号密码-交易接口

更新交易账号密码

+
Request Body schema: application/json
id
required
integer

交易账号的业务ID

+
password
required
string

密码

+
type
required
string
Enum: "observe" "trade"

密码类型:observe表示只读密码,trade表示交易密码

+

Responses

Request samples

Content type
application/json
{
  • "id": 0,
  • "password": "string",
  • "type": "observe"
}

Response samples

Content type
application/json
{ }

检查当前用户是否有待审核的出金订单-交易接口

检查当前用户是否有待审核的出金订单

+

Responses

Response samples

Content type
application/json
{
  • "has_pending": true
}

获取钱包余额-钱包管理

获取钱包余额

+

Responses

Response samples

Content type
application/json
{
  • "balance": "string"
}

查询钱包流水报表-报表接口

查询钱包流水报表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
serial_number
string

钱包流水编号

+
order_number
string

交易订单号

+
account
string

交易账号

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

导出钱包流水报表-报表接口

导出钱包流水报表

+
Request Body schema: application/json
account
string

交易账号

+
end_time
string

自定义结束时间(格式:YYYY-MM-DD HH:MM:SS)

+
order_number
string

交易订单号

+
page
required
integer
Default: 1

页码

+
serial_number
string

钱包流水编号

+
size
required
integer
Default: 20

每页数量

+
start_time
string

自定义开始时间(格式:YYYY-MM-DD HH:MM:SS)

+

Responses

Request samples

Content type
application/json
{
  • "account": "string",
  • "end_time": "string",
  • "order_number": "string",
  • "page": 1,
  • "serial_number": "string",
  • "size": 20,
  • "start_time": "string"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

IB接口(19)

IB的Client详情-代理接口

IB的Client详情

+
query Parameters
client_user_id
required
integer

客户用户id

+

Responses

Response samples

Content type
application/json
{
  • "agreement_status": "filling",
  • "apply_status": "filling",
  • "completed_module": [
    ],
  • "identity_status": "filling",
  • "kyc_approved_at": "string",
  • "kyc_data": {
    },
  • "kyc_status": "filling",
  • "kyc_way": "string",
  • "register_datetime": "string"
}

IB的Client列表-代理接口

IB的Client列表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
client_user_id
integer

客户用户ID

+
kyc_status
string
Enum: "approved" "disapproved"

KYC认证状态: approved: 已验证, disapproved: 未验证

+
status
string
Enum: "enabled" "disabled"

用户状态: enabled: 启用, disabled: 禁用

+
email
string

邮箱(模糊查询)

+
client_name
string

姓名(模糊查询)

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

IB端-面板数据-仪表盘接口

IB端-面板数据

+
query Parameters
date_type
string

日期类型

+

Responses

Response samples

Content type
application/json
{
  • "cards": {
    }
}

IB端-面板数据-获取最后更新时间-仪表盘接口

IB端-面板数据-获取最后更新时间

+

Responses

Response samples

Content type
application/json
{
  • "last_update_time": "string"
}

ib查看返佣记录-资金接口

ib查看返佣记录

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

消息详情-消息中心

消息详情

+
query Parameters
id
required
integer

消息ID

+

Responses

Response samples

Content type
application/json
{
  • "content": "string",
  • "created_at": "string",
  • "id": 0,
  • "sender": "string",
  • "title": "string"
}

隐藏消息-消息中心

隐藏消息

+
Request Body schema: application/json
id
required
integer

消息ID

+

Responses

Request samples

Content type
application/json
{
  • "id": 0
}

Response samples

Content type
application/json
{ }

消息列表-消息中心

消息列表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

标记消息已读-消息中心

标记消息已读

+
Request Body schema: application/json
id
required
integer

消息ID

+

Responses

Request samples

Content type
application/json
{
  • "id": 0
}

Response samples

Content type
application/json
{ }

获取未读消息数量-消息中心

获取未读消息数量

+

Responses

Response samples

Content type
application/json
{
  • "count": 0
}

查询返佣账号列表-代理接口

查询返佣账号列表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
account_id
string

交易账户在MT4的ID

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

更改返佣账户权限-代理接口

更改返佣账户权限

+
Request Body schema: application/json
enabled
required
boolean

是否启用权限

+
id
required
integer

交易账户的业务ID

+

Responses

Request samples

Content type
application/json
{
  • "enabled": true,
  • "id": 0
}

Response samples

Content type
application/json
{
  • "account": "string"
}

获取软件下载工具列表-代理接口

获取软件下载工具列表

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

查询客户交易账户列表-代理接口

查询客户交易账户列表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
user_name
string

姓名

+
account_id
string

交易账户在MT4的ID

+
trading_account_type_name
string

交易账号类型名称

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

获取IB用户信息-代理接口

获取IB用户信息

+

Responses

Response samples

Content type
application/json
{
  • "QRCodeURL": "string",
  • "ReferralCode": "string",
  • "ReferralLink": "string",
  • "agreement_status": "filling",
  • "apply_status": "filling",
  • "completed_module": [
    ],
  • "identity_status": "filling",
  • "kyc_approved_at": "string",
  • "kyc_data": {
    },
  • "kyc_status": "filling",
  • "kyc_way": "string",
  • "register_datetime": "string"
}

导出佣金明细报表-报表接口

导出佣金明细报表

+
Request Body schema: application/json
client_user_name
string

客户用户名

+
end_time
string

结束日期 (格式: YYYY-MM-DD)

+
rebate_aggregation_id
string
start_time
string

开始日期 (格式: YYYY-MM-DD)

+
time_search_type
string
Enum: "calculate_at" "grant_at"

Responses

Request samples

Content type
application/json
{
  • "client_user_name": "string",
  • "end_time": "string",
  • "rebate_aggregation_id": "string",
  • "start_time": "string",
  • "time_search_type": "calculate_at"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

查询佣金明细报表-报表接口

查询佣金明细报表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
rebate_aggregation_id
integer
time_search_type
string
Enum: "calculate_at" "grant_at"
start_time
string

开始日期 (格式: YYYY-MM-DD)

+
end_time
string

结束日期 (格式: YYYY-MM-DD)

+
client_user_name
string

客户用户名

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}

导出佣金报表-报表接口

导出佣金报表

+
Request Body schema: application/json
end_time
string

自定义结束时间 (格式: YYYY-MM-DD HH:MM:SS)

+
start_time
string

自定义开始时间 (格式: YYYY-MM-DD HH:MM:SS)

+
time_search_type
string
Enum: "calculate_at" "grant_at"

Responses

Request samples

Content type
application/json
{
  • "end_time": "string",
  • "start_time": "string",
  • "time_search_type": "calculate_at"
}

Response samples

Content type
application/json
{
  • "download_url": "string"
}

查询佣金报表-报表接口

查询佣金报表

+
query Parameters
page
required
integer
Default: 1

页码

+
size
required
integer
Default: 20

每页数量

+
time_search_type
string
Enum: "calculate_at" "grant_at"
start_time
string

自定义开始时间 (格式: YYYY-MM-DD HH:MM:SS)

+
end_time
string

自定义结束时间 (格式: YYYY-MM-DD HH:MM:SS)

+

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total": 0
}