An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

        

# API 接口云 SDK
> 项目地址:https://github.com/JollyCorivuG/api-cloud

# SDK 架构模式
![](https://github.com/JollyCorivuG/api-cloud-client-sdk/blob/main/docs/%E6%9E%B6%E6%9E%84%E5%9B%BE.png)

# 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);
```