syntax = "proto3";
package src.aduib_rpc.proto;
import "google/protobuf/struct.proto";

message RpcError {
  google.protobuf.Struct data = 1;
  string message = 2;
  string code = 3;
}

message RpcTask {
  string id = 1;
  string method = 2;
  string meta = 4;
  bytes data = 5;
}

message RpcTaskResponse {
  string id = 1;
  string status = 2;
  bytes result = 3;
  RpcError error = 4;
}

message RpcTaskStream{
  oneof body {
    RpcTask task = 1;
    RpcTaskResponse task_response = 2;
  }
}

service AduibRpcService {
  rpc stream_completion(RpcTask) returns (stream RpcTaskResponse);
  rpc completion(RpcTask) returns (RpcTaskResponse);
}
