Skip to content

JollyCorivuG/api-cloud-client-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API 接口云 SDK

项目地址:https://github.com/JollyCorivuG/api-cloud

SDK 架构模式

SDK 使用步骤

引入依赖

<dependency>
    <groupId>bupt.edu.jhc</groupId>
    <artifactId>apicloud-client-sdk</artifactId>
    <version>0.0.1</version>
</dependency>

设置网关地址

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

设置参数并得到响应

// 构造请求
SDKCommonReq sdkReq = new SDKCommonReq();
sdkReq.setPath(apiInterface.getHost() + apiInterface.getUrl());
sdkReq.setMethod(apiInterface.getMethod());
sdkReq.setRequestParams(req.getUserReqParams());
// 得到响应
SDKCommonResp sdkResp = apiService.request(apiCloudClient, sdkReq);

About

API 接口云 --- 客户端 SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages