50 lines
1.0 KiB
Protocol Buffer
50 lines
1.0 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
// 导入时间戳支持
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
// 指定生成的 C# 代码命名空间
|
|
option csharp_namespace = "IM.Protocols.Grpc.User";
|
|
|
|
package User;
|
|
|
|
service UserInternal {
|
|
// 获取单个用户信息
|
|
rpc GetUserInfoAsync (GetUserInfoRequest) returns (UserResponse);
|
|
|
|
// 批量获取用户信息
|
|
rpc GetUserListAsync (GetUserListRequest) returns (GetUserListResponse);
|
|
}
|
|
|
|
// ======================== 请求 ========================
|
|
|
|
// 获取单个用户
|
|
message GetUserInfoRequest {
|
|
string userId = 1;
|
|
}
|
|
|
|
// 批量获取用户
|
|
message GetUserListRequest {
|
|
repeated string userIds = 1;
|
|
}
|
|
|
|
// ======================== 响应 ========================
|
|
|
|
message UserResponse {
|
|
string id = 1;
|
|
string userName = 2;
|
|
string nickName = 3;
|
|
optional string email = 4;
|
|
optional string phone = 5;
|
|
string region = 6;
|
|
string description = 7;
|
|
optional string avatar = 8;
|
|
|
|
google.protobuf.Timestamp creationTime = 9;
|
|
optional google.protobuf.Timestamp deletion = 10;
|
|
}
|
|
|
|
// 批量返回
|
|
message GetUserListResponse {
|
|
repeated UserResponse users = 1;
|
|
} |