syntax = "proto3";
|
|
package aiot;
|
|
import "aiot_common.proto";
|
|
// 请求类型
|
enum RequestType{
|
// 同步请求 默认
|
sync = 0;
|
// 异步请求
|
Async = 1;
|
}
|
|
// 请求方式
|
enum RequestMethod{
|
// 默认
|
MethodDefault = 0;
|
// post请求
|
Post = 1;
|
// get请求
|
Get = 2;
|
// put请求
|
Put = 3;
|
// delete请求
|
Delete = 4;
|
}
|
|
// 请求header
|
enum RequestContentType{
|
ContentTypeDefault = 0;
|
ApplicationJson = 1;
|
ApplicationXWwwFormUrlencoded = 2;
|
MultipartFormData = 3;
|
ApplicationXml = 4;
|
}
|
|
// 请求的body体
|
message NodeReq {
|
// 请求的topic url
|
string topic = 1;
|
// 节点ID
|
string nodeId = 2;
|
// token
|
string authorization = 3;
|
// 请求指向的ip
|
string ip = 4;
|
// 请求的端口 保留字段
|
string port = 5;
|
// 请求的同步/异步类型
|
RequestType syncType = 6;
|
// method
|
RequestMethod method = 7;
|
// content-type
|
RequestContentType contentType = 8;
|
// 请求业务参数
|
bytes req = 9;
|
}
|
|
// 集群请求参数
|
message ClusterReq{
|
// 请求的topic url
|
string topic = 1;
|
// 集群ID
|
string clusterId = 2;
|
// token
|
string authorization = 3;
|
// 请求的同步/异步类型
|
RequestType syncType = 4;
|
// method
|
RequestMethod method = 5;
|
// content-type
|
RequestContentType contentType = 6;
|
// 请求业务参数
|
bytes req = 7;
|
}
|
|
// 设备列表请求参数
|
message NodesReq{
|
// 请求的topic url
|
string topic = 1;
|
// 设备列表ID
|
repeated string nodeIds = 2;
|
// token
|
string authorization = 3;
|
// 请求的同步/异步类型
|
RequestType syncType = 4;
|
// method
|
RequestMethod method = 5;
|
// content-type
|
RequestContentType contentType = 6;
|
// 请求业务参数
|
bytes req = 7;
|
}
|
|
// 请求到saas
|
message SaasReq {
|
// 请求的topic url
|
string rpcAddr = 1;
|
// rpc模块名
|
string rpcNode = 2;
|
// token
|
string authorization = 3;
|
// 请求的同步/异步类型
|
RequestType syncType = 4;
|
// 请求业务参数
|
bytes req = 5;
|
}
|
|
// 响应的body体
|
message BusinessReply {
|
// 返回的错误码
|
int32 code = 1;
|
// 错误信息
|
string msg = 2;
|
// 是否success
|
bool success = 3;
|
// 返回结果
|
bytes data = 4;
|
}
|
|
// 服务
|
service AiotService {
|
// 发送指向单个设备的请求
|
rpc SendToNode(NodeReq) returns (BusinessReply){}
|
// 直接发送同步tcp请求
|
rpc SendAiotSyncReq(Protocol) returns (BusinessReply){}
|
// 发送群组请求
|
rpc SendToCluster(ClusterReq) returns (BusinessReply){}
|
// 向多个设备同时发起相同参数请求
|
rpc SendToNodes(NodesReq) returns (BusinessReply) {}
|
}
|