https://github.com/jollycorivug/api-cloud-client-sdk
API 接口云 --- 客户端 SDK
https://github.com/jollycorivug/api-cloud-client-sdk
Last synced: 3 months ago
JSON representation
API 接口云 --- 客户端 SDK
- Host: GitHub
- URL: https://github.com/jollycorivug/api-cloud-client-sdk
- Owner: JollyCorivuG
- Created: 2023-10-15T02:59:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-22T04:29:48.000Z (over 1 year ago)
- Last Synced: 2025-01-14T11:03:20.003Z (5 months ago)
- Language: Java
- Size: 82 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# API 接口云 SDK
> 项目地址:https://github.com/JollyCorivuG/api-cloud# SDK 架构模式
# SDK 使用步骤
## 引入依赖
```bupt.edu.jhc
apicloud-client-sdk
0.0.1```
## 设置网关地址
```
apicloud:
client:
gateway-host: localhost:8090
```
## 创建 ApiCloudClient
### 第一种方式:代码中指定 ak/sk
```
ApiCloudClient apiCloudClient = new ApiCloudClient(userInfo.getAccessKey(), userInfo.getSecretKey());
```
### 第二种方式:配置文件中指定 ak/sk
```
apicloud:
client:
accessKey: xxx
secretKey: xxx
```
## 设置参数并得到响应
```java
// 构造请求
SDKCommonReq sdkReq = new SDKCommonReq();
sdkReq.setPath(apiInterface.getHost() + apiInterface.getUrl());
sdkReq.setMethod(apiInterface.getMethod());
sdkReq.setRequestParams(req.getUserReqParams());
// 得到响应
SDKCommonResp sdkResp = apiService.request(apiCloudClient, sdkReq);
```